Roman Elizarov
1 min readJun 17, 2019

--

0-n search also works, but 0-n variant of binary search has slightly more complex and less symmetric invariant to keep in mind, so many people fail with off-by-one errors when trying to implement one. The variant I show in the story is easier to explain, easier to code correctly.

--

--

Roman Elizarov
Roman Elizarov

Written by Roman Elizarov

Project Lead for the Kotlin Programming Language @JetBrains

No responses yet