摘要: # Definition for singly-linked list.class ListNode(object): def __init__(self, x): self.val = x self.next = Noneclass Solution(object): def addTwoNumb 阅读全文
posted @ 2019-03-19 11:03 AceKo 阅读(130) 评论(0) 推荐(0)
摘要: # Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x# self.next = Noneclass Solution(object): def delet 阅读全文
posted @ 2019-03-19 11:02 AceKo 阅读(108) 评论(0) 推荐(0)
摘要: # Definition for singly-linked list.class ListNode(object): def __init__(self, x): self.val = x self.next = Noneclass Solution(object): def oddEvenLis 阅读全文
posted @ 2019-03-19 11:02 AceKo 阅读(114) 评论(0) 推荐(0)
摘要: # Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x# self.next = Noneclass Solution(object): def isPal 阅读全文
posted @ 2019-03-19 11:01 AceKo 阅读(94) 评论(0) 推荐(0)
摘要: # Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x# self.next = Noneclass Solution(object): def rever 阅读全文
posted @ 2019-03-19 11:00 AceKo 阅读(104) 评论(0) 推荐(0)
摘要: # Definition for singly-linked list.class ListNode(object): def __init__(self, x): self.val = x self.next = Noneclass Solution(object): def removeElem 阅读全文
posted @ 2019-03-19 10:59 AceKo 阅读(120) 评论(0) 推荐(0)
摘要: # Definition for singly-linked list.class ListNode: def __init__(self, x): self.val = x self.next = Noneclass Solution: def sortList(self, head): """ 阅读全文
posted @ 2019-03-19 10:58 AceKo 阅读(166) 评论(0) 推荐(0)
摘要: # Definition for singly-linked list.class ListNode(object): def __init__(self, x): self.val = x self.next = Noneclass Solution(object): def insertionS 阅读全文
posted @ 2019-03-19 10:57 AceKo 阅读(126) 评论(0) 推荐(0)
摘要: # Definition for singly-linked list.class ListNode(object): def __init__(self, x): self.val = x self.next = Noneclass Solution(object): def reorderLis 阅读全文
posted @ 2019-03-19 10:56 AceKo 阅读(180) 评论(0) 推荐(0)
摘要: #Definition for singly-linked list.class ListNode(object): def __init__(self, x): self.val = x self.next = Noneclass Solution(object): def reverseBetw 阅读全文
posted @ 2019-03-19 10:55 AceKo 阅读(173) 评论(0) 推荐(0)
摘要: #Definition for singly-linked list.class ListNode(object): def __init__(self, x): self.val = x self.next = Noneclass Solution(object): def partition(s 阅读全文
posted @ 2019-03-19 10:54 AceKo 阅读(155) 评论(0) 推荐(0)
摘要: # Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x# self.next = Noneclass Solution(object): def delet 阅读全文
posted @ 2019-03-19 10:53 AceKo 阅读(100) 评论(0) 推荐(0)
摘要: # Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x# self.next = Noneclass Solution(object): def delet 阅读全文
posted @ 2019-03-19 10:51 AceKo 阅读(122) 评论(0) 推荐(0)
摘要: # Definition for singly-linked list.class ListNode(object): def __init__(self, x): self.val = x self.next = Noneclass Solution(object): def rotateRigh 阅读全文
posted @ 2019-03-19 10:50 AceKo 阅读(131) 评论(0) 推荐(0)
摘要: # Definition for singly-linked list.class ListNode(object): def __init__(self, x): self.val = x self.next = Noneclass Solution(object): def reverseKGr 阅读全文
posted @ 2019-03-19 10:49 AceKo 阅读(138) 评论(0) 推荐(0)
摘要: # Definition for singly-linked list.class ListNode(object): def __init__(self, x): self.val = x self.next = Noneclass Solution(object): def swapPairs( 阅读全文
posted @ 2019-03-19 10:48 AceKo 阅读(99) 评论(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 @ 2019-03-19 10:45 AceKo 阅读(114) 评论(0) 推荐(0)
摘要: # Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x# self.next = Noneclass Solution(object): def merge 阅读全文
posted @ 2019-03-19 10:45 AceKo 阅读(81) 评论(0) 推荐(0)
摘要: # Definition for singly-linked list.class ListNode(object): def __init__(self, x): self.val = x self.next = Noneclass Solution(object): def addTwoNumb 阅读全文
posted @ 2019-03-19 10:44 AceKo 阅读(108) 评论(0) 推荐(0)
摘要: #coding=utf-8# floodfill经典题# step 1) 从太平洋的边界出发,找到所有能到达太平样的点 TP# step 2) 从大西洋的边界出发,找到所有能到达大西洋的点 DX# step 3) 求交集 TP DXclass Solution(object): def pacifi 阅读全文
posted @ 2019-03-19 10:43 AceKo 阅读(279) 评论(0) 推荐(0)
摘要: class Solution(object): def readBinaryWatch(self, num): """ :type num: int :rtype: List[str] """ hour = [1,2,4,8] minute = [1,2,4,8,16,32] self.resHou 阅读全文
posted @ 2019-03-19 10:41 AceKo 阅读(242) 评论(0) 推荐(0)
摘要: class Solution(object): def combinationSum3(self, k, n): """ :type k: int :type n: int :rtype: List[List[int]] """ self.res = [] self.generateCombinat 阅读全文
posted @ 2019-03-19 10:40 AceKo 阅读(179) 评论(0) 推荐(0)
摘要: class Solution(object): def numIslands(self, grid): """ :type grid: List[List[str]] :rtype: int """ self.res = 0 if not grid : return self.res self.dr 阅读全文
posted @ 2019-03-19 10:39 AceKo 阅读(143) 评论(0) 推荐(0)
摘要: class Solution(object): def partition(self, s): """ :type s: str :rtype: List[List[str]] """ self.res =[] ans = [] self.findDivide(s,ans) print self.r 阅读全文
posted @ 2019-03-19 10:38 AceKo 阅读(347) 评论(0) 推荐(0)
摘要: #coding=utf-8class Solution(object): def solve(self, board): """ :type board: List[List[str]] :rtype: void Do not return anything, modify board in-pla 阅读全文
posted @ 2019-03-19 10:37 AceKo 阅读(212) 评论(0) 推荐(0)
摘要: class Solution(object): def restoreIpAddresses(self, s): """ :type s: str :rtype: List[str] """ self.res = [] self.findCombination(s,"",0) return self 阅读全文
posted @ 2019-03-19 10:35 AceKo 阅读(350) 评论(0) 推荐(0)
摘要: class Solution(object): def subsetsWithDup(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ self.res = [] self.old = None self.res.a 阅读全文
posted @ 2019-03-19 10:34 AceKo 阅读(237) 评论(0) 推荐(0)
摘要: class Solution(object): def exist(self, board, word): """ :type board: List[List[str]] :type word: str :rtype: bool """ self.d = [[-1,0],[0,1],[1,0],[ 阅读全文
posted @ 2019-03-19 10:33 AceKo 阅读(199) 评论(0) 推荐(0)
摘要: class Solution(object): def subsets(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ self.res = [] self.res.append([]) # for i in ra 阅读全文
posted @ 2019-03-19 10:32 AceKo 阅读(180) 评论(0) 推荐(0)
摘要: class Solution(object): def combine(self, n, k): """ :type n: int :type k: int :rtype: List[List[int]] """ self.res = [] if not n or k > n or k <= 0: 阅读全文
posted @ 2019-03-19 10:31 AceKo 阅读(143) 评论(0) 推荐(0)
摘要: class Solution(object): def totalNQueens(self, n): """ :type n: int :rtype: """ self.col = [False for i in range(n)] self.diaS = [False for i in range 阅读全文
posted @ 2019-03-19 10:30 AceKo 阅读(157) 评论(0) 推荐(0)
摘要: #coding=utf-8class Solution(object): def solveNQueens(self, n): """ :type n: int :rtype: List[List[str]] """ self.col = [False for i in range(n)] self 阅读全文
posted @ 2019-03-19 10:28 AceKo 阅读(163) 评论(0) 推荐(0)
摘要: #coding=utf-8class Solution1(object): def permuteUnique(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ self.res = [] nums.sort() l 阅读全文
posted @ 2019-03-19 10:27 AceKo 阅读(360) 评论(0) 推荐(0)
摘要: class Solution(object): def permute(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ pass self.res =[] length = len(nums) self.used 阅读全文
posted @ 2019-03-19 10:26 AceKo 阅读(126) 评论(0) 推荐(0)
摘要: class Solution(object): def combinationSum2(self, candidates, target): """ :type candidates: List[int] :type target: int :rtype: List[List[int]] """ s 阅读全文
posted @ 2019-03-19 10:25 AceKo 阅读(299) 评论(0) 推荐(0)
摘要: class Solution(object): def combinationSum(self, candidates, target): """ :type candidates: List[int] :type target: int :rtype: List[List[int]] """ se 阅读全文
posted @ 2019-03-19 10:24 AceKo 阅读(134) 评论(0) 推荐(0)
摘要: class Solution(object): def solveSudoku(self, board): """ :type board: List[List[str]] :rtype: void Do not return anything, modify board in-place inst 阅读全文
posted @ 2019-03-19 10:23 AceKo 阅读(267) 评论(0) 推荐(0)
摘要: class Solution(object): def letterCombinations(self, digits): """ :type digits: str :rtype: List[str] """ self.letterMap = [ " ", "", "abc", "def", "g 阅读全文
posted @ 2019-03-19 10:20 AceKo 阅读(197) 评论(0) 推荐(0)
摘要: class Solution(object): def findContentChildren(self, g, s): """ :type g: List[int] :type s: List[int] :rtype: int """ g.sort(reverse = True) s.sort(r 阅读全文
posted @ 2019-03-19 10:19 AceKo 阅读(125) 评论(0) 推荐(0)
摘要: #coding=utf-8# Definition for an interval.class Interval(object): def __init__(self, s=0, e=0): self.start = s self.end = edef compare1(x, y): if x.st 阅读全文
posted @ 2019-03-19 10:16 AceKo 阅读(143) 评论(0) 推荐(0)
摘要: class Solution(object): def isSubsequence(self, s, t): """ :type s: str :type t: str :rtype: bool """ if not s: return True if not t: return False sIn 阅读全文
posted @ 2019-03-19 10:13 AceKo 阅读(166) 评论(0) 推荐(0)
摘要: class Solution1(object): def topKFrequent(self, nums, k): """ :type nums: List[int] :type k: int :rtype: List[int] """ Dict = {} for i in range(len(nu 阅读全文
posted @ 2019-03-19 10:11 AceKo 阅读(406) 评论(0) 推荐(0)
摘要: # """# This is the interface that allows for creating nested lists.# You should not implement it, or speculate about its implementation# """# class Ne 阅读全文
posted @ 2019-03-19 10:10 AceKo 阅读(156) 评论(0) 推荐(0)