Reach a Given Number

Problem Overview

  • Determine if N can be reached from A or B by repeatedly replacing A with A+B or B with A+B, and return the minimum steps.
  • Input: integers A, B, N (−1e10 to 1e10). Output: smallest operation count or NOT POSSIBLE.
  • Domain: integer reachability and sequence growth via arithmetic operations, relevant to algorithmic reasoning.
  • This coding interview problem is an interview question from Hyperverge interviews.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: