Here is my logic, copy and sort the copied array, now compare sorted array and original array, wherever the max is same continue the slice otherwise if max is not same create a new slice.

Note that Max A is simple prefix max of A upto that index.

Ex1. A=[2,4,1,6,5,9,7] (given array)

Max A=[2,4,4,6,6,9,9] (max of prefix of unsorted A upto index i)

Sort A=[1,2,4,5,6,7,9] (sorted A)

At index 0, max of unsorted A is not same as sorted A, so we create a new segment, [2]

At index 1, same as above, so segment is [2,4]

At index 2, max of unsorted A is same as sorted A (4), include that element and end the segment [1,2,4]

At index 3, max of unsorted A is not same as sorted A, so segment is [6]

At index 4, max of unsorted A is same as sorted A (6), include that element and end the segment [6,5]

... and so on