Find Minimum Compatible Version
Company: OpenAI
Role: Machine Learning Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Onsite
Quick Answer: This question evaluates binary search, monotonic predicates, careful version ordering, and cost-aware optimization of expensive compatibility checks. It is commonly asked in the Coding & Algorithms domain to test reasoning about monotonicity, minimizing API calls, and adapting search strategies when monotonicity holds only within subranges; the level of abstraction combines conceptual understanding of monotone properties with practical application of efficient search techniques.
Part 1: First Compatible Version
Constraints
- `0 <= len(versions) <= 200000`
- `len(versions) == len(compatible)`
- `versions` is strictly increasing
- `compatible` has the form `False...False, True...True`
Examples
Input: ([100, 101, 102, 103, 104], [False, False, True, True, True])
Expected Output: 102
Explanation: The first compatible entry is at index 2, so the answer is version 102.