Leaderboard
Showing:
Check if the number is Fibonacci
Basic Accuracy: 55.6% Submissions: 1556 Points: 1

Check if a given number N is the Fibonacci number. A Fibonacci number is a number that occurs in the Fibonacci series.

 

Example 1:

Input:
N = 34
Output:
Yes
Explanation:
34 is one of the numbers 
of the Fibonacci series.

 

Example 2:

Input:
N = 41
Output:
No
Explanation:
41 is one of the numbers 
of the Fibonacci series.

 

 

Your Task:

You don't need to read input or print anything. Your task is to complete the function checkFibonacci() which takes an integer N and returns a string "Yes" if it is a Fibonacci number else "No".

 

Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)

 

Constraints:
1 <= N <= 100

 

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Check if the number is Fibonacci

Output Window