<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[lqcsp的专栏]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/lqcsp</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; lqcsp]]></copyright><item><title><![CDATA[Split array into two equal sum subArray]]></title><link>https://blog.youkuaiyun.com/lqcsp/article/details/52330688</link><guid>https://blog.youkuaiyun.com/lqcsp/article/details/52330688</guid><author>lqcsp</author><pubDate>Fri, 26 Aug 2016 18:02:38 +0800</pubDate><description><![CDATA[@(leetcode)[数组|Google]ProblemA zero-indexed array A consisting of N integers is given. An equilibrium index of this array is any integer P such that 0 ≤ P < N and the sum of elements of lower indices i]]></description><category></category></item><item><title><![CDATA[Line reconstruction by height]]></title><link>https://blog.youkuaiyun.com/lqcsp/article/details/52291786</link><guid>https://blog.youkuaiyun.com/lqcsp/article/details/52291786</guid><author>lqcsp</author><pubDate>Tue, 23 Aug 2016 16:03:13 +0800</pubDate><description><![CDATA[ProblemSuppose you have a line of n people in which the k-th person is described by a pair (h,t) , where h is the height of the k-th person and t is the number of people in front of k who have a height]]></description><category></category></item><item><title><![CDATA[Find number of subsets with equal sum]]></title><link>https://blog.youkuaiyun.com/lqcsp/article/details/52290077</link><guid>https://blog.youkuaiyun.com/lqcsp/article/details/52290077</guid><author>lqcsp</author><pubDate>Tue, 23 Aug 2016 13:26:47 +0800</pubDate><description><![CDATA[@(leetcode)[动态规划|Google]ProblemGiven a number N ( N > 1), gives a set S = [1,2,..., N]. 
Divide S in two subsets such that S1 ∪ S2 = S and S1 ∩ S2 = Ø and return the number of subsets with equal sum.Ex]]></description><category></category></item><item><title><![CDATA[The longest absolute path in file system]]></title><link>https://blog.youkuaiyun.com/lqcsp/article/details/52289983</link><guid>https://blog.youkuaiyun.com/lqcsp/article/details/52289983</guid><author>lqcsp</author><pubDate>Tue, 23 Aug 2016 13:07:48 +0800</pubDate><description><![CDATA[The longest absolute path in file system@(leetcode)[字符串|DFS|Google] 
The string "dir\n\tsubdir1\n\tsubdir2\n\t\tfile.ext" represents:dir
    subdir1
    subdir2
    file.ext
a directory dir contains an]]></description><category></category></item><item><title><![CDATA[Shortest substring containing three short strings]]></title><link>https://blog.youkuaiyun.com/lqcsp/article/details/52278312</link><guid>https://blog.youkuaiyun.com/lqcsp/article/details/52278312</guid><author>lqcsp</author><pubDate>Mon, 22 Aug 2016 16:55:10 +0800</pubDate><description><![CDATA[@(leetcode)[字符串, Google]ProblemGiven a long string s and short strings t1, t2, t3 (which can have different length) find the shortest substring of s which contains t1, t2 and t3.Example: 
s = "abcdefgh]]></description><category></category></item><item><title><![CDATA[Maximum traffic between city and its neighbors]]></title><link>https://blog.youkuaiyun.com/lqcsp/article/details/52278298</link><guid>https://blog.youkuaiyun.com/lqcsp/article/details/52278298</guid><author>lqcsp</author><pubDate>Mon, 22 Aug 2016 16:54:17 +0800</pubDate><description><![CDATA[@(leetcode)[图论|Google]ProblemYou are given a graph with no cycles, each node representing different cities and there are stadiums for baseball games in all cities. Each node contains a value representi]]></description><category></category></item><item><title><![CDATA[386. Lexicographical Numbers]]></title><link>https://blog.youkuaiyun.com/lqcsp/article/details/52267951</link><guid>https://blog.youkuaiyun.com/lqcsp/article/details/52267951</guid><author>lqcsp</author><pubDate>Sun, 21 Aug 2016 16:28:49 +0800</pubDate><description><![CDATA[ProblemGiven an integer n, return 1 - n in lexicographical order.For example, given 13, return:[1,10,11,12,13,2,3,4,5,6,7,8,9].Please optimize your algorithm to use less time and space. The input size]]></description><category></category></item><item><title><![CDATA[384. Shuffle an Array]]></title><link>https://blog.youkuaiyun.com/lqcsp/article/details/52267775</link><guid>https://blog.youkuaiyun.com/lqcsp/article/details/52267775</guid><author>lqcsp</author><pubDate>Sun, 21 Aug 2016 16:02:53 +0800</pubDate><description><![CDATA[@(leetcode)[数组]ProblemShuffle a set of numbers without duplicates.Example:
  // Init an array with set 1, 2, and 3. 
  int[] nums = {1,2,3}; 
  Solution solution = new Solution(nums); 
  // Shuffle the]]></description><category></category></item><item><title><![CDATA[38. Count and Say]]></title><link>https://blog.youkuaiyun.com/lqcsp/article/details/52267768</link><guid>https://blog.youkuaiyun.com/lqcsp/article/details/52267768</guid><author>lqcsp</author><pubDate>Sun, 21 Aug 2016 16:01:57 +0800</pubDate><description><![CDATA[ProblemThe count-and-say sequence is the sequence of integers beginning as follows: 
