Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit feff19a

Browse files
fix:fix file empty
1 parent 45f81ad commit feff19a

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution
2+
{
3+
public:
4+
int sumNums(int n)
5+
{
6+
n && (n += sumNums(n - 1));
7+
return n;
8+
}
9+
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
impl Solution {
2+
pub fn sum_nums(mut n: i32) -> i32 {
3+
n!=0&&(n+=Solution::sum_nums(n-1),true).1;
4+
n
5+
}
6+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
var sumNums = function (n: number): number {
2+
return n && n + sumNums(n - 1);
3+
};

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /