## Flipkart Interview Question

SDE-2s**Country:**India

**Interview Type:**In-Person

I don't know if it's optimal, but I managed to improve the minimum steps needed for a 3 peg problem, in a 4 peg problem.

let T(n) be the amount of steps needed to move "n" discsto another peg

`T(n) = 2*T(n-2)+3`

explanation: you move all but 2 discs to a helper,

then move the n-1 disc to helper2,

move the last disc to the destination,

then from helper2 to destination,

and lastly the n-2 discs to detination.

ultimately if sums up to

`2^(n/2)-1`

I used the 3 and 4 discs as a test and it seems to work.

Just a correction:

- MichaelB April 29, 2014