on Saturday, 28 March 2020
You have a metallic chain which has to be paid to a worker for working for 7 days.
You can cut the chain and can pay the worker each day for the work done.
What is the minimum number of cuts required in the chain for paying the worker.

Click here for the solution.

on Wednesday, 25 March 2020

We can deduce the rotation of the disc with 2 sensors by placing them at an angle of 90 degree.
Let us say we have 2 sensors named A and B.

Now there are two possible initial values of the sensor. Either Black or White.
Let us assume that Black - 0 and White - 1

The disc is rotating clockwise if Sensor A changes to the value of Sensor B and Sensor B becomes Sensor A XOR 1

The disc is rotating counter clockwise if Sensor A changes to the value of Sensor B XOR 1 and Sensor B becomes Sensor A.

This is explained with the below table.



Initial Clockwise Counter-Clockwise
A - Black B - Black A - Black B - White A - White B - Black
A - Black B - White A - White B - White A - Black B - Black
A - White B - Black A - Black B - Black A - White B - White
A - White B - White A - White B - Black A - Black B - White
You are given a disc.
One half of the disc is painted black and other half of the disc is white.
You are provided with camera sensors which can predict the color of the disc.
Sensors will indicate the color of the disc.
Find the minimum number of sensors required for to find the direction of the moving disc.



Click here for the solution.
on Wednesday, 12 February 2020
To determine whether a 32 bit number is even or odd we need to check the LSB of that number.
If least significant bit of the number is 0 then it is even otherwise it is odd.

So in the incoming 32 bit numbers we just have to check the Least significant bit of the number and we should be able to check the same.

This is the most optimal solution in terms of hardware design or software compilation.
A sequence of 32 bit numbers arrive in order. Design a logic to check for even and odd numbers in this sequence and let the user know the same.
Logic should be most optimal and should work in every case.

Click here for the solution.