Closest Land Mark

Problem Overview

  • Find the distance from an integer N to the nearest Fibonacci number.
  • Input: int N where 0 ≤ N ≤ 1,000,000; Output: int minimal distance (≥ 0).
  • Context: think of N as your position on a number line and Fibonacci numbers as landmarks.
  • A Meta interviews coding interview problem and common interview question.

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: