摘要:
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... 阅读全文
摘要:
from itertools import permutations def my_permutation(s): str_set = [] ret = [] # 最后的结果 def permutation(string): for i in string: str_tem = string.replace(i, '') ... 阅读全文
摘要:
import random class Node(object): def __init__(self, val): self.val = val self.next = None self.other = None class Solution(object): @staticmethod def clone_... 阅读全文
摘要:
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] =... 阅读全文
摘要:
class minstack(object): def __init__(self): self.stack=[] self.min=[] def push(self,values): for i in values: self.stack.append(i) if ... 阅读全文
摘要:
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... 阅读全文