摘要: class Solution(object): def findAnagrams(self, s, p): """ :type s: str :type p: str :rtype: List[int] """ reslist=[];sdic={};pdic={} ls=len(s) lp=len( 阅读全文
posted @ 2016-10-31 18:46 火金队长 阅读(868) 评论(0) 推荐(0) 编辑
摘要: class Solution(object): def merge(self, nums1, m, nums2, n): """ :type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void 阅读全文
posted @ 2016-10-31 18:45 火金队长 阅读(186) 评论(0) 推荐(0) 编辑
摘要: #栈是先进后出 #队列先进先出 class Stack(object): def __init__(self): """ initialize your data structure here. """ self.inQueue=[] self.outQueue=[] def push(self, 阅读全文
posted @ 2016-10-31 18:43 火金队长 阅读(220) 评论(0) 推荐(0) 编辑
摘要: #很简单,利用strip函数去除左右两边的空格,然后用split函数分割成列表 class Solution(object): def lengthOfLastWord(self, s): """ :type s: str :rtype: int """ if s==None:return 0 sl 阅读全文
posted @ 2016-10-31 18:42 火金队长 阅读(93) 评论(0) 推荐(0) 编辑
摘要: # Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x# self.next = Noneclass Solution(object): def remov 阅读全文
posted @ 2016-10-31 18:41 火金队长 阅读(278) 评论(0) 推荐(0) 编辑