Problem Β· Math
Closest Land Mark π
Learn this problemProblem statement
Imagine you're on a journey along the path of numbers, starting from your current location marked by an integer N. Your goal is to find the nearest landmark, which happens to be a Fibonacci number. But before you can reach it, you must determine the distance you need to travel to get there. Your task is to calculate this distance and return it as another integer.
Function
closestLandMark(aNum: int) β int
Complete the function closestLandMark in the editor π.
closestLandMark has the following parameter:
int aNum: an integer number
Returns
int: the distance to the closest "land mark".
Memo: For original prompt, pls refer to source image π
Examples
Example 1
aNum = 25return = 4No explanation provided for now. Will add once find it :)
Example 2
aNum = 5return = 0No explanation provided for now. Will add once find it :)
Constraints
0 β€ N β€ 1,000,000More Meta problems
- Plan a Minimum-Cost Round TripONSITE INTERVIEW Β· Seen Jul 2026
- Merge Three Sorted ArraysPHONE SCREEN Β· Seen May 2026
- Highest Rating Price RatioOA Β· Seen Mar 2026
- Diagonal Traverse (for E4 ;)PHONE SCREEN Β· Seen Mar 2025
- Find Peak ElementPHONE SCREEN Β· Seen Mar 2025
- Find Pair Closest to K (for E5 :)PHONE SCREEN Β· Seen Feb 2025
- Get Minimum Round Trip Cost (: for E4 && E5 :)PHONE SCREEN Β· Seen Feb 2025
- Max Consecutive Ones III (for E5 :)PHONE SCREEN Β· Seen Feb 2025