Untitled
public class Solution { public int solve(int[] A) { int chunks = 0; int max = -1; for(int i = 0 ; i < A.length; i++){ max = Math.max(A[i], max); if(i == max){ chunks++; } } return chunks; } }
public class Solution { public int solve(int[] A) { int chunks = 0; int max = -1; for(int i = 0 ; i < A.length; i++){ max = Math.max(A[i], max); if(i == max){ chunks++; } } return chunks; } }