itertools mode 之 combinations用法
摘要:leetcode例题: 216. Combination Sum III Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be
阅读全文
PYTHON字典排序
摘要:新学习了一些关于字典的操作: keylst = list(myDict.keys()) #在list中列出所有的keysvallst = list(myDict.values()) #在list中列出所有的valsitelst = list(myDict.items()) #在list中列出所有的k
阅读全文
PYTHON算法时间空间复杂度节省TRICK
摘要:节省时间复杂度: sorted + 跳过重复目标 +记忆搜索 例子:字符串的不同排列 import copy class Solution: def stringPermutation2(self, str): str = ''.join(sorted(str)) #部分版本的PY好像str只能以这
阅读全文