LCA problem with no parent pointers. Given the root of a tree and pointers to two nodes contained in that tree, return the lowest common ancestor of the two nodes. IE, the common ancestor furthest from the root.
Software Interview Questions
551,145 software interview questions shared by candidates
Display the sorted output of a merge of any number of sorted arrays. Then do it again, more efficiently.
Create a class implementing iterator interface to go through AVL tree.
Given a 2D array of letters, return whether a given word can be found in the grid. To make a word, you can use any adjacent character next to the character you're currently on in the word. But you cannot use the same grid index twice i.e. in a 2x2 array, you could find a 4 letter word by visiting each letter once
5 bags, each bag has some balls. 1 bag has faulty balls. There are faulty balls weighing 1.1kg and good ones weighing 1kg. There is a weighing machine. Determine in how many measurements can you find the bag with faulty balls and which bag contains it.
Given an array of integers, return true if there are contiguous numbers such that they add up to a specific target. For eg: [6,1,2,3,3,7] target sum is 8, will return true because 2,3,3 adds up to 8 and are contiguous. [6,1,2,4,3,3,7] will return false as there are no contiguous elements which adds up to 8.
How would you implement a game that you throw five dices and the values are in an array and return true if the array has 4 consecutive number
Given a list of denominations (e.g., [ 1, 2, 5 ] means you have coins worth $1, $2, and $5) and a number k, find all possible combinations, if any, of coins in the given denominations that add up to k, including repeats.
Simple OOPs question, a BFS problem, elementary number theory problem
Given a set of strings, return the smallest subset that contains prefixes for every string. If the list is ['foo', 'foog', 'food', 'asdf'] return ['foo', 'asdf']
Viewing 2101 - 2110 interview questions