LintCode-1
题目
代码
class Solution:
"""
@param a: An integer
@param b: An integer
@return: The sum of a and b
"""
def aplusb(self, a, b):
# write your code here
return a+b
时间消耗:60ms
LintCode-2
题目
代码
class Solution:
"""
@param: n: An integer
@return: An integer, denote the number of trailing zeros in n!
"""
def trailingZeros(self, n):
# write your code here, try to do it without arithmetic operators.
count=0
while n >= 5:
count +=n//5
n=n//5
return count
时间消耗:296ms