Bloomberg New Grad SWE | Phone Interview | Counting times cars will pass by each other
Anonymous User
2213

Interview started with basic introduction (talked about myself and the favorite project that I worked on), then went to the HackerRank link provided to work on a coding challenge

The question:

Interviewer drew out the illustration exactly as shown below
<----- 0-----0--0----
----1-----1--------1->

On a 2 ways lane, there are cars driving west-bound (0) and cars driving east-bound (1), write a function that returns the amount of times that the cars will pass by each other.

The above illustration was turned into an array [1,0,1,0,0,1] as input and should return 5 (first "1" will drive by 3 "0", second will drive by 2, and third will drive by 0).

Comments (6)