Friday 8 June 2018

Don't stop learning





The body of a lobster is very soft. In order to protect itself from other enemies, it creates a shell around it. When it needs to create a shell, it goes under a rock to hide from its predators and then generates the shell .Now when the lobster grows; the shell becomes uncomfortable because the shell does not grow. Finally the lobster realizes from the uncomfortable feeling that it has grown. Then it goes back to the rock for hiding and generates the shell. This process of the lobster growing and regenerating the shell is a continuous process. 

 Same is the process of learning, while we are learning we need to encounter discomforts. The more uncomfortable you are the more you will learn. Quitter might be complacent but they do not grow. Adverse situations make us grow. Cause we learn. Learning make us move forward. It is our way of adapting to life. It took me a hell lot of effort to fight myself to change my team after 7 years of being in the same team. Change brings churn. You might feel underappreciated, always on toes but at the end of the day you have learnt more, your brain has made more neural connections.

Some confuse learning with competing. These are very different concepts. When you are competing, you are competing against A, B, C and other people. But when you are learning, the only other person you are competing with is yourself.  Are you better that what you knew /learnt yesterday? There is only one agenda. Am I giving my personal best today? If not what should I do to be better today

Sunday 25 October 2015

A good long techo discussion and i come up with this . Some insights into a problem long known and discussed . A good interview question that can be brought up for discussion and i totally loved it!!




King and Wine problem :-
The standard King and wine pblm is a very often asked puzzle . Suppose a king had 1000 bottles of wine and some traitor poisoned 1 of the bottles but was caught immediately after that .
The poison takes 1 hour to take to effect and even a single drop can cause death . The King wants to find which bottle had the poison. He can used prisoners to so the same .
What will the king do to find the poisoned bottle in 1 hour?

First solution -
This solution will get you least no of prisoners involved
Convert  each bottle to binary no .
bottle 1 = 0000000001 (10 digit binary)
bottle 2 = 0000000010
.....
bottle 1000 = 1111101000

Let each digit on this represent a prisoner . P1.......P10
So depending upon which prisoners die we can identify the bottle .

Suppose P3,P5, P6 ,P7 ,P8, P9 die , then it means that bottle
0111110100 = 500  had the poison.

This approach guarantees less prisoners are involved but can involved many deaths as well.

Second solution :-
This will guarantee that less of prisoners die

Align 1000 bottles into a 2 dimentional array (32 X 32 array)



 P1
…………
P32
P33
B1
 .............
B32
..
B33
 ...............
B64
P64
 ...................
B1000



P1 drinks from all bottles in the column P1 (B1, B33...)
P33 drinks from all bottles in column P33 (B1...B32)

Depending on which 2 prisoners die , We can find the bottle

(Extension to this -  instead of 2 direction use a 3 dimensional array (10 x 10 x10 ) and depend ingon which 3 prisoners die identify the bottle . Hence 30 prisoners)