上一页 1 ··· 37 38 39 40 41 42 43 44 45 ··· 114 下一页
摘要: 本题是leetcode112的升级版,需要检查多条路径,并保存。 阅读全文
posted @ 2019-12-11 10:31 Sempron2800+ 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 1 class BSTIterator: 2 def __init__(self, root: TreeNode): 3 self.lists = [] 4 self.idx = 0 5 self.size = 0 6 self.inOrder(root) 7 8 def inOrder(self,root): 9 if root != None: 10 if root.left != None: 阅读全文
posted @ 2019-12-11 10:14 Sempron2800+ 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 这是一道数学题,参考:https://leetcode.com/problems/gray-code/discuss/445279/Python-solution 不了解这个数学原理的,面试时很难做出来。 阅读全文
posted @ 2019-12-11 10:03 Sempron2800+ 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 流程分析,以(4,9)为例: 4 * 3 * 2 * 1 = 24 第一位数字的选择按 3 * 2 * 1 = 6 个为一组,共24个,则分4组1-6 第一组7-12 第二组13-18 第三组19-24 第四组被除数为9,除数为69 // 6 = 19 % 6 = 3 > 0 因此9 是第二组在 1 阅读全文
posted @ 2019-12-11 08:47 Sempron2800+ 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def compareVersion(self, version1: str, version2: str) -> int: 3 ary1 = version1.split('.') 4 ary2 = version2.split('.') 5 n1,n2 = len(ary1),len(ary2) 6 i,j = 0,0 7 while i < n1 an 阅读全文
posted @ 2019-12-10 22:46 Sempron2800+ 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 在leetcode62的基础上,增加对障碍物的判断。 阅读全文
posted @ 2019-12-10 22:31 Sempron2800+ 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def constructLink(self,lists): 3 n = len(lists) 4 if n == 0: 5 return None 6 if n == 1: 7 return ListNode(lists[0]) 8 9 head = ListNode(lists[-1]) 10 for i in range(n-2,-1,-1): 11 阅读全文
posted @ 2019-12-10 20:07 Sempron2800+ 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 将链表中的节点,按照x值分别存储到两个集合中,再用重新拼接的集合建立链表。 阅读全文
posted @ 2019-12-10 19:48 Sempron2800+ 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 1 import collections 2 class Solution: 3 def constructLink(self,lists): 4 n = len(lists) 5 if n == 0: 6 return None 7 if n == 1: 8 return L... 阅读全文
posted @ 2019-12-10 18:19 Sempron2800+ 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def search(self, nums: 'List[int]', target: int) -> bool: 3 n = len(nums) 4 if n == 0: 5 return False 6 if n == 1: 7 ret... 阅读全文
posted @ 2019-12-10 18:06 Sempron2800+ 阅读(126) 评论(0) 推荐(0) 编辑
上一页 1 ··· 37 38 39 40 41 42 43 44 45 ··· 114 下一页