We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e3ea928 commit 143cb6dCopy full SHA for 143cb6d
src/main/java/com/fishercoder/solutions/_769.java
@@ -61,10 +61,13 @@ public int maxChunksToSorted(int[] arr) {
61
public static class Solution2 {
62
/**credit: https://leetcode.com/articles/max-chunks-to-make-sorted-i/*/
63
public int maxChunksToSorted(int[] arr) {
64
- int ans = 0, max = 0;
+ int ans = 0;
65
+ int max = 0;
66
for (int i = 0; i < arr.length; ++i) {
67
max = Math.max(max, arr[i]);
- if (max == i) ans++;
68
+ if (max == i) {
69
+ ans++;
70
+ }
71
}
72
return ans;
73
0 commit comments