标签:图片 bsp image turn == ret mamicode mic height
求解上述递归求和,有两种实现方式,
def arrSum_fwd(arr): arrLen = len(arr) if arrLen == 0: return 0 else: return arr[0] + arrSum(arr[1:arrLen])
arrSum_fwd([2,4,6])
12
def arrSum_bkwd(arr): arrLen = len(arr) if arrLen == 0: return 0 else: arrLen = arrLen - 1 return arr[arrLen] + arrSum(arr[0:arrLen])
arrSum_bkwd([2,4,6])
12
标签:图片 bsp image turn == ret mamicode mic height
原文地址:https://www.cnblogs.com/dogfaraway/p/12199165.html