We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c6e7cc0 commit a5810d6Copy full SHA for a5810d6
solution/0829.Consecutive Numbers Sum/Solution.java
@@ -0,0 +1,11 @@
1
+class Solution {
2
+ public int consecutiveNumbersSum(int N) {
3
+ int res = 0;
4
+ for (int i = 1; i * (i - 1) / 2 < N; ++i) {
5
+ if ((N - i * (i - 1) / 2) % i == 0) {
6
+ ++res;
7
+ }
8
9
+ return res;
10
11
+}
0 commit comments