This is a verified interview question from Willingness. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Fibonacci Check - Willingness Online Assessment IIT BHU" covers key patterns like DP.
"Given an array of integers, determine for each number whether it is a **Fibonacci number**. For every element in the array: * If the number belongs to the Fibonacci sequence, return **`Yes`**. * Otherwise, return **`No`**. The Fibonacci sequence is: ```text 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ... ``` ### Input * An integer `n` representing the size of the array. * An array `arr` of `n` integers. ### Output For each element of the array, print: ```text Yes ``` if it is a Fibonacci number, otherwise: ```text No ``` ### Example 1 ```text Input: arr = [2, 4, 8, 10, 13] ``` Checking each number: ```text 2 → Yes 4 → No 8 → Yes 10 → No 13 → Yes ``` ```text Output: Yes No Yes No Yes ``` ### Example 2 ```text Input: arr = [0, 1, 7, 21] ``` ```text Output: Yes Yes No Yes ``` ### Constraints ```text 1 ≤ n ≤ 10^5 0 ≤ arr[i] ≤ 10^18 ``` **Goal:** Efficiently determine whether each number is a Fibonacci number without generating the entire Fibonacci sequence for every element."
Join thousands of developers practicing for Willingness.