Knoldus Software Interview Question

Puzzle, simple java basic , Algorithm , coding