Fibonacci Member

Easy
0/40
29 upvotes
Asked in companies
MicrosoftAmazonSamsung

Problem statement

Create a function that determines whether a given number N belongs to the Fibonacci sequence. If N is found in the Fibonacci sequence, the function should return true; otherwise, it should return false.


Detailed explanation ( Input/output format, Notes, Images )
Input Format :
Integer N
Output Format :
true or false
Constraints :
0 <= n <= 10^4
Sample Input 1 :
5
Sample Output 1 :
true
Explanation :
Fibonacci sequence begins 0, 1, 1, 2, 3, 5, ... and so on. Since 5 appears in the sequence.
Sample Input 2 :
14
Sample Output 2 :
false    
Approaches (1)
Time Complexity
Space Complexity
Code Solution
(100% EXP penalty)
Fibonacci Member
Full screen
Console