Nvest Solution interview question

Basic Logical Question from Geeksforgeeks