โ† Amazon questions

Find faulty commit using deployment function

Filed under Amazon

Free read 1 of 3

Identify the search range for both A and B.

The question

You have a function deploy(a, b) that returns true if commits 1..a of project A and 1..b of project B are stable. Given the system is currently failing, find the first commit pair (a, b) that caused the failure using binary search.

Constraints

  • Function is monotonic (true followed by false)
  • Search space is defined by the range of commits
  • Minimize calls to deploy(a, b)

Approach

  1. Identify the search range for both A and B.

Tips

  • What they are testing: Consider if the search space is 1D or 2D; if 2D, nested binary search is required.
  • Common mistake: Off-by-one errors in binary search range boundaries.

Related Amazon questions

Collected from public candidate posts and coding forums. Updated Nov 2026.