← Discussions on First Bad Version
T tkumar OFFICIAL
07 Oct 2026, 18:48

Clean C++ solution, beats most submissions.

The answer space is monotonic, so binary search on it. Be careful with the loop condition (lo < hi vs lo <= hi) and how you move the bounds.

1 reply

kavyanaidu 5 days, 15 hours ago

You can avoid the extra array and do it in O(1) space.

Sign in to reply.