Category Archives: Mathematical

Length of largest subarray of Fibonacci Numbers

Given an array arr[] of integer elements, the task is to find the length of the largest sub-array of arr[] such that all the elements of the sub-array are Fibonacci numbers. Examples: Input: arr[] = { 4, 2, 3, 4, 5, 8, 11 } Output: 2 Explanation: Maximum length sub-array with all elements as Fibonacci number is {2,… Read More »

Find GCD of two numbers

Given two numbers A and B, the task is to calculate GCD of A and B. Examples: Input : A = 4, B = 6 Output : 2 Input : A = 5, B = 10 Output : 5 GCD (Greatest Common Divisor) of two number is the largest number that divides both of them. A simple solution… Read More »

Find Top-Ranked Student Based on Exam Scores in C++

There are N student from class 12th,each student finished thier exam and exam consist with four subjects like math, computer, physics and chemistory. Result is announced and result list consist with student identity number with their corresponding marks scored in each subject. Our task is to find ranked student among the N student. Example: Suppose there are 5… Read More »