1, 11, 21, 1211, 111221, ...1is read off as "one 1" or 11 
11is read off as"two 1s"or21 
21is read off as"one 2then]]></description><category></category></item><item><title><![CDATA[37. Sudoku Solver]]></title><link>https://blog.youkuaiyun.com/lqcsp/article/details/52267759</link><guid>https://blog.youkuaiyun.com/lqcsp/article/details/52267759</guid><author>lqcsp</author><pubDate>Sun, 21 Aug 2016 16:01:08 +0800</pubDate><description><![CDATA[ProblemWrite 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 puzzle…Solut]]></description><category></category></item><item><title><![CDATA[59. Spiral Matrix II]]></title><link>https://blog.youkuaiyun.com/lqcsp/article/details/52267751</link><guid>https://blog.youkuaiyun.com/lqcsp/article/details/52267751</guid><author>lqcsp</author><pubDate>Sun, 21 Aug 2016 15:59:54 +0800</pubDate><description><![CDATA[ProblemGiven 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,]]></description><category></category></item><item><title><![CDATA[Word Ladder II]]></title><link>https://blog.youkuaiyun.com/lqcsp/article/details/52267742</link><guid>https://blog.youkuaiyun.com/lqcsp/article/details/52267742</guid><author>lqcsp</author><pubDate>Sun, 21 Aug 2016 15:58:47 +0800</pubDate><description><![CDATA[Given two words (beginWord and endWord), and a dictionary’s word list, find all shortest transformation sequence(s) from beginWord to endWord, such that:Only one letter can be changed at a time 
Each i]]></description><category></category></item><item><title><![CDATA[133. Clone Graph]]></title><link>https://blog.youkuaiyun.com/lqcsp/article/details/52267704</link><guid>https://blog.youkuaiyun.com/lqcsp/article/details/52267704</guid><author>lqcsp</author><pubDate>Sun, 21 Aug 2016 15:55:35 +0800</pubDate><description><![CDATA[# 
@(leetcode)[BFS, 图论]Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ’s undirected graph serialization: 
Nodes are labeled uniquely.We use # as a sepa]]></description><category></category></item><item><title><![CDATA[Unique Binary Search Trees II]]></title><link>https://blog.youkuaiyun.com/lqcsp/article/details/52267695</link><guid>https://blog.youkuaiyun.com/lqcsp/article/details/52267695</guid><author>lqcsp</author><pubDate>Sun, 21 Aug 2016 15:54:36 +0800</pubDate><description><![CDATA[Unique Binary Search Trees II@(leetcode)[枚举, DFS]Given an integer n, generate all structurally unique BST’s (binary search trees) that store values 1…n.For example, 
Given n = 3, your program should re]]></description><category></category></item><item><title><![CDATA[65. Valid Number]]></title><link>https://blog.youkuaiyun.com/lqcsp/article/details/52267686</link><guid>https://blog.youkuaiyun.com/lqcsp/article/details/52267686</guid><author>lqcsp</author><pubDate>Sun, 21 Aug 2016 15:52:49 +0800</pubDate><description><![CDATA[65. Valid NumberProblemValidate if a given string is numeric.Some examples: 
"0" => true 
" 0.1 " => true 
"abc" => false 
"1 a" => false 
"2e10" => trueNote: It is intended for the problem statement t]]></description><category></category></item><item><title><![CDATA[Redis数据库实现]]></title><link>https://blog.youkuaiyun.com/lqcsp/article/details/51862814</link><guid>https://blog.youkuaiyun.com/lqcsp/article/details/51862814</guid><author>lqcsp</author><pubDate>Fri, 08 Jul 2016 17:36:26 +0800</pubDate><description><![CDATA[Redis服务器将所有数据库都保存在服务器状态redis.h/redisServer结构的db数组中，db数组的每一项都是一个redisDb结构，每个redisDb代表一个数据库。



struct redisServer {
     redisDb *db;
     int dbnum;//该值是由服务器配置的database选项决定，默认值是16

};



]]></description><category></category></item><item><title><![CDATA[Redis 对象]]></title><link>https://blog.youkuaiyun.com/lqcsp/article/details/51732046</link><guid>https://blog.youkuaiyun.com/lqcsp/article/details/51732046</guid><author>lqcsp</author><pubDate>Wed, 22 Jun 2016 09:55:23 +0800</pubDate><description><![CDATA[Redis并没有直接使用这些基础数据结构实现键值对的数据库，而是基于这些数据结构创建一个对象系统。包括字符串对象，列表对象，哈希对象，集合对象和有序集合对象。

     Redis中每个对象都由一个redisObject结构表示，该结构如下：


typedef struct redisObject {
     unsigned type:4;//类型，记录了对象的类型， 这个类型]]></description><category></category></item><item><title><![CDATA[Redis 数据结构]]></title><link>https://blog.youkuaiyun.com/lqcsp/article/details/51730700</link><guid>https://blog.youkuaiyun.com/lqcsp/article/details/51730700</guid><author>lqcsp</author><pubDate>Tue, 21 Jun 2016 22:48:56 +0800</pubDate><description><![CDATA[Redis 数据结构


最近接触到了Redis的使用，借这个机会深入的了解一下Redis的实现和设计原理。下面先介绍一下Redis底层所用到的数据结构。Redis的实现几乎都是基于下面的几个数据结构之上的。




1.SDS 结构
struct sdshdr {
     int len; // 记录数组中已经使用的字节数量，不算结尾的\0
     int free; ]]></description><category></category></item><item><title><![CDATA[算法乐趣--三只水桶等分水问题]]></title><link>https://blog.youkuaiyun.com/lqcsp/article/details/50563107</link><guid>https://blog.youkuaiyun.com/lqcsp/article/details/50563107</guid><author>lqcsp</author><pubDate>Fri, 22 Jan 2016 17:19:01 +0800</pubDate><description><![CDATA[有一个容积为8升的水桶里装满了水，另外还有一个容积为3升的空桶和一个容积为5升的空桶，如何利用这两个空桶等分8升水？附加条件是三个水桶都没有体积刻度，也不能使用其它辅助容器。

        这是一道经典题目，一般人都可以在一分钟内给出答案，不过，很多人可能没有注意到这道题的答案不是唯一的。先来看看最常见的一个答案，也是目前已知最快的操作步骤，共需要7次倒水动作：

bucket_sta]]></description><category></category></item><item><title><![CDATA[二叉树的最小深度]]></title><link>https://blog.youkuaiyun.com/lqcsp/article/details/50500277</link><guid>https://blog.youkuaiyun.com/lqcsp/article/details/50500277</guid><author>lqcsp</author><pubDate>Mon, 11 Jan 2016 23:19:55 +0800</pubDate><description><![CDATA[1，题目要求，求一个二叉树的最小深度？
int minHeight(TreeNode* root) {
	if(NULL == root) return 0;
        int left = minHeight(root->left);
        int right minHeight(root->right);
        if(left == 0 && right == 0)]]></description><category></category></item></channel></rss>