GlobalLogic interview question

puzzles (refer geeksforgeeks)