Skip to content

Commit 865c257

Browse files
committed
n^2 배열 자르기 / 심화
1 parent 1c9229c commit 865c257

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function solution(n, left, right) {
2+
const answer = [];
3+
for (let k = left; k <= right; k++) {
4+
const i = Math.floor(k / n);
5+
const j = k % n;
6+
answer.push(Math.max(i, j) + 1);
7+
}
8+
return answer;
9+
}

0 commit comments

Comments
 (0)