Top 25 Programming Puzzles and Brain Teasers

Following is the list of commonly asked programming puzzles in technical interviews:

  1. Clock Angle ProblemEasy
  2. Add two numbers without using the addition operatorEasy
  3. Implement power function without using multiplication and division operatorsEasy
  4. Print all numbers between 1 to N without using a semicolonMedium
  5. Swap two numbers without using a third variableEasy
  6. Determine the if condition to print the specific outputEasy
  7. Find maximum and minimum value of a triplet without using a conditional statementMedium
  8. Find numbers represented as the sum of two cubes for two different pairsMedium
  9. Print “Hello World” with empty main functionMedium
  10. Print all numbers between 1 to N without using any loopEasy
  11. Print a semicolon without using a semicolon anywhere in the programEasy
  12. Multiply two numbers without using a multiplication operator or loopsEasy
  13. Find the square of a number without using the multiplication and division operatorEasy
  14. Check if a number is even or odd without using any conditional statementEasy
  15. Set both elements of a binary array to 0 in a single lineEasy
  16. Find minimum number without using conditional statement or ternary operatorMedium
  17. Perform division of two numbers without using division operatorMedium
  18. Generate 0 and 1 with 75% and 25% probabilityMedium
  19. Generate desired random numbers with equal probabilityMedium
  20. Return 0, 1, and 2 with equal probability using a specified functionMedium
  21. Generate fair results from a biased coinHard
  22. Generate numbers from 1 to 7 with equal probability using a specified functionHard
  23. Implement ternary operator without using conditional expressionsMedium
  24. Determine if two integers are equal without using comparison and arithmetic operatorsEasy
  25. Get 0 and 1 with equal probability using a specified functionMedium

Rate this post

Average rating 4.81/5. Vote count: 52

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Tell us how we can improve this post?

Thanks for reading.

To share your code in the comments, please use our online compiler that supports C, C++, Java, Python, JavaScript, C#, PHP, and many more popular programming languages.

Like us? Refer us to your friends and support our growth. Happy coding :)


guest
0 Comments
Inline Feedbacks
View all comments
Do NOT follow this link or you will be banned from the site!