Python solution using right min and current max
Algorithm and Intuition: We have to maximize the number of chunks or partitions we can make. The idea is suppose we are at index i and we know that the minimum 
**Algorithm and Intuition:** We have to maximize the number of chunks or partitions we can make. The idea is suppose we are at index i and we know that the minimum element from i+1 to last element is greater than or equal to the maximum element till index i then we can say that this partition between index i and i+1 is valid. Because in a sorted array, the elements present before index i will remain in the left part (0 to i) only and after index i will remain in right part (i+1 to n-1) only.\n\n**Steps:**\n\n* Create a **rightmin array** storing the **minimum element from i to n-1** (length of the array) by traversing the array backwards.\n* Iterate over the array from front and keep track of the **maximum element till current index** (maxele).\n* If **maxele** till index i is less than the **rightmin[i+1]** than it is a valid partition or chunk, so increment the answer variable.\n\n```\nans = 0\nn = len(arr)\nrightmin = [math.inf]*(n+1)\ncurrmin = math.inf\nmaxele = arr[0]\n\n# loop from backward of the array to get the minimum element from i to n\nfor j in range(n-1, -1, -1):\n\tif arr[j]<currmin:\n\t\tcurrmin = arr[j]\n\trightmin[j] = currmin\n\n#Forward loop to compare with current max element (maxele) and count the valid partitions\nfor i in range(len(arr)):\n\tif maxele<arr[i]:\n\t\tmaxele = arr[i]\n\tif maxele<=rightmin[i+1]:\n\t\tans+=1\nreturn ans\n```\n\nLet me know if there is any issue in understanding the solution. Please upvote if you find it useful :)
['Greedy', 'Python', 'Python3']