## Recent Interview Questions

More Questions »- 0of 0 votes
Given two binary trees ( not BST) , return true if both of them have same inorder else return false.

Eg.`B / \ A C`

`A \ B \ C`

Both of the trees have same inorder ( A-B-C) hence function will return true

- 0of 0 votes
I am graduating in december2015 and I am targeting google. I have almost 6-8 month to go for it.I am a python developer although I have 3 year of experience in java but its 1.2 years pass I didn't touch that so I want to continue with python. I am using Python from last one year. any suggestion about python ? Or i have to go back and start with java again?

- 0of 0 votes
GLaDOS is feeling bored, so she decided to come up with a board game. The game is as follows. There is

board of dimension n x n (2 <= n <= 10). Each position in this board is either a 0 or a power of 2, between 2

and 2048. Once the board is set up, there are only two moves allowed - move all left or move all right.

The way move all left works is as follows:

For every row on the board, starting from the rightmost position each element is moved to its left. An

element with a zero value does not move. An element with non-zero value can move to its left if the value of

the element to its left is a 0 or has the same value as the current element.

In case, the element to the left is 0 then the element and 0 swap positions i.e., 4 0 0 4 would become 4 0 4 0

In case, the element to the left has the same value as the current element then the left element combines

with its right element and creates an element with double the value in place of the right element and leaves

a 0 in its current place. For e.g., 2 2 would become 4 0 or 2 2 2 2 would become 4 0 4 0.

The combining operation can cause a cascading operation i.e., if the new element created has the same

value as the element to its left, it can combine again.

For e.g., if a row had 8 4 2 2, move left would combine 2 and 2 to form 4 leading to 8 4 4 0. Now, it is

possible to combine further as the element to the left of 4 has the same value, thus after the second

combine, the row would be 8 8 0 0. And again 8 and 8 would form a 16. Thus the final values in the row

would be 16 0 0 0.

But if the row was 8 4 2 0 2, then moving left would result in 8 4 2 2 0. The cascading operation is allowed

only after a combination operation, There would no cascading operation if the element is swapped with 0.

Similar rules apply for move all right, wherein for every row elements starting from the leftmost position

move to their right.

You can either choose move all left or move all right operation but not both. Now given a state of the board,

you have determine what will be the maximum value on the board after either move all left or move all right.

Example

3

2 2 0

2 2 4

2 0 2

Move all left would result in:

4 0 0

4 0 4

2 2 0

The maximum value on the board after this move is 4.

Move all right would result in:

0 4 0

0 0 8

0 2 2

In the first row, 2 and 2 combines to form 4. In the second row, left most 2 combines with 2 to form 4. As the

element to its right has a value 4, combination operation cascades to form 8.

The maximum value on the board after this move is 8.

Now of the two operations, the higher of the two maximum values is 8. Thus the expected output is 8.

Input

3

2 2 0

2 2 4

2 0 2

Output

8

Input

3

0 0 4

0 2 2

0 4 8

Output

8

Time limit per test case:

1 second(s)

- 0of 0 votes
Given a Binary search tree of integer values. return the count of nodes where all the nodes under that sub-tree lies between a given range [x, y]. assume there are more than 100,000 nodes

- 0of 0 votes
Bring up as many approaches: Your goal is to make faster web browser for phones. You can change the phones, the data center etc. There's a limited network bandwidth and the browsers from the companies can't be altered.