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 technical problem involves finding the index of a target value in a sorted array. If the target value is not present in the array, the function should return -1.
About this solution: The candidate's solution is correct and demonstrates a level of completeness. The candidate has correctly identified binary search as the optimal solution for this problem and has implemented it correctly. The candidate's approach is clear and easy to follow.
Nov 11
Code Problem / Data Structures and Algorithms DifficultyMedium Python
This problem asks you to reverse the order of the nodes in a singly linked list. For example, if the input list is 1->2->3->4->5, the output should be 5->4->3->2->1.
About this solution: The candidate's solution correctly reverses the order of the nodes in a singly linked list. The approach is straightforward and easy to follow.
Nov 11
Code Problem / Data Structures and Algorithms Python
Given a string consisting of only lowercase letters, this program generates a new string with the same letters in reverse order. For example, an input of "abcdefg" would produce an output of "gfedcba".
About this solution: The candidate's solution is correct and uses the built-in function reversed(). The time and space complexity of the solution is O(n).
Nov 11
Code Problem / Data Structures and Algorithms DifficultyMedium Python
Given a list of integers and a target number, the function should return the index of the first number in the list that is larger than the target number. If there is no such number, the function should return -1.
About this solution: This solution is correct and demonstrates a good understanding of time and space complexity.
Nov 11
Code Problem / Data Structures and Algorithms DifficultyMedium Python
This technical problem asks the reader to write a function that returns the sum of the elements in a stack. An example input and output is provided.
About this solution: This solution correctly calculates the sum of the elements in a stack. However, it would be helpful if the function included a docstring explaining what it does. Additionally, it is generally good practice to include comments in code to explain what is happening. For example, a comment explaining why the sum variable is initialized to 0 would be helpful.
Nov 10
Code Problem / Data Structures and Algorithms DifficultyMedium Python
Given a sorted array of integers, this function returns the index of a given target value. If the target value is not present in the array, it returns -1.
About this solution: This solution is correct and demonstrates a good understanding of time complexity.
Nov 10
Code Problem / Data Structures and Algorithms DifficultyMedium Python
This problem asks for a efficient way to implement a Queue using two Stacks.
About this solution: The candidate's solution is correct and solves the problem. The candidate's approach is to use two stacks, with one stack being used for enqueueing and the other stack being used for dequeueing. This is a valid approach.
Nov 10
Code Problem / Data Structures and Algorithms DifficultyMedium Python
This function takes in a 2D array and determines if it is a valid Sudoku board. A Sudoku board is valid if each row, column, and 3x3 subarray contains exactly 9 integers.
About this solution: The candidate's solution correctly solves the problem. The solution is complete, with functions to check rows, columns, and 3x3 subarrays. The candidate's approach is clear and easy to follow.
Nov 09