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 Python
This problem asks you to find the sum of all the elements in an array, using recursion. That is, you need to define a function that takes in an array of integers, and returns the sum of all the integers in the array. For example, given the input [1, 2, 3, 4], your function should return 10.
About this solution: This solution is complete and solves the problem. The approach is straightforward and easy to follow.
Nov 07
Code Problem / Data Structures and Algorithms DifficultyMedium Python
Given a list of integers, this function returns the index of the first element that is greater than the given integer.
About this solution: The candidate's solution correctly returns the index of the first element that is greater than the given integer. The candidate's approach is to iterate through the list and compare each element to the given integer. If the element is greater than the given integer, the index of that element is returned. If no element in the list is greater than the given integer, the candidate returns -1.
Nov 07
Code Problem / Data Structures and Algorithms DifficultyMedium Python
Given a binary tree and a value, return the sum of all values in the tree that are greater than or equal to the given value.
About this solution: The candidate's solution is complete and solves the problem. The approach is to recursively traverse the tree, keeping track of the sum of values that are greater than or equal to the given value. This is a good approach and is implemented correctly.
Nov 07
Code Problem / Data Structures and Algorithms DifficultyMedium Python
The Two-Sum Hashing problem is to find two numbers in an array that add up to a given target number. This can be solved using a hash table, which stores the array elements and their corresponding indices. To find two numbers that add up to the target, we can iterate through the array, and check if the complement (target - array[i]) exists in the hash table. If it does, then we have found our two numbers.
About this solution: The candidate's solution is correct and demonstrates a level of completeness. The solution uses a hash table to store the numbers in the array and then checks if the target minus the number is in the hash table. If it is, then the two numbers that add up to the target are found. This solution is optimal because it is O(n) time complexity and O(n) space complexity.
Nov 06
Code Problem / Data Structures and Algorithms DifficultyMedium Python
This technical problem deals with removing duplicate elements from a linked list. Given an input list with duplicates, the goal is to produce an output list with all duplicates removed. An example input and output is provided.
About this solution: The candidate's solution correctly removes duplicates from a linked list. The approach is straightforward and easy to follow.
Nov 06
Code Problem / Data Structures and Algorithms DifficultyMedium Python
Given a sorted array of integers and a target value, this function will return the index of the target value if found, or -1 if not found.
About this solution: The candidate's solution is complete and solves the problem. The candidate has used binary search, which is the most efficient way to search a sorted array for a target value.
Nov 05
Code Problem / Data Structures and Algorithms DifficultyMedium Python
This problem deals with finding a target value in a sorted array of integers. The function should return the index of the target value if it is found in the array, or -1 if it is not found.
About this solution: This solution is optimal because it is O(n) time complexity. However, it only works if the array is sorted. If the array is not sorted, this solution will not work.
Nov 04
Code Problem / Data Structures and Algorithms Python
To find the sum of all elements in an array, simply iterate through the array and add each element to a total sum.
About this solution: The candidate's solution is correct and demonstrates a level of completeness. The candidate's approach is clear and understandable.
Oct 27