769-Max-Chunks-To-Make-Sorted
Sat 17 May 2025
https://leetcode.com/problems/max-chunks-to-make-sorted
import pyutil as pyu
pyu.get_local_pyinfo()
print(pyu.ps2("python-dotenv"))
from typing import List
class Solution:
def maxChunksToSorted(self, arr: List[int]) -> int:
ans = 0
maxi = -math.inf
for i, a in enumerate(arr):
maxi = max(maxi, a)
if maxi == i:
ans += 1
return ans
new Solution().maxChunksToSorted()
Score: 5
Category: leetcode