Largest temple problem

how the sample output can be 2
it must be 3??

Hi @singhalharsh10081999

The explanation for the sample output is given preview. Do check it out.