1st round:- 2 Algorithmic questions
1st question:- given a sorted array of integers, find the index of largest number which is smaller than the given number, if not exists return -1.
Input
[1,2,3,5,7,8,10,11,13,14,16]
12
Output
7
2nd question :- In an election, the i-th vote was cast for votes[i] at time times[i]. Given a time t determine the candidate leading the election, Votes cast at time t will count towards our query. In the case of a tie, the most recent vote (among tied candidates) wins
Example :
Votes array : [0,1,1,0,0,1,0]
Times array : [0,5,10,15,20,25,30]
Determine leader at the following time instances 3,12,23,15,24,8
Output : 0,1,0,0,0,1
II round of interview: one puzzle, one design question.
Puzzle:- There are 100 doors, all closed. In a nearby cage are 100 monkeys. The first monkey is let out, and runs along with the doors opening every one. The second monkey is then let out, and runs along the doors closing the 2nd, 4th, 6th, … all the even-numbered doors. The third monkey is let out, and he attends only to the 3rd, 6th, 9th, 12th, … doors (every third door, in other words), closing any that is open and opening any that is closed. The fourth monkey does the same for the 4th, 8th, 12th, 16th, … doors, opening the closed ones and closing the open ones. The fifth monkey does the same to the 5th, 10th, 15th, … doors, and so on. After all 100 monkeys have done their work in this way, which doors are left open?
Design Question:- https://www.geeksforgeeks.org/design-snake-game/
Computer Fundamentals:- Vertical scaling, horizontal scaling,