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#
The problem is to find the sum of the elements in an array of integers. An example input would be [1, 2, 3, 4, 5], and the corresponding output would be 15.
About this solution: The candidate's solution does not demonstrate a level of completeness and does not solve the problem. The general approach is not clear.
Dec 03
Code Problem / Data Structures and Algorithms DifficultyMedium JavaScript
The "two sum problem" is a classic problem in computer science that involves finding two numbers in an array that add up to a given target. This problem can be solved using a simple brute -force approach, but more efficient solutions exist, such as using a hash table.
About this solution: The candidate's solution is correct and demonstrates a level of completeness. The candidate has correctly identified the problem and has provided a solution that solves the problem. The candidate's approach is general and could be applied to similar problems.
Dec 02
Code Problem / Data Structures and Algorithms DifficultyMedium C#
This problem asks us to find the shortest path between any two words in a list. For example, given the list ["cat", "bat", "rat"], the shortest path would be " cat" -> "bat" -> "rat".
About this solution: The candidate's solution does not demonstrate a level of completeness and does not solve the problem. The general approach is not clear.
Dec 02
Code Problem / Data Structures and Algorithms DifficultyMedium C#
Given a list of integers, write a function that returns the index of the first integer that is greater than or equal to the given target. If there is no such integer, return -1 .
About this solution: The candidate's solution correctly finds the index of the first integer that is greater than or equal to the given target. However, the code could be more concise. For example, the candidate could use a for-each loop instead of a for loop. In addition, the candidate could use the Array.FindIndex method instead of writing their own loop.
Dec 02
Code Problem / Data Structures and Algorithms DifficultyMedium C#
This problem asks us to find all the words in a 2D array of characters. The input is a 2D array of characters, and the output is a list of strings containing all the words in the array.
About this solution: The candidate's solution correctly solves the problem. The candidate uses a StringBuilder to construct the words from the 2D array, which is a good approach. The candidate's code is also clean and easy to read.
Dec 02
Code Problem / Data Structures and Algorithms DifficultyMedium C#
Given a list of numbers, the function will return the index of the number if it exists in the list. If it does not exist, the function will return -1.
About this solution: The candidate's solution correctly solves the problem. However, it is not the most efficient solution. A more efficient solution would be to use a binary search algorithm, which would run in O(log n) time.
Dec 02
Code Problem / Data Structures and Algorithms DifficultyMedium C#
Given an unsorted array, this algorithm finds the length of the longest consecutive elements sequence.
About this solution: The candidate's solution does not demonstrate a level of completeness and does not solve the problem. The general approach is not clear.
Dec 02
Code Problem / Data Structures and Algorithms DifficultyMedium JavaScript
Given a string, reverse the order of the words. Do not use any built-in reverse functions.
About this solution: This solution is correct and demonstrates a level of completeness. The approach is straightforward and easy to understand. The time and space complexity of the solution is also optimal.
Dec 01