Clearly, we have to first find two numbers whose difference is 2 and of which the smaller one is a perfect square and the bigger one a perfect cube.
Such numbers are 25 and 27.
Thus, Nitin is now 26 years old. Since the next perfect cube after 27 is 64,
so required time period = (64 - 26) years = 38 years.
Net ascent of the monkey in 1 hour = (30 - 20) feet = 10 feet.
So, the monkey ascends 90 feet in 9 hours i.e. till 5 p.m.
Clearly, in the next 1 hour i.e. till 6 p.m. the monkey ascends remaining 30 feet to touch the flag.