Manmohan pattern-1 qstn

Can we do this even more logical?

@dbhavanishankar89
Your approach is just fine and works in the appropriate time. We cannot solve this problem in any faster method. Your method is absolutely fine.