PayPal Interview Question

Burning rope Puzzle, Calculate Mode