Amdocs interview question

.Puzzle, DS and basic Java