摘要:
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( 阅读全文
摘要:
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 阅读全文
摘要:
#栈是先进后出 #队列先进先出 class Stack(object): def __init__(self): """ initialize your data structure here. """ self.inQueue=[] self.outQueue=[] def push(self, 阅读全文
摘要:
#很简单,利用strip函数去除左右两边的空格,然后用split函数分割成列表 class Solution(object): def lengthOfLastWord(self, s): """ :type s: str :rtype: int """ if s==None:return 0 sl 阅读全文
摘要:
# Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x# self.next = Noneclass Solution(object): def remov 阅读全文