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++
Given an array of n integers, the maximum sum of any contiguous subarray of the array can be found by using the example input and output above.
About this solution: The candidate's solution correctly finds the maximum sum of any contiguous subarray of the array. The candidate's approach is to keep track of the current sum and update the maximum sum as needed. This is a good approach.
Dec 01
Code Problem / Data Structures and Algorithms DifficultyMedium C++
Given an array of integers and a target value, this problem asks if there is a pair of integers in the array that sums to the target value. An example input and output are given.
About this solution: The candidate's solution is complete and solves the problem. The candidate has used a hash map to store the complement of each number in the array. If the complement exists in the hash map, then the candidate returns true. Otherwise, the candidate adds the current number and its index to the hash map.
Dec 01
Code Problem / Data Structures and Algorithms DifficultyMedium C++
This problem asks you to return the sum of the elements in an array of integers. For example, given the input array [1, 2, 3, 4, 5], the output would be 15 (1 + 2 + 3 + 4 + 5 = 15).
About this solution: This solution is correct and solves the problem. The approach is also optimal, as it has a time complexity of O(n).
Dec 01
Code Problem / Data Structures and Algorithms DifficultyMedium Python
This technical problem involves determining whether a route exists between two nodes in a directed graph. An example input and output are given.
About this solution: The candidate's solution is correct and uses a breadth-first search to find the shortest path between two nodes. The time complexity is O(n) and the space complexity is O(n).
Dec 01
Code Problem / Data Structures and Algorithms DifficultyMedium C++
This problem deals with printing the median of a stream of integers. At each time step, the median of the integers received so far is printed out.
About this solution: The candidate's solution is complete and solves the problem. The approach is to use two priority queues, one for the max heap and one for the min heap. The max heap is used to store the smaller half of the numbers and the min heap is used to store the larger half of the numbers. This approach ensures that the median can be calculated in O(1) time.
Dec 01
Code Problem / Data Structures and Algorithms DifficultyMedium Python
This problem is about finding the first non-repeating character in a string. For example, if the input string is "GeeksforGeeks", then the output should be 'f '.
About this solution: The candidate's solution is correct and uses a dictionary to store the characters and their counts. The time complexity of this solution is O(n) because the dictionary is iterated over once. The space complexity of this solution is O(n) because the dictionary is the same size as the input string.
Dec 01
Code Problem / Data Structures and Algorithms DifficultyMedium C++
This technical problem involves finding the sum of all elements in an array. The input is an array of integers, and the output is the sum of all elements in the array.
About this solution: The candidate's solution is correct and demonstrates an understanding of how to find the sum of all elements in an array. The candidate's approach is clear and concise.
Nov 30
Code Problem / Data Structures and Algorithms DifficultyMedium Python
Given a set of distinct integers, this algorithm will return all possible permutations of those integers. For example, if the input is [1,2,3], the algorithm will return [[ 1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]].
About this solution: This solution is complete and solves the problem. The approach is to generate all permutations by iterating through the list of numbers and recursively generating all permutations of the sublist without the current number. This is then added to the list of permutations.
Nov 30