一 . 直接解題吧spa
芽兒呦,忽然以爲,我不說!!code
該題目用到遞歸,可是卻不存在if等判斷語句。blog
class Solution { public int Sum_Solution(int n) { // write code here if(n == 1) { return 1; } else { return n + Sum_Solution(n - 1); } } }