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 finding a target value in a sorted array using binary search. If the target value is found in the array, the index of that value is returned. If the target value is not found in the array, -1 is returned.
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 09
Code Problem / Data Structures and Algorithms DifficultyMedium C#
This technical problem involves removing duplicate elements from a singly linked list. An example input is given, as well as the expected output.
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 09
Code Problem / Data Structures and Algorithms DifficultyMedium Python
The function should return the sum of the integers that are hashed to odd values.
About this solution: The candidate's solution is optimal because it uses a generator expression to iterate over the list and sum only the values that hash to odd values. This is optimal because it is a single pass over the list and uses a generator expression to avoid creating a new list.
Dec 09
Code Problem / Data Structures and Algorithms DifficultyMedium Python
Given an array of n integers, this algorithm will find the maximum sum of any contiguous subarray of the array. For example, given the input array [1, -3, 2, 1, -1], the algorithm would output 3.
About this solution: The candidate's solution correctly finds the maximum sum of any contiguous subarray of the given array. The approach is to keep track of the current sum as we iterate through the array, and update the maximum sum if necessary. If the current sum ever becomes negative, we reset it to 0 since we know that a subarray with a negative sum will never be the maximum sum.
Dec 09
Code Problem / Data Structures and Algorithms DifficultyMedium C#
This problem deals with implementing a binary search algorithm to find the index of a given target value in a sorted array. If the target is not found, the function should return -1.
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 08
Code Problem / Data Structures and Algorithms DifficultyMedium C++
The problem asks for a way to determine whether there is a route between two nodes in a directed graph. One example is given, where the nodes are connected in a linear fashion. The solution should work for more general cases as well.
About this solution: The candidate's solution is complete and solves the problem. The candidate has used a breadth-first search approach, which is a good choice for this problem.
Dec 08
Code Problem / Data Structures and Algorithms DifficultyMedium JavaScript
Given an array of integers and a target sum, return the indices of the two numbers that add up to the target sum.
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 08
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