会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
火金队长
博客园
园子
首页
新随笔
联系
管理
订阅
上一页
1
2
3
4
5
6
7
8
9
10
下一页
2016年10月31日
【leetcode❤python】 203. Remove Linked List Elements
摘要: # 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 火金队长
阅读(279)
评论(0)
推荐(0)
2016年10月28日
【leetcode❤python】 20. Valid Parentheses
摘要: class Solution(object): def isValid(self, s): """ :type s: str :rtype: bool """ left_tag=['(','{','['] right_tag=[')','}',']'] stack_list=[] match_dic
阅读全文
posted @ 2016-10-28 16:26 火金队长
阅读(122)
评论(0)
推荐(0)
【leetcode❤python】 219. Contains Duplicate II
摘要: #遍历所有元素,将元素值当做键、元素下标当做值#存放在一个字典中。遍历的时候,#如果发现重复元素,则比较其下标的差值是否小于k,#如果小于则可直接返回True,否则更新字典中该键的值为新的下标class Solution(object): def containsNearbyDuplicate(se
阅读全文
posted @ 2016-10-28 16:25 火金队长
阅读(346)
评论(0)
推荐(0)
2016年10月26日
【leetcode❤python】 290. Word Pattern
摘要: class Solution(object): def wordPattern(self, pattern, str): """ :type pattern: str :type str: str :rtype: bool """ tag=0 tagdic={} tagList=[] i=0 whi
阅读全文
posted @ 2016-10-26 11:30 火金队长
阅读(187)
评论(0)
推荐(0)
【leetcode❤python】 223. Rectangle Area
摘要: #-*- coding: UTF-8 -*-#先判断是否有重叠class Solution(object): def computeArea(self, A, B, C, D, E, F, G, H): """ :type A: int :type B: int :type C: int :type
阅读全文
posted @ 2016-10-26 11:00 火金队长
阅读(121)
评论(0)
推荐(0)
2016年10月25日
【leetcode❤python】 19. Remove Nth Node From End of List
摘要: 双指针思想:两个指针相隔n-1,每次两个指针向后一步,当后面一个指针没有后继了,前面一个指针的后继就是要删除的节点 # Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.
阅读全文
posted @ 2016-10-25 21:53 火金队长
阅读(166)
评论(0)
推荐(0)
【leetcode❤python】 38. Count and Say
摘要: AC代码: class Solution(object): def countAndSay(self, n): """ :type n: int :rtype: str """ n=n-1 if n==0:return str(1) tag=1;stri=str(11) while tag<n: c
阅读全文
posted @ 2016-10-25 21:06 火金队长
阅读(426)
评论(0)
推荐(0)
【leetcode❤python】 205. Isomorphic Strings
摘要: class Solution(object): def isIsomorphic(self, s, t): """ :type s: str :type t: str :rtype: bool """ sdic={} slist=[] tdic={} tlist=[] if len(s)!=len(
阅读全文
posted @ 2016-10-25 19:47 火金队长
阅读(203)
评论(0)
推荐(0)
2016年10月24日
【leetcode❤python】 111. Minimum Depth of Binary Tree
摘要: # Definition for a binary tree node.# class TreeNode(object):# def __init__(self, x):# self.val = x# self.left = None# self.right = Noneclass Solution
阅读全文
posted @ 2016-10-24 21:54 火金队长
阅读(121)
评论(0)
推荐(0)
【leetcode❤python】299. Bulls and Cows
摘要: class Solution(object): def getHint(self, secret, guess): """ :type secret: str :type guess: str :rtype: str """ countA,i,numList=0,-1,[[0,0] for i in
阅读全文
posted @ 2016-10-24 17:18 火金队长
阅读(283)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
8
9
10
下一页
公告