dayx7专题

Dayx7:剑指offer

发散思维系列 求 1+2+…+n 牛客网 要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断语句(A?B:C)。 #递归class Solution:def getSum(self, n):return n and n+self.getSum(n-1)#知识点之and3 and 8 Out:8 last3 and 0 Out:0 有一个0