Share a problem that you failed to solve in an onsite recently
Frog jump at google with optimum solution I saw it on leetcode but didn’t solve it before onsite
LC hard. Tough luck.
I wonder if they would have let you pass with the non-optimal DP solution.
Sorting an array such that the sum of the adjacent elements is a perfect square.
Like [-9,22,3,0,1] becomes [0,1,3,22,-9]? What if no such ordering is possible? The sum of every consecutive pair with step = 1 or 2?
It would be trivial with step=2, no?
Given a grid of letters and a dictionary, find the largest set of dictionary words appearing in the grid, such that no words overlap. I had the idea but coding it up is tricky
Backtrack? Or something else? Very nice question
Basically you have to use two kinds of backtracking. One to find all words, and one to try all combinations of those words.
Runlength encoding without using extra space
Filter Fibonacci numbers from a list of non-negative integers. For example: Given [2,17,1,13,11], output: [2,1,13]. I gave an idea to solve it but couldn't complete the code.
How to approach this ?
Get all two additives for the number and recursively check if both are Fibonacci number
Iterative post order binary tree traversal in 35 mins.
For this question, did they ask to do in O(1) space?
You can’t do it in O(1) space unless you’re doing a Morris traversal, which is kind of cheating since it modifies the tree and restores it as it goes. The typical solution for this is to use a stack and node pointer.
Level order traverser iterative
What the hell is interactive?
Means?
P vs NP
Kth smallest element from two sorted arrays in logarithmic time , const space
Feel sorry for you. This is definitely very painful to code while making sure it works on all edges cases.
Was asked at G phone interview. :( .
Vertical order traversal
At G?
Same here.