Data Structures and 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 deals with reversing a linked list. The input is a list of nodes, and the output should be the list of nodes in reverse order.
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.
Dec 13
Code Problem / Data Structures and Algorithms DifficultyMedium C++
Given an array of n integers, where each integer represents the height of a bar in a bar graph, write a function that returns the maximum area that can be formed by choosing two bars from the array and stacking them on top of each other.
About this solution: The candidate's solution is correct and solves the problem. The approach is to keep track of the maximum area while iterating through the array from both sides.
Dec 13
Code Problem / Data Structures and Algorithms DifficultyMedium C#
This problem asks us to return all possible subsets of a given set of distinct integers. For example, if the input is [1,2,3], then the output should be all possible subsets of those integers: [1], [1,2], [1,2,3], [1,3], [2], [2,3], and [3].
About this solution: The candidate's solution is complete and solves the problem. The approach is to generate all subsets by iterating through the input array and adding each element to all existing subsets.
Dec 12
Code Problem / Data Structures and Algorithms DifficultyMedium JavaScript
This problem asks us to develop an algorithm that can determine whether or not a given string has all unique characters. For example, the input string "abcdefg" would return True, while the input string "aabbcc" would return False.
About this solution: The candidate's solution is correct and uses an efficient approach. The time complexity of the solution is O(n) and the space complexity is O(n).
Dec 12
Code Problem / Data Structures and Algorithms DifficultyMedium JavaScript
This technical problem asks the coder to return the sum of the elements in an array. The input is an array of integers and the output should be the sum of those integers.
About this solution: This solution is correct and demonstrates a level of completeness. The approach is straightforward and easy to follow.
Dec 12
Code Problem / Data Structures and Algorithms DifficultyMedium Python
Given a binary tree, this problem requires finding the maximum sum path from the root to a leaf. For example, in the tree shown above, the maximum sum path would be 3 + 5 + 10 + 2 + 11 = 31. This can be done using recursion.
About this solution: The candidate's solution correctly solves the problem. The approach is to recursively find the maximum sum path from each node to its leaves, and then compare the paths to find the overall maximum sum path.
Dec 12
Code Problem / Data Structures and Algorithms DifficultyMedium JavaScript
To find the deepest node in a binary tree, we can use recursion. We can keep track of the maximum depth as we traverse the tree, and return the deepest node's value when we reach the end of the tree.
About this solution: This is a good solution that correctly finds the deepest node in a binary tree. The approach of using a depth first search is a good one, as it only needs to traverse the tree once. The code is well-written and easy to follow.
Dec 12
Code Problem / Data Structures and Algorithms DifficultyMedium JavaScript
The "Array Sum" code problem asks the programmer to return the sum of the elements in an array of integers. An example input would be [1, 2, 3, 4], and the corresponding output would be 10.
About this solution: This is a great solution! The candidate has clearly thought through the problem and has provided a very efficient solution.
Dec 11