Data Structures

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 technical problem deals with singly linked lists, and specifically with checking if a given singly linked list is a palindrome. A palindrome is defined as a word, phrase , or sequence that reads the same backward as forward, and so in this context, a palindrome linked list would be one where the order of the nodes is the same whether you traverse the list from the beginning or from the end. The input to the function is a singly linked list, and the output is a boolean value indicating whether or not the list is a palindrome.
About this solution: The candidate's solution correctly implements a function to check if a singly linked list is a palindrome. The candidate uses a stack to store the data from the first half of the list, then compares the data in the second half of the list to the data in the stack. If the data doesn't match, the list is not a palindrome. The candidate's solution is complete and correctly solves the problem. The candidate's approach is sound.
Dec 08
Code Problem / Data Structures and Algorithms DifficultyMedium C++
Given a string, find the first non-repeating character. For example, in the string "abacabad", the first non-repeating character is 'c'.
About this solution: The candidate's solution correctly finds the first non-repeating character in a string. The solution uses a hash map to keep track of the number of times each character appears in the string, then loops through the string again to find the first character that only appears once. This is a solid solution that correctly solves the problem. The candidate demonstrates a good understanding of how to use hash maps and how to loop through a string.
Dec 08
Code Problem / Data Structures and Algorithms DifficultyMedium C++
This problem asks us to find all possible subsets of a given set of distinct integers. For example, if the input is [1,2,3], then the output should be [[ ], [1], [2], [3], [1,2], [1,3], [2,3], [1,2,3]].
About this solution: The candidate's solution is complete and solves the problem. The approach is to iterate through the input array and create new subsets by adding each element to all existing subsets.
Dec 08
Code Problem / Data Structures and Algorithms DifficultyMedium C++
The problem is to find the indices of two numbers in an array that add up to a specific target. For example, given an array of numbers and a target of 9, the indices of the two numbers that add up to 9 would be returned.
About this solution: The candidate's solution is complete and solves the problem. The approach is to use a hash map to store the elements of the array and their corresponding indices. Then, for each element in the array, the candidate checks if the hash map contains an element that is equal to the target minus the current element. If such an element is found, then the candidate returns the indices of the two elements. Otherwise, the candidate adds the current element to the hash map.
Dec 08
Code Problem / Data Structures and Algorithms DifficultyMedium C++
The problem is to find the index of a given target value in a sorted array of integers, using the binary search algorithm. If the target value is not present in the array, the function should return -1.
About this solution: The candidate's solution is complete and solves the problem. The candidate has used a binary search algorithm, which is a common and efficient approach to solving this problem.
Dec 07
Code Problem / Data Structures and Algorithms DifficultyMedium Python
Given a set of distinct integers, this algorithm returns all possible subsets. The subsets must be in non-descending order, and the solution set must not contain duplicate subsets.
About this solution: The candidate's solution is correct and solves the problem. The approach is to first sort the given set, then create all possible subsets by iterating through the set and adding each element to all existing subsets.
Dec 07
Code Problem / Data Structures and Algorithms DifficultyMedium Python
Given a set of distinct integers, this algorithm will return all possible subsets. For example, if the input is [1,2,3], the output will be [[],[1],[ 2],[3],[1,2],[1,3],[2,3],[1,2,3]].
About this solution: This is a great solution! It is complete, and correctly solves the problem. The approach is also very elegant.
Dec 07
Code Problem / Data Structures and Algorithms DifficultyMedium C#
This problem asks for the shortest route between two nodes in a graph. The input is a list of nodes and their connections. The output should be the shortest route between the two given nodes.
About this solution: The candidate's solution correctly implements a breadth-first search to find a route between two nodes in a graph. The solution is complete and correctly handles edge cases such as null input values.
Dec 07