Skip to content

Commit 033ab0d

Browse files
authored
Merge pull request #1188 from AlgorithmWithGod/lkhyun
[20251021] PGM / Lv2 / n^2 배열 자르기 / 이강현
2 parents f4f090c + e48df67 commit 033ab0d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
```java
2+
class Solution {
3+
public long[] solution(int n, long left, long right) {
4+
long[] answer = new long[(int)(right-left+1)];
5+
6+
int idx = 0;
7+
for(long i = left; i<=right; i++,idx++){
8+
long ii = i/n;
9+
long jj = i%n;
10+
if(ii>=jj){
11+
answer[idx] = ii+1;
12+
}else{
13+
answer[idx] = jj+1;
14+
}
15+
}
16+
return answer;
17+
}
18+
}
19+
```

0 commit comments

Comments
 (0)