- 博客(107)
- 问答 (1)
- 收藏
- 关注

原创 leetcode题解
一道题目的状态分为三种:[未掌握],[已掌握],[已巩固]第一次无法AC的题目,标记为未掌握。第二天可以默写代码的题目,改标志为已掌握。一个星期复习时依然可以写出代码的题目,标记为已巩固。++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++31. Next Permutation [未掌握]
2016-12-02 12:09:42
821
原创 高性能MySQL读书笔记:3、服务器性能剖析
性能剖析:测量服务器的时间都花费在哪里性能优化简介性能:完成某件任务需要的时间度量,性能即响应时间。数据库的性能用查询的响应时间来度量。优化:一定的工作负载下降低响应时间。完成一项任务的时间分成两部分:执行时间和等待时间。通过性能剖析进行优化性能剖析:测量任务花费的时间;对结果统计排序,重要的任务放在前面基于执行时间的分析和基于等待时间的分析。
2016-12-24 22:51:57
526
原创 高性能MySQL读书笔记:2、MySQL基准测试
为什么需要基准测试基准测试是一种压力测试,是唯一方便有效的、可以学习系统在给定负载下会发生什么的一种方法。基准测试的主要问题在于不是真实压力的测试,有很多因素会影响基准测试的准确度。我们只能进行大概的测试,来确定系统大致的余量有多少。基准测试的策略两种主要策略:针对整个系统(集成式)、单独测试MySQL(单组件式)。测试指标吞吐量:单位时间内的事务处理数
2016-12-23 19:31:27
574
原创 高性能MySQL读书笔记:1、MySQL架构与历史
MySQL逻辑架构MySQL具有分层架构,上层是服务器层的查询和执行引擎下层是存储引擎。其中,服务器层又包含两层,第一层负责连接/线程处理、授权认证、安全,第二层负责查询解析、分析、优化、缓存以及所有的内置函数,所有的跨存储引擎功能。每个客户端连接都会在服务器端拥有一个线程,MySQL服务器端维护线程池。认证基于用户名、原始主机信息和密码,可使用SSL。收到查询后,MySQL会解析
2016-12-20 23:50:01
646
原创 Scrapy源码分析(四):请求Request
本次我们要分析的Scrapy源码为Request模块,模块的位置:from scrapytest.http import Request首先把Request的源码附上:class Request(object_ref): def __init__(self, url, callback=None, method='GET', headers=None, body=None,
2016-12-17 23:27:07
6855
原创 DAY29:leetcode #32 Longest Valid Parentheses
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "()",
2016-12-01 16:29:13
334
原创 Scrapy源码分析(三):信号管理器SignalManager
类的位置scrapy.signalmanager.SignalManager。主要是对pydispatch.dispatcher的一层封装。首先来看看pydispatch.dispatcher都有哪些功能:项目主页这个模块主要提供了消息的发送和接收功能,主页的示例:To set up a function to receive signals:from pydispatch
2016-11-29 23:41:26
2337
原创 DAY28:leetcode #41 First Missing Positive
Given an unsorted integer array, find the first missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algorithm should run in O(n) time and uses constant
2016-11-29 14:11:18
366
转载 Python入门基础知识:locals() 和globals()
原文链接:点击打开链接Python有两个内置的函数,locals() 和globals(),它们提供了基于字典的访问局部和全局变量的方式。首先,是关于名字空间的一个名词解释。是枯燥,但是很重要,所以要耐心些。Python使用叫做名字空间的东西来记录变量的轨迹。名字空间只是一个 字典,它的键字就是变量名,字典的值就是那些变量的值。实际上,名字空间可以象Python的字典一样进行访问,
2016-11-28 23:26:25
1153
原创 DAY27:leetcode #23 Merge k Sorted Lists
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.Subscribe to see which companies asked this question# Definition for singly-linked list.# c
2016-11-28 16:41:38
334
原创 DAY27:leetcode #25 Reverse Nodes in k-Group
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is
2016-11-28 16:10:00
325
原创 DAY27:leetcode #18 4Sum
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note: The solution
2016-11-28 14:40:09
262
原创 DAY26:leetcode #5 Longest Palindromic Substring
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: "babad"Output: "bab"Note: "aba" is also a valid answer.
2016-11-27 19:34:35
325
原创 Scrapy源码分析(二):Setting相关类定义
Scrapy中的BaseSetting的行为是一个包含优先级的字典,当请求存在的key时,value中优先级最大的一个会被返回。首先看几个辅助的元素,优先级字典:SETTINGS_PRIORITIES = { 'default': 0, 'command': 10, 'project': 20, 'spider': 30, 'cmdline': 40
2016-11-27 16:21:38
2156
原创 Scrapy源码分析(一):框架入口点和配置文件加载
本系列文章涉及到的Scrapy为1.2.1版本,运行环境为py2.7。首先我们查看一下setup.py:entry_points={ 'console_scripts': ['scrapy = scrapy.cmdline:execute'] },可以看到,框架唯一的入口点是命令行的scrapy命令,对应scrapy.cmdline下的execute方法。下面查
2016-11-27 11:48:41
7347
3
原创 DAY25:leetcode #53 Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4],the contiguous subarray [4,-1,2,1] ha
2016-11-15 10:45:39
318
原创 DAY24:leetcode #67 Add Binary
Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".Subscribe to see which companies asked this questionclass Solution(object)
2016-11-10 16:06:35
319
原创 DAY24:leetcode #66 Plus One
Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.Subscribe to see
2016-11-10 15:51:23
281
原创 DAY24:leetcode #64 Minimum Path Sum
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or right at
2016-11-10 13:53:38
271
原创 DAY24:leetcode #63 Unique Paths II
Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respectively in the
2016-11-10 13:23:45
267
原创 DAY24:leetcode #62 Unique Paths
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the
2016-11-10 13:10:02
237
原创 DAY23:leetcode #60 Permutation Sequence
The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3):"123""132""213""231""3
2016-11-08 23:44:37
237
原创 DAY23:leetcode #59 Spiral Matrix II
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should return the following matrix:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [
2016-11-08 20:14:57
231
原创 DAY23:leetcode #56 Merge Intervals
Given a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18].Subscribe to see which companies asked this qu
2016-11-08 17:03:40
395
原创 DAY23:leetcode #54 Spiral Matrix
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ]]
2016-11-08 16:17:49
240
原创 DAY22:leetcode #37 Sudoku Solver
Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that there will be only one unique solution.A sudoku
2016-11-07 22:14:34
281
原创 DAY22:leetcode #36 Valid Sudoku
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character '.'.A partially fille
2016-11-07 18:33:42
257
原创 DAY22:leetcode #52 N-Queens II
Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.Subscribe to see which companies asked this questionclass
2016-11-06 15:28:29
237
原创 DAY22:leetcode #51 N-Queens
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the n-queens puzzle
2016-11-06 15:24:33
328
原创 DAY21:leetcode #50 Pow(x, n)
Implement pow(x, n).Subscribe to see which companies asked this questionclass Solution(object): def myPow(self, x, n): """ :type x: float :type n: int :rt
2016-11-05 14:44:24
338
原创 DAY21:leetcode #49 Group Anagrams
Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[ ["ate", "eat","tea"], ["nat","tan"], ["bat"]]Note: Al
2016-11-05 14:09:05
217
原创 DAY21:leetcode #48 Rotate Image
You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?Subscribe to see which companies asked this que
2016-11-05 13:48:02
270
原创 DAY20:leetcode #45 Jump Game II
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your goal i
2016-11-04 20:07:54
253
原创 DAY20:leetcode #55 Jump Game
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine i
2016-11-04 12:05:38
232
原创 DAY19:leetcode #39 Combination Sum
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 repeated number may be chosen from C unlimited numb
2016-11-04 11:36:55
279
原创 DAY18:leetcode #43 Multiply Strings
Given two numbers represented as strings, return multiplication of the numbers as a string.Note:The numbers can be arbitrarily large and are non-negative.Converting the input string to integ
2016-11-04 11:35:20
207
原创 DAY17:leetcode #34 Search for a Range
Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the target is not found
2016-11-04 11:32:58
243
原创 DAY17:leetcode #42 Trapping Rain Water
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example, Given [0,1,0,2,1,0,1,3,2,1,2,1]
2016-11-04 11:31:30
224
原创 DAY16:leetcode #33 Search in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the array retur
2016-11-04 11:29:21
217
原创 DAY15:leetcode #35 Search Insert Position
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 order.You may assume no duplicates in the array.
2016-11-04 11:27:58
199
空空如也
python中的xpath,为什么'/html'就匹配不到
2015-10-11
TA创建的收藏夹 TA关注的收藏夹
TA关注的人