**Puzzle**: You are on your way to visit your Grandma, who lives at the end of the valley. It’s her anniversary, and you want to give her the cakes you’ve made. Between your house and her house, you have to cross 5 bridges, and as it goes in the land of make believe, there is a troll under every bridge! Each troll, quite rightly, insists that you pay a troll toll. Before you can cross their bridge, you have to give them half of the cakes you are carrying, but as they are kind trolls, they each give you back a single cake.

How many cakes do you have to leave home with to make sure that you arrive at Grandma’s with exactly 2 cakes?

**Solution**:

**2 Cakes**

How?

At each bridge you are required to give half of your cakes, and you receive one back. Which leaves you with 2 cakes after every bridge.

This is very cool interview puzzle.

let us consider we will take x cake in the starting of my journey.

after first bridge I will have (x+2)/2.

(explanation : half of cake I will deliver to bridge as a toll then I will have x/2 cake but bridge will provide me 1 more cake so total I will have x/2 +1 = (x+2)/2 after crossing the first bridge.

I will have (x+6)/4 cakes after crossing of 2nd bridge .(according to same explanation)

and finally when I will cross 5th bridge then I will have (x+62)/32 cakes.

according to question (x+62)/32=2 and hence x= 2.

I hope it is clear to u.

Let it make it simple to understand

He carries 2 take and at very toll he has to give half of it which means he has to give 1 full cake out of 2 cakes and he gets back 1 cake in return and this process is repeated at every toll. So he has 2 cakes everytime at every toll.

give me back total 5 cake,

total bridges 5

cake2(5) = 10

10/5 = 2