PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/OpenAI

Find earliest supporting version under constraints

Last updated: Mar 29, 2026

Quick Overview

This question evaluates parsing and comparison of zero-padded version strings, handling of invalid inputs and duplicates, and design of rate-limited search strategies with complexity analysis, reflecting skills in robust input handling, algorithmic thinking, and system-aware optimization.

  • Medium
  • OpenAI
  • Coding & Algorithms
  • Machine Learning Engineer

Find earliest supporting version under constraints

Company: OpenAI

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

You are given version strings formatted as {major}.{minor}.{patch}, e.g., "103.003.03". Each version either supports a feature or not. You may call isSupported(version): bool when needed. Part A: Given an arbitrary list of versions, return the smallest (by version order) version that supports the feature. Support is not monotonic across versions (e.g., 103.003.02 may support while 103.003.03 does not). Specify how you parse/compare zero-padded segments, handle duplicates or invalid inputs, and provide time/space complexity. Explain how you would refine assumptions as counterexamples emerge from test cases. Part B: Now the API is rate-limited, so O(N) calls are disallowed. Global monotonicity still does not hold, but you are guaranteed that for any supporting version, in each immediate successor group—(i) same major and minor while patch increases, (ii) same major while minor increases, and (iii) the next major—support eventually appears at some later point. Design an algorithm that makes fewer than linear API calls to find the earliest supporting version: outline computing the latest version per major, binary searching those to find the first supporting major, then binary searching latest-per-minor within that major, and finally binary searching patches. Prove correctness under the given guarantee, analyze the number of API calls, and discuss edge cases (no supporting version, sparse support pockets, very large version spaces).

Quick Answer: This question evaluates parsing and comparison of zero-padded version strings, handling of invalid inputs and duplicates, and design of rate-limited search strategies with complexity analysis, reflecting skills in robust input handling, algorithmic thinking, and system-aware optimization.

Related Interview Questions

  • Simulate Infection Spread on a Grid - OpenAI (hard)
  • Implement Social Follow Recommendations - OpenAI (medium)
  • Build a Compose Rating Card - OpenAI (medium)
  • Generate Data Labeling Schedules - OpenAI (medium)
  • Convert IPv4 Ranges to CIDR Blocks - OpenAI (medium)
OpenAI logo
OpenAI
Sep 6, 2025, 12:00 AM
Machine Learning Engineer
Technical Screen
Coding & Algorithms
27
0

You are given version strings formatted as {major}.{minor}.{patch}, e.g., "103.003.03". Each version either supports a feature or not. You may call isSupported(version): bool when needed. Part A: Given an arbitrary list of versions, return the smallest (by version order) version that supports the feature. Support is not monotonic across versions (e.g., 103.003.02 may support while 103.003.03 does not). Specify how you parse/compare zero-padded segments, handle duplicates or invalid inputs, and provide time/space complexity. Explain how you would refine assumptions as counterexamples emerge from test cases. Part B: Now the API is rate-limited, so O(N) calls are disallowed. Global monotonicity still does not hold, but you are guaranteed that for any supporting version, in each immediate successor group—(i) same major and minor while patch increases, (ii) same major while minor increases, and (iii) the next major—support eventually appears at some later point. Design an algorithm that makes fewer than linear API calls to find the earliest supporting version: outline computing the latest version per major, binary searching those to find the first supporting major, then binary searching latest-per-minor within that major, and finally binary searching patches. Prove correctness under the given guarantee, analyze the number of API calls, and discuss edge cases (no supporting version, sparse support pockets, very large version spaces).

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More OpenAI•More Machine Learning Engineer•OpenAI Machine Learning Engineer•OpenAI Coding & Algorithms•Machine Learning Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.