1.There are n persons of different heights standing in a row, and A be an array storing their heights : A[i] stores height of ith man in the row. For each person, we want to determine the person taller to him standing nearest to him in the row. How will you do so in O(n) time in total.

Is it possible ? Then what it is ? Guess.