A week ago Purrfeed worked fine; today the Like button doesn't respond. A thousand commits landed in that week. Checking them one by one would take until retirement. Byte knows a better way: cut the history in half.
Write a function findFirstBad(commits, isBad):
commits is an array of commit hashes, oldest to newest;isBad(commit) is a check: it builds the project at that commit and returns true if the bug is already there;- the newest commit is definitely bad (that's where the bug was found), and once a commit is bad, every later commit is bad too.
Return the hash of the first bad commit. Every check means building the project, so they're limited: no more than 4 checks for 8 commits, no more than 11 for 1000. If there are too many checks, the test shows an object { answer, checks, limit }.