We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. Mathematics
  3. Fundamentals
  4. Is Fibo

Is Fibo

Problem
Submissions
Leaderboard
Discussions
Editorial
Topics

You are given an integer, . Write a program to determine if is an element of the Fibonacci sequence.

The first few elements of the Fibonacci sequence are . A Fibonacci sequence is one where every element is a sum of the previous two elements in the sequence. The first two elements are and .

Formally:

Function Description

Complete the isFibo function in the editor below.

isFibo has the following parameters:
- int n: the number to check

Returns
- string: either IsFibo or IsNotFibo

Input Format
The first line contains , number of test cases.
lines follow. Each line contains an integer .

Constraints

Sample Input

STDIN   Function
-----   --------
3       t = 3
5       n = 5
7       n = 7
8       n = 8

Sample Output

IsFibo
IsNotFibo
IsFibo

Explanation
is a Fibonacci number given by
is not a Fibonacci number
is a Fibonacci number given by

Time Limit
The time limit for this challenge is given here.

Author

shashank21j

Difficulty

Medium

Max Score

20

Submitted By

41770

Need Help?


View discussions
View editorial
View top submissions
RESOURCES

  • Fibonacci Numbers
  • Binet's Forumula
  • Precomputation

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy