Amdocs interview question

they ask the puzzle also