How many followed the rules?

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.


The queue = \(\{134, 154, 127, 142, 145, 152, 133\}\)

The answer is \(4\), as the longest queue that satisfies the instruction is \({127, 142, 145, 152}\)


There are \(36\) 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.


Problem Loading...

Note Loading...

Set Loading...