上一页 1 2 3 4 5 6 7 8 ··· 33 下一页
摘要: floyd circle detection algorithm(龟兔赛跑算法) 阅读全文
posted @ 2019-04-17 19:53 周洋 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 扫两遍链表. 阅读全文
posted @ 2019-04-17 07:05 周洋 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 简单模拟题. 阅读全文
posted @ 2019-04-17 06:45 周洋 阅读(143) 评论(0) 推荐(0) 编辑
摘要: product 用于求多个可迭代对象的笛卡尔积(Cartesian Product),它跟嵌套的 for 循环等价.即: product(A, B) 和 ((x,y) for x in A for y in B)一样. 它的一般使用形式如下: iterables是可迭代对象,repeat指定iter 阅读全文
posted @ 2019-04-15 21:37 周洋 阅读(17129) 评论(0) 推荐(2) 编辑
摘要: 就是枚举出所有情况: 也可以使用itertools模块里面的笛卡尔积函数: 阅读全文
posted @ 2019-04-15 18:13 周洋 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 原数和二进制全为1的数异或. 阅读全文
posted @ 2019-04-15 06:12 周洋 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 牛顿法 阅读全文
posted @ 2019-04-15 05:31 周洋 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 1.DFS 2.BFS 阅读全文
posted @ 2019-04-15 04:13 周洋 阅读(193) 评论(0) 推荐(0) 编辑
摘要: Brute Force(暴力)查找即可. 注意Python的元组也是可以比大小的,就是先比第一个元素,再第二个... 所以排序时key先按len排,len一样再按字典序排:就是key返回元组. 阅读全文
posted @ 2019-04-14 16:30 周洋 阅读(130) 评论(0) 推荐(0) 编辑
摘要: class Solution: def uncommonFromSentences(self, A: str, B: str) -> List[str]: return [v for v, n in collections.Counter(A.split()+B.split()).items() if n == 1] 阅读全文
posted @ 2019-04-13 09:58 周洋 阅读(96) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 33 下一页