Join our community to practice, learn, solve your problems with AI. Recruiters: create tests and evaluate candidates instantly.
Categories: Code Problem Databases Python Programming Languages Mathematics Machine Learning NodeJS Puzzles Math Algorithms Strings Theorems Data structures Games JavaScript  More...

Recent solutions:

Check these solutions from our community:
Code Problem / Data Structures and Algorithms DifficultyMedium C++
Given a singly linked list, this function returns the middle node of the list. If the list has an even number of nodes, the function returns the node at the start of the second half of the list.
About this solution: The candidate's solution is complete and solves the problem. The candidate's approach is to create a linked list from the given vector data, print the list, and then find the middle node of the list.
Dec 05
Code Problem / Data Structures and Algorithms DifficultyMedium C++
This problem deals with finding all possible subsets of a set of distinct integers. The elements in each subset must be in non-descending order, and the solution set must not contain duplicate subsets.
About this solution: The candidate's solution is complete and solves the problem. The approach is to use a backtracking algorithm to generate all possible subsets.
Dec 05
Code Problem / Data Structures and Algorithms DifficultyMedium Python
This problem asks you to reverse a string using a stack. An example input and output is provided.
About this solution: This is a good solution that uses a stack to reverse the string. The stack is a LIFO data structure, so the last character in the string will be the first character in the stack. The first character in the string will be the last character in the stack. The stack will be popped until it is empty, and the characters will be added to a new string. The new string will be the reversed string.
Dec 05
Code Problem / Data Structures and Algorithms DifficultyMedium JavaScript
This technical problem deals with how to print all possible permutations of a given string using recursion. For example, if the input string is "abc", the output would be all six possible permutations of the string: "abc", "acb", "bac", "bca", "cab", and "cba".
About this solution: This is a good solution that uses recursion to generate all permutations of a given string. The time complexity of this solution is O(n!), which is optimal.
Dec 05
Code Problem / Data Structures and Algorithms DifficultyMedium C++
Given an array of integers, this problem aims to find the length of the longest increasing subsequence in the array. For example, given the input array [10, 9, 2, 5 , 3, 7, 101, 18], the output should be 4, as the longest increasing subsequence in the array is [2, 3, 7, 101]. This problem can be solved using dynamic programming, and the time complexity of the solution is O(n^2).
About this solution: The candidate's solution is correct and uses dynamic programming to solve the problem. However, the solution is not very efficient because it uses two for loops.
Dec 05
Code Problem / Data Structures and Algorithms DifficultyMedium C#
Find the first non-repeating character in a given string.
About this solution: The candidate's solution correctly solves the problem and uses a reasonable approach.
Dec 04
Code Problem / Data Structures and Algorithms DifficultyMedium JavaScript
A stack is a data structure that supports push, pop, and min operations in constant time.
About this solution: The candidate's solution is complete and solves the problem. The candidate's approach is to use a second stack to keep track of the minimum value. When a new value is pushed onto the stack, it is also pushed onto the min stack if it is less than or equal to the current min value. When a value is popped off the stack, it is also popped off the min stack if it is equal to the current min value. This way, the min stack will always have the current min value at the top. This solution is optimal because it allows for constant time min operations.
Dec 04
Code Problem / Data Structures and Algorithms DifficultyMedium C++
Given an array of positive integers and a positive integer s, this function returns the minimal length of a contiguous subarray of which the sum is greater than or equal to s. If there isn 't one, it returns 0 instead.
About this solution: This is a great solution! The candidate has taken the time to include comments explaining what the code is doing, which is always appreciated. The code itself is clean and well-organized.
Dec 04