Welcome to MindCipher, a social repository of the world's greatest brain teasers, logic puzzles and mental challenges.

Sort by:

Filtered by tag: programming

 9 Three Idols Here's a classic: Three gods A, B, and C are called, in some order, True, False, and Random. True always speaks truly, False always speaks falsely, but whether Random speaks truly or falsely is a comp ... Submitted by Aakash Hard 9.1 5 Count The Bits Write a function that counts the number of bits in an integer that are set to 1 that is linear in time complexity in the worst case, but sub-linear on average. Submitted by Jay Elliott Hard 7.6 13 Bit Pair Swap In one line of C or Java, how would you swap every pair of bits in a byte? That is, swap bits 0 and 1, 2 and 3, 4 and 5, 6 and 7. Example: 0110 1010 becomes 1001 0101. Submitted by Ravi Doable 6.6 3 Products Algorithm Given an array A[1...N] of integers, create an array O[1...N] where O[i] = the product of all elements in A except for the ith element. For example, if N = 3, and A = {6, 4, 2}, O = {8, 12, 24} The t ... Submitted by ace25 Doable 4.0