## Can you explain the code ((n & (n – 1)) == 0)

Let’s start from the very beginning. What does A & B == 0 mean? Actually, it means that A and B do not contain single bits at the same positions. In case n & (n – 1) == 0, then n and n – 1 do not have common units. What…

## A logical task about the height of an egg crash

You are given a 100-story building. If the egg is dropped from the Nth floor height (or from a greater height), it will break. If you drop it from any smaller floor, it will not break. You have two eggs. Find the N value using the minimum number of shots. We want to pay…

## A logical task on placing the dices on a chessboard

You are given an 8×8 chessboard. Two opposite catty-corner angles and 31 dominoes were removed. Each domino can close two chessboard squares. Is it possible to fill the whole board with dominoes? Prove your answer. At first sight, it seems that it is possible. We have the 8×8 board, therefore, 64 cells, then…

## What errors can cause a C application crash

You have the source code of the application written in C, which crashes after launch. After ten starts in the debugger, you find that the application crashes each time in different places of the code. The application is single-threaded and uses only the standard C library. What errors can cause the application crashes? How will…

## Piece of cheese in the shape of a cube and a knife.

In order to get 27 small cubes, you need to divide each of the three cube faces into three parts. To reach three divisions, you need two cuts. An obvious solution is to create the cuts parallel to each other across all three axes. In order to make this, you will need only six cuts. …