(프로그래머) LV2.n^2 어레이 클리핑

// LV2.n^2배열 자르기
public static int() solution_slice_array(int n, long left, long right) {
    int() answer = new int((int)(right-left+1));
    int idx = 0;
    for(long i = (long)Math.floor(left/n);i<=Math.floor(right/n);i++){
        for(long j = 0;j<n;j++){
            if(left <= i*n+j && i*n+j <= right){
                answer(idx++) = (int)Math.max(i,j)+1;
            }
        }
    }
    return answer;
}