Math and bits interview questions
Primes, GCD, digits, powers and bit tricks.
9 questions solved with this pattern, most asked first. Reported by candidates in public interview write-ups and reworded by Scrivio. How the reports are counted
Your progress: 0 of 9 done, 0 saved
An array holds the numbers 1 to n with one missing. Find the missing number.
Reported 43 times
Read the solutionArrays and stringsExample sources
3 of the write-ups counted: geeksforgeeks.org 2024, geeksforgeeks.org 2019, geeksforgeeks.org 2016
Print the first n numbers of the Fibonacci sequence.
Reported 32 times
Read the solutionMath and bit manipulationExample sources
3 of the write-ups counted: geeksforgeeks.org 2024, geeksforgeeks.org 2022, geeksforgeeks.org 2018
Swap two numbers without using a temporary variable.
Reported 24 times
Read the solutionMath and bit manipulationExample sources
3 of the write-ups counted: geeksforgeeks.org 2022, geeksforgeeks.org 2021, geeksforgeeks.org 2020
Check whether a number is a palindrome.
Reported 20 times
Read the solutionMath and bit manipulationExample sources
3 of the write-ups counted: geeksforgeeks.org 2015, geeksforgeeks.org 2015, geeksforgeeks.org 2014
Write a program that checks whether a number is prime.
Reported 20 times
Read the solutionMath and bit manipulationExample sources
3 of the write-ups counted: geeksforgeeks.org 2017, geeksforgeeks.org 2021, geeksforgeeks.org 2017
Find the next larger number that uses exactly the same digits as a given number.
Reported 19 times
Read the solutionArrays and stringsExample sources
3 of the write-ups counted: geeksforgeeks.org 2017, geeksforgeeks.org 2017, geeksforgeeks.org 2024
Print all prime numbers up to N.
Reported 17 times
Read the solutionMath and bit manipulationExample sources
3 of the write-ups counted: geeksforgeeks.org 2023, geeksforgeeks.org 2023, geeksforgeeks.org 2022
Reverse the digits of an integer.
Reported 17 times
Read the solutionMath and bit manipulationExample sources
3 of the write-ups counted: geeksforgeeks.org 2018, geeksforgeeks.org 2019, geeksforgeeks.org 2019
An array holds n-1 distinct integers from 1 to n; find the one that is missing.
Reported 15 times
Read the solutionMath and bit manipulationExample sources
3 of the write-ups counted: geeksforgeeks.org 2021, geeksforgeeks.org 2018, geeksforgeeks.org 2019