Java I/O broken?


#1

Why it is giving runtime error in java?
public class Solution {

    public int solve(int[][] A) {
    int cnt = 0;
   Arrays.sort(A);
    
   Boolean check[] = new Boolean[A.length];
   for(int i=0;i<A.length;i++)
   {
       check[i] = false;
   }
   check[0] = true;
    
    for(int i=0;i<A.length;i++)
    {
        int end = A[i][1];  
        if(check[i] == true && i!=0)
        {
            continue;
        }
        cnt++;
        for(int j=i+1;j<A.length;j++)
        {
            int ne = A[j][1];
            if(ne>=end && check[j] == false)
            {
                end = ne;
                check[j] = true;
            }
        }
    }
    return cnt;
}

}