Running Maximum and Minimum. O(N) with explanation
Idea: We can create a partition in array at position i if  max of [0..i] is less than min of [i+1..N-1]\nAlgorithm: Have two arrays max_left and min_right where
**Idea:** We can create a partition in array at position **i** if  max of [0..i] is less than min of [i+1..N-1]\n**Algorithm**: Have two arrays max_left and min_right where max_left[i] is max of subarray [0..i] and min_right[i] is min of subarray [i, N-1]. For every i check if max_left[i] < min_left[i+1] and increment count\n**Complexity**: Time is O(N) and Space in O(N)\n\n```\nclass Solution:\n    def maxChunksToSorted(self, arr: List[int]) -> int:\n        \n        N = len(arr)\n        max_left = [0]*N\n        min_right = [0]*N\n        \n        max_left[0] = arr[0]\n        for i in range(1, N):\n            max_left[i] = max(arr[i], max_left[i-1])\n            \n        min_right[N-1] = arr[N-1]\n        for i in range(N-2, 0, -1):\n            min_right[i] = min(min_right[i+1], arr[i])\n        \n        count = 0\n        for i in range(N-1):\n            \n            if max_left[i] <= min_right[i+1]:\n                count += 1\n                \n        return count+1\n        \n```
[]