Amdocs Interview Question

.Puzzle, DS and basic Java