Top 25 Programming Puzzles and Brain Teasers

 
 
Below is the list of commonly asked programming puzzles in a technical interviews –
 

 

  1. Clock angle problem – Find angle between hour and minute hand
     
  2. Add two numbers without using addition operator | 4 methods
     
  3. Implement power function without using multiplication and division operators
     
  4. Print all numbers between 1 to N without using semicolon
     
  5. Swap two numbers without using third variable | 5 methods
     
  6. Determine the if condition to print specific output
     
  7. Find maximum, minimum of three numbers without using conditional statement and ternary operator | 4 methods
     
  8. Find numbers represented as sum of two cubes for two different pairs
     
  9. Print “Hello World” with empty main() function | 3 methods
     
  10. Print all numbers between 1 to N without using any loop | 4 methods
     
  11. Print a semicolon without using semicolon anywhere in the program
     
  12. Multiply two numbers without using multiplication operator or loops
     
  13. Find square of a number without using multiplication and division operator | 3 methods
     
  14. Find if a number is even or odd without using any conditional statement
     
  15. Set both elements of a binary array to 0 in single line
     
  16. Find minimum number without using conditional statement or ternary operator
     
  17. Perform Division of two numbers without using division operator
     
  18. Generate 0 and 1 with 75% and 25% Probability
     
  19. Generate Desired Random Numbers With Equal Probability
     
  20. Return 0, 1 and 2 with equal Probability using the specified function
     
  21. Generate Fair Results from a Biased Coin
     
  22. Generate numbers from 1 to 7 with equal probability using specified function
     
  23. Implement Ternary Operator Without Using Conditional Expressions
     
  24. Determine if two integers are equal without using comparison and arithmetic operators
     
  25. Return 0 and 1 with equal Probability using the specified function
     



 
 

Thank you for being with us. 🙂

 




Leave a Reply

Notify of
avatar
wpDiscuz