We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a565ba8 commit 83478f0Copy full SHA for 83478f0
LiiNi-coder/202510/09 PGM 숫자의 표현.md
@@ -0,0 +1,23 @@
1
+```java
2
+class Solution {
3
+ public int solution(int n) {
4
+ int[] sum = new int[n + 1];
5
+ for(int i=1; i<=n; i++)
6
+ sum[i] = sum[i-1] + i;
7
+
8
+ int l = 0, r = 1, answer = 0;
9
+ while(l < r && r <= n){
10
+ int now = sum[r] - sum[l];
11
+ if(now == n){
12
+ answer++;
13
+ r++;
14
+ }else if(now < n)
15
16
+ else
17
+ l++;
18
+ }
19
20
+ return answer;
21
22
+}
23
+```
0 commit comments