Open In App

# Google Summer Trainee Engineering Program(STEP) Interview Experience

Telephonic Interview 1. (Telephonic + Google Docs Shared)

Q1. Given an array of integers, you need to find the local maxima.

```Example : [1 3 5 4 7 10 6]

Output: 5 or 10

Explanation: Any of the local maxima can be the output.
Here 5 is greater than 3 and 4, 10 is greater than 7 and 6.
```

```Example : ({[][]})

Output: Valid

Explanation: Every opening bracket has a closing bracket.

Example: ({[]]})

Output: Invalid

Explanation : Every opening bracket does not have a closing bracket.
```

Telephonic Interview 2. (Telephonic + Google Docs Shared)

Q1. There are 2 arrays. Smaller is of size m and has m elements in sorted order. The bigger array is
of size m+n, where there are only n elements in initial n positions in sorted order. So, last m
positions are empty in the bigger array. Insert smaller array’s m elements in m + n array has all numbers in sorted order.

```Example :
Input Array    N[]={5, 9, 15, 20,,,,,, }  n=4
M[]={1, 3, 6, 8, 19, 35}  m=6
Output array   N[]={1, 3, 5, 6, 8, 9, 15, 19, 20, 35}
```

Q2. Given a binary tree with integer values, find the sub-path with the maximum value in it

```
Example :
1
/ Â Â \
2 Â  Â Â  3
/ Â  \ Â /Â Â  \
4Â Â Â Â  5 6Â Â Â  7

Output : Max path is 5, 2, 1, 3, 7
Explanation : 5+2+1+3+7=18 is the maximum value that can spanned.

-100
/     \
2        3
/  \     /  \
4    5   6    7

Output : Max path is 6, 3, 7
Explanation : 6+3+7=16 is the maximum value that can spanned.
```