Algorithms

Categories: Code Problem / Data Structures and Algorithms / Recursion (32) Code Problem / Data Structures and Algorithms / Binary Search (30) Code Problem / Data Structures and Algorithms / Linked Lists (26) Code Problem / Data Structures and Algorithms / Backtracking (26) Code Problem / Data Structures and Algorithms / Stacks and Queues (25) Code Problem / Data Structures and Algorithms / Hashing (24) Databases / SQL / Backup and Recovery (19) Code Problem / Data Structures and Algorithms / Arrays and Strings (19) Databases / SQL / Database Normalization (18) Code Problem / Data Structures and Algorithms / Time Complexity (17) Databases / SQL / Locking (16) Databases / SQL / Replication (15) Databases / SQL / SQL Queries (13) Code Problem / Data Structures and Algorithms / Graphs (13) Databases / SQL / Database Security (13)  More...

Recent solutions:

Check these solutions from our community:
Code Problem / Data Structures and Algorithms DifficultyMedium C#
This problem asks you to find the maximum path sum from the root to a leaf in a binary tree. An example input and output are given.
About this solution: The candidate's solution does not demonstrate a level of completeness and does not solve the problem. The approach is not clear.
Nov 28
Code Problem / Data Structures and Algorithms DifficultyMedium Python
The function should take a sorted array of integers and a target value as inputs, and return the index of the target value if it exists in the array, or -1 if it does not .
About this solution: This is a well-detailed and complete solution to the problem. The candidate has correctly identified the time and space complexity of the solution and has provided a clear explanation of the approach. The candidate has also correctly implemented a binary search algorithm to solve the problem.
Nov 28
Code Problem / Data Structures and Algorithms DifficultyMedium C++
This problem asks you to generate all possible subsets from a set of distinct integers. For example, given the input [1,2,3], the output should be [[3],[1 ],[2],[1,2,3],[1,3],[2,3],[1,2],[]]
About this solution: The candidate's solution is complete and solves the problem. The candidate's approach is to first add the empty subset to the result, and then iterate through the numbers in the input array. For each number, the candidate loops through all the subsets in the result and adds the number to create a new subset. This approach is correct.
Nov 28
Code Problem / Data Structures and Algorithms DifficultyMedium Python
The problem is to find the sum of all the integers in a stack. An example input is given, as well as the expected output.
About this solution: This solution is complete and solves the problem. The approach is straightforward and easy to follow.
Nov 28
Code Problem / Data Structures and Algorithms DifficultyMedium C++
This problem asks you to write a function that takes in an array of integers and returns true if any element appears more than once in the array. Otherwise, the function should return false.
About this solution: This is a great solution! The candidate has used a hash set to keep track of unique elements in the array as they iterate through it. This is an efficient way to solve the problem with a time complexity of O(n).
Nov 27
Code Problem / Data Structures and Algorithms DifficultyMedium C++
Given a string of digits, this problem seeks to find all possible valid IP addresses that could be generated from it. IP addresses are typically represented in dot-decimal notation (e.g . "192.168.1.1"), so the goal is to find all possible ways to group the digits in the input string into sets of four that could each correspond to one section of an IP address.
About this solution: The candidate's solution is complete and solves the problem. The candidate's approach is to generate all possible IP addresses and check if they are valid.
Nov 27
Code Problem / Data Structures and Algorithms DifficultyMedium C++
Print the power set of a set of distinct integers. The power set of a set is the set of all its subsets.
About this solution: The candidate's solution is complete and solves the problem. The approach is to use bitwise operators to generate all possible subsets. This is a clever approach that demonstrates a good understanding of bitwise operators.
Nov 27
Code Problem / Data Structures and Algorithms DifficultyMedium C++
This problem asks you to reverse a string using a stack. An example input and output are provided.
About this solution: The candidate's solution is correct and uses a stack to reverse the string as required. The candidate's code is clean and easy to read. Well done.
Nov 27