values in sweeps. In one sweep it moves left to right and picks up any set of numbers that are **strictly increasing** in the order they appear (they do not have to be adjacent). The remaining numbers keep their order.
Return the smallest number of sweeps that leaves the array empty.values=[4, 6, 2, 5, 1, 3] → 3
Three sweeps: [4, 6], [2, 5], [1, 3]. Two are not enough: 6, 5 and 3 appear in decreasing order, so no two of them can share a sweep.
values=[7, 7, 7] → 3
The increase must be strict, so equal numbers always go in different sweeps.
values=[2, 3, 9] → 1
The array already increases strictly, so one sweep is enough.
values=[4, 6, 2, 5, 1, 3]
3
Run checks the first 3 tests in your browser. Submit checks all 122 tests on the server, hidden ones included.