Skip to content

Instantly share code, notes, and snippets.

View tlylt's full-sized avatar

Liu Yongliang tlylt

View GitHub Profile
Use % 100 to get the last two digits of a number
--- 430 % 100 => 30
Use // 100 to get the first digit of a number
--- 430 //100 => 4
Use % 10 to get the last digit of a number
--- 430 % 10 => 0
Conclusion
- Use //10 to get from the left
//10, remove 1 digit from right
//100, remove 2 digits from right
@tlylt
tlylt / memo
Last active May 16, 2020 08:37
tips on memo
#first
#- write recursive solution
coins = [50, 20, 10, 5, 1]
count =0
count2 = 0
def cc(a,d):
global count
count+=1
if a <0 or d == 0:
return 0