12 2015 档案

摘要:@link http://www.cnblogs.com/zuoyuan/p/3781953.htmlGiven an array of non-negative integers, you are initially positioned at the first index of the arr... 阅读全文
posted @ 2015-12-26 21:13 hao.ma 阅读(171) 评论(0) 推荐(0)
摘要:谈谈Memcached与Redis(一) 1. Memcached简介Memcached是以LiveJurnal旗下Danga Interactive公司的Bard Fitzpatric为首开发的高性能分布式内存缓存服务器。其本质上就是一个内存key-value数据库,但是不支持数据的持久化,服务... 阅读全文
posted @ 2015-12-25 17:43 hao.ma 阅读(185) 评论(0) 推荐(0)
摘要:class Solution(object): def trap(self,nums): leftmosthigh = [0 for i in range(len(nums))] leftmax=0 for i in range(len(nums))... 阅读全文
posted @ 2015-12-24 23:18 hao.ma 阅读(140) 评论(0) 推荐(0)
摘要:class Solution(object): def firstMissingPositive(self, nums): """ :type nums: List[int] :rtype: int """ intlen=l... 阅读全文
posted @ 2015-12-21 22:58 hao.ma 阅读(146) 评论(0) 推荐(0)
摘要:Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each numb... 阅读全文
posted @ 2015-12-20 21:58 hao.ma 阅读(149) 评论(0) 推荐(0)
摘要:Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeate... 阅读全文
posted @ 2015-12-20 21:45 hao.ma 阅读(145) 评论(0) 推荐(0)
摘要:class Solution(object): def countAndSay(self, n): """ :type n: int :rtype: str """ s='1' for i in range(2... 阅读全文
posted @ 2015-12-20 13:50 hao.ma 阅读(133) 评论(0) 推荐(0)
摘要:#if you want to initialize a 9*9 two-dimensional array [([""]*9) for i in range(9)]#caution: the follow code can't work [[""]*9]*9shallow copies of l... 阅读全文
posted @ 2015-12-20 11:37 hao.ma 阅读(331) 评论(0) 推荐(0)
摘要:#the define of Sudoku is on this link : http://sudoku.com.au/TheRules.aspxWrite a program to solve a Sudoku puzzle by filling the empty cells.Empty ce... 阅读全文
posted @ 2015-12-19 23:37 hao.ma 阅读(228) 评论(0) 推荐(0)
摘要:#数独(すうどく,Sūdoku)是一种运用纸、笔进行演算的逻辑游戏。玩家需要根据9×9盘面上的已知数字,推理出所有剩余空格的数字,并满足每一行、每一列、每一个粗线宫内的数字均含1-9,不重复。#数独盘面是个九宫,每一宫又分为九个小格。在这八十一格中给出一定的已知数字和解题条件,利用逻辑和推理,在其他... 阅读全文
posted @ 2015-12-19 17:57 hao.ma 阅读(437) 评论(0) 推荐(0)
摘要:#Given a sorted array and a target value, return the index if the target is found. If #not, return the index where it would be if it were inserted in ... 阅读全文
posted @ 2015-12-19 17:15 hao.ma 阅读(180) 评论(0) 推荐(0)
摘要:#Suppose a sorted array is rotated at some pivot unknown to you beforehand.#(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).#You are given a target valu... 阅读全文
posted @ 2015-12-19 16:06 hao.ma 阅读(155) 评论(0) 推荐(0)
摘要:#question : Given an array of integers, every element appearstwiceexcept for one. Find that single one.#note : Your algorithm should have a linear run... 阅读全文
posted @ 2015-12-19 12:09 hao.ma 阅读(143) 评论(0) 推荐(0)
摘要:# The isBadVersion API is already defined for you.# @param version, an integer# @return a bool# def isBadVersion(version):class Solution(object): d... 阅读全文
posted @ 2015-12-17 23:27 hao.ma 阅读(184) 评论(0) 推荐(0)
摘要:class Solution(object): def searchRange(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[i... 阅读全文
posted @ 2015-12-17 23:08 hao.ma 阅读(361) 评论(0) 推荐(0)
摘要:class Solution(object): def longestValidParentheses(self, s): """ :type s: str :rtype: int """ maxlen=0 s... 阅读全文
posted @ 2015-12-15 23:34 hao.ma 阅读(124) 评论(0) 推荐(0)
摘要:rs=dict()rs['item1'] = 'item1'rs['item2'] = 'item2'for k,d in rs.items(): print k,dfor k in rs.keys(): print k,rs[k] 阅读全文
posted @ 2015-12-15 12:34 hao.ma 阅读(163) 评论(0) 推荐(0)
摘要:#"~" must be used for case sensitive matching #"~*" must be used for case insensitive matching location = / { # this matches only the / query. # configuration example #1 } location / { ... 阅读全文
posted @ 2015-12-10 19:42 hao.ma 阅读(163) 评论(0) 推荐(0)
摘要:需求:前端过来一个请求,后台php要通过两次http请求,请求不同的地址得到资源后拼接返回给前端请求A站:请求B站:同时请求A站和B站(php 串行curl_exec )同时请求A站和B站(php 模拟并发curl_multi_exec ):同时请求A站和B站(php通过curl_multi_exe... 阅读全文
posted @ 2015-12-08 21:15 hao.ma 阅读(247) 评论(0) 推荐(0)
摘要:# Definition for a binary tree node.# class TreeNode(object):# def __init__(self, x):# self.val = x# self.left = None# sel... 阅读全文
posted @ 2015-12-08 08:16 hao.ma 阅读(194) 评论(0) 推荐(0)
摘要:# Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x# self.next = Noneclass Solutio... 阅读全文
posted @ 2015-12-07 23:14 hao.ma 阅读(134) 评论(0) 推荐(0)
摘要:# Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x# self.next = Noneclass Solutio... 阅读全文
posted @ 2015-12-07 23:07 hao.ma 阅读(123) 评论(0) 推荐(0)
摘要:class Node(object): def __init__(self,k,x): self.key=k self.val=x self.prev=None self.next=Noneclass DoubleLinkedList(o... 阅读全文
posted @ 2015-12-07 22:54 hao.ma 阅读(180) 评论(0) 推荐(0)
摘要:with open opcache, the monitor cpu idle log , there are so much curl_exec and gzip in our php logic code, and our php version is 5.4.44 阅读全文
posted @ 2015-12-07 18:44 hao.ma 阅读(114) 评论(0) 推荐(0)
摘要:# Definition for a binary tree node.# class TreeNode(object):# def __init__(self, x):# self.val = x# self.left = None# sel... 阅读全文
posted @ 2015-12-06 22:41 hao.ma 阅读(155) 评论(0) 推荐(0)
摘要:# Definition for a binary tree node.# class TreeNode(object):# def __init__(self, x):# self.val = x# self.left = None# sel... 阅读全文
posted @ 2015-12-06 22:36 hao.ma 阅读(184) 评论(0) 推荐(0)
摘要:# Definition for a binary tree node.# class TreeNode(object):# def __init__(self, x):# self.val = x# self.left = None# sel... 阅读全文
posted @ 2015-12-06 22:25 hao.ma 阅读(138) 评论(0) 推荐(0)
摘要:# Definition for a binary tree node# class TreeNode(object):# def __init__(self, x):# self.val = x# self.left = None# sel... 阅读全文
posted @ 2015-12-06 22:06 hao.ma 阅读(142) 评论(0) 推荐(0)
摘要:# Definition for a binary tree node.# class TreeNode(object):# def __init__(self, x):# self.val = x# self.left = None# sel... 阅读全文
posted @ 2015-12-06 15:45 hao.ma 阅读(138) 评论(0) 推荐(0)
摘要:# Definition for a binary tree node.# class TreeNode(object):# def __init__(self, x):# self.val = x# self.left = None# sel... 阅读全文
posted @ 2015-12-06 15:40 hao.ma 阅读(128) 评论(0) 推荐(0)
摘要:# Definition for a binary tree node.# class TreeNode(object):# def __init__(self, x):# self.val = x# self.left = None# sel... 阅读全文
posted @ 2015-12-06 15:25 hao.ma 阅读(156) 评论(0) 推荐(0)
摘要:# Definition for a binary tree node.# class TreeNode(object):# def __init__(self, x):# self.val = x# self.left = None# sel... 阅读全文
posted @ 2015-12-06 14:58 hao.ma 阅读(206) 评论(0) 推荐(0)
摘要:# Definition for a binary tree node.# class TreeNode(object):# def __init__(self, x):# self.val = x# self.left = None# sel... 阅读全文
posted @ 2015-12-06 14:26 hao.ma 阅读(211) 评论(0) 推荐(0)
摘要:1. binary tree inorder traversal 不能用recursive写 (LC原题)2. 比如有个数组F={1,3, 4, 5, 2, 0}, A=3, 那么F[A]=5, F[F[A]]=0, F[F[F[A]]]=1....这样下去求第N个数是多少. from: 1poin... 阅读全文
posted @ 2015-12-05 10:28 hao.ma 阅读(281) 评论(0) 推荐(0)
摘要:class Solution(object): def divide(self, dividend, divisor): """ :type dividend: int :type divisor: int :rtype: int ... 阅读全文
posted @ 2015-12-01 23:25 hao.ma 阅读(167) 评论(0) 推荐(0)