摘要: def aa(nums): if not nums: return False hashes={} ret=[] for s in nums: hashes[s]=hashes[s]+1 if hashes.get(s) else 1 if hashes[s] >len(nums)/2: re... 阅读全文
posted @ 2018-10-26 13:37 findtruth123 阅读(232) 评论(0) 推荐(0)
摘要: from itertools import permutations def my_permutation(s): str_set = [] ret = [] # 最后的结果 def permutation(string): for i in string: str_tem = string.replace(i, '') ... 阅读全文
posted @ 2018-10-26 11:17 findtruth123 阅读(446) 评论(0) 推荐(0)
摘要: import random class Node(object): def __init__(self, val): self.val = val self.next = None self.other = None class Solution(object): @staticmethod def clone_... 阅读全文
posted @ 2018-10-26 11:10 findtruth123 阅读(355) 评论(0) 推荐(0)
摘要: def pop_order(push_stack, pop_stack): if not push_stack or not pop_stack: return False stack = [] while pop_stack: pop_val = pop_stack[0] if stack and stack[-1] =... 阅读全文
posted @ 2018-10-26 10:37 findtruth123 阅读(220) 评论(0) 推荐(0)
摘要: class minstack(object): def __init__(self): self.stack=[] self.min=[] def push(self,values): for i in values: self.stack.append(i) if ... 阅读全文
posted @ 2018-10-26 10:04 findtruth123 阅读(674) 评论(0) 推荐(0)
摘要: def aa(matrix): rows=len(matrix) cols=len(matrix[0]) start=0 ret=[] while start*2 <rows and start*2<cols: bb(matrix,rows,cols,start,ret) start +=1 ret... 阅读全文
posted @ 2018-10-26 09:56 findtruth123 阅读(824) 评论(0) 推荐(0)
摘要: class ListNode(object): def __init__(self,x): self.val=x self.next=None class Link(object): def __init__(self,values=None): self.nodes=self.set_link(values) i... 阅读全文
posted @ 2018-10-25 17:45 findtruth123 阅读(330) 评论(0) 推荐(0)
摘要: class ListNode(object): def __init__(self,x): self.val=x self.next=None class Link(object): def __init__(self,values=None): self.nodes=self.set_link(values) i... 阅读全文
posted @ 2018-10-25 17:08 findtruth123 阅读(130) 评论(0) 推荐(0)
摘要: class Solution: def EntryNodeOfLoop(self, pHead): pFast = pHead pSlow = pHead while pFast != None and pFast.next != None: pFast = pFast.next.next p... 阅读全文
posted @ 2018-10-25 16:58 findtruth123 阅读(298) 评论(1) 推荐(0)
摘要: class ListNode(object): def __init__(self,x): self.val=x self.next=None class Link(object): def __init__(self,values=None): self.nodes=self.set_link(values) i... 阅读全文
posted @ 2018-10-25 16:52 findtruth123 阅读(170) 评论(0) 推荐(0)