About this question
Medium · Code Analysis · Quant Trader interview question · binary-search, off-by-one, bug-identification, algorithms
You are tasked with reviewing a binary search implementation used in a high-frequency trading system. The system searches for the optimal price point within a sorted array of potential prices. However, under certain conditions, the binary search gets stuck in an infinite loop, causing the system to miss trading opportunities. Here is the Python code: Identify the bug in the code that leads to the infinite loop.