I applied for Senior SDE. The OA was 75 minutes with two questions, and after I finished I heard nothing at all.
Question 1, object collision on the table: given a list of object position, velocity and table length, calculate the last object on the table. Positive velocity moves right, negative moves left. During collision, velocity will exchange. Eg. position: [2, 4, 5], velocity [2, -2, 4], table length 9, object 1 and 2 will collide at position 3, at 0.5 seconds. The last object on the table is object 2, 0.5 before collision and (9-3)/2 after collision, at 3.5. Return round up value as 4.
This is the classic "ants on a plank" problem. The trick is that exchanging velocities in a collision looks exactly like the two objects passing through each other. So you can ignore collisions completely when computing when the last object falls off.
Question 2 was the same as the second question in another post on the forum.
Discussion
Loading comments…