beats 100% fastest solution monotonic stack
IntuitionApproachmonotonic stack approach, code is commented for explanation, this is very similar to maxChunksToSorted medium questionComplexity
Time complexit
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
monotonic stack approach, code is commented for explanation, this is very similar to maxChunksToSorted medium question
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity: N
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: N
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def maxChunksToSorted(self, arr: List[int]) -> int:
        mono=[]
        for i in range(len(arr)):
            if not mono or mono[-1]<=arr[i]: # if the curr is greater than or equal to the top of the chunk we add it. ie. create a new chunk
                mono.append(arr[i])
            else:
                top=mono[-1]
                while mono and mono[-1]>arr[i]:# if the curr element is less than the top of the chunk we consume it in the chunk
                    mono.pop()
                mono.append(top)
        return len(mono)
```
['Python3']