上一页 1 ··· 3 4 5 6 7 8 9 10 下一页
摘要: #-*- coding: UTF-8 -*- # Definition for a binary tree node.# class TreeNode(object):# def __init__(self, x):# self.val = x# self.left = None# self.rig 阅读全文
posted @ 2016-10-12 17:16 火金队长 阅读(107) 评论(0) 推荐(0) 编辑
摘要: #-*- coding: UTF-8 -*- class Solution(object): def findTheDifference(self, s, t): s=sorted(list(s)) t=sorted(list(t)) for st in s: p=t.index(st) del t 阅读全文
posted @ 2016-10-12 17:15 火金队长 阅读(215) 评论(0) 推荐(0) 编辑
摘要: #-*- coding: UTF-8 -*- from itertools import combinationsclass Solution(object): hourList=[8,4,2,1] minList=[32,16,8,4,2,1] def selectHour(self,hourNu 阅读全文
posted @ 2016-10-12 17:14 火金队长 阅读(457) 评论(0) 推荐(0) 编辑
摘要: #-*- coding: UTF-8 -*- class Solution(object): hexDic={0:'0',1:'1',2:'2',3:'3',4:'4',5:'5',6:'6',7:'7',8:'8',9:'9',\ 10:'a', 11:'b', 12:'c', 13:'d', 1 阅读全文
posted @ 2016-10-12 17:14 火金队长 阅读(338) 评论(0) 推荐(0) 编辑
摘要: #-*- coding: UTF-8 -*- # Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x# self.next = Noneclass Solu 阅读全文
posted @ 2016-10-12 17:13 火金队长 阅读(177) 评论(0) 推荐(0) 编辑
摘要: #Method1:动态规划##当有n个台阶时,可供选择的走法可以分两类:###1,先跨一阶再跨完剩下n-1阶;###2,先跨2阶再跨完剩下n-2阶。###所以n阶的不同走法的数目是n-1阶和n-2阶的走法数的和class Solution(object): def climbStairs(self, 阅读全文
posted @ 2016-10-12 17:12 火金队长 阅读(94) 评论(0) 推荐(0) 编辑
摘要: class Solution: # @param digits, a list of integer digits # @return a list of integer digits def plusOne(self, digits): carry=1 for i in range(len(dig 阅读全文
posted @ 2016-10-12 17:12 火金队长 阅读(156) 评论(0) 推荐(0) 编辑
摘要: #-*- coding: UTF-8 -*- from collections import Counterclass Solution(object): def longestPalindrome(self, s): """ :type s: str :rtype: int """ lopa=0 阅读全文
posted @ 2016-10-12 17:11 火金队长 阅读(243) 评论(0) 推荐(0) 编辑
摘要: #-*- coding: UTF-8 -*- class Solution(object): def firstUniqChar(self, s): s=s.lower() sList=list(s) numCdic={} for c in s: numCdic[c]=numCdic[c]+1 if 阅读全文
posted @ 2016-10-12 17:10 火金队长 阅读(227) 评论(0) 推荐(0) 编辑
摘要: #-*- coding: UTF-8 -*- class Solution(object): def intersect(self, nums1, nums2): if len(nums1)<len(nums2): tmp=nums1 nums1=nums2 nums2=tmp tmpdic={} 阅读全文
posted @ 2016-10-12 17:09 火金队长 阅读(118) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 下一页