Doubt in increasing decreaing sequence

i have solved this question using array, but unable to do so without using array, please help me in it!!