
https://school.programmers.co.kr/learn/courses/30/lessons/87390
| 0 | 1 | 2 | |
|---|---|---|---|
| 0 | 1 | 2 | 3 |
| 1 | 2 | 2 | 3 |
| 2 | 3 | 3 | 3 |
import java.util.*;
class Solution {
public int[] solution(int n, long left, long right) {
int totalLen = (int) right - (int) left;
int[] answer = new int[totalLen + 1];
int idx = 0;
for(long i = left; i< right + 1; i++){
long row = i / n;
long col = i % n;
answer[idx++] = Math.max((int)row, (int)col) + 1;
}
return answer;
}
}