Google | Phone Interview | SDE 1 | Find bad commit
Anonymous User
3141

Coding Question:

You are working on a project and you noticed that there has been a performance decrease between two releases. You have a function:

boolean worseCommit(int commit1, int commit2)
that runs performance tests and returns true if commit2 is worse than commit1 and false otherwise.

Find all of the bad commits that have decreased the performance between releases. Assume no improvement in performance.

Commit Id: 1, 2, 3, 4, 5, 6, 7, 8, 9

Performance: 10, 10, 10, 8, 8, 8, 5, 5, 5

Output 4, 7

Comments (15)