In a classroom, the teacher ordered the students to line up according to their heights from the shortest to the tallest.
However, some mischievous kids did not follow their teacher's order and lined up in a random order.
Given a list of integers, which are the heights of the kids in the order that they lined up, find the length of the longest queue that follows the teacher's order.
Example:
The queue =
The answer is , as the longest queue that satisfies the instruction is
Problem:
There are students.
The queue
Details and Assumptions:
When two kids with the same height stand next to each other, they are considered as following the rule.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Alhail, Bruteforce