自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(27)
  • 资源 (1)
  • 收藏
  • 关注

原创 Zookeeper 使用

下载安装 zookeeper wget http://ftp.wayne.edu/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz tar xvf zookeeper-3.4.6.tar.gz export JAVA_HOME=`/usr/libexec/java_home -v 1.7`cp conf/zoo_sa

2015-06-08 13:48:39 751

原创 Dynamic Programming Solvable Problem

1. Knapsack, n items, put into size W bag, maximize the item value in the bag1.1 n items put into 2 bag, bag size as W1, and W21.2 select at most k item from n, put them in the bag size

2013-10-18 11:45:30 565

原创 C++ memory management

1. vector1. 1 After vector is allocated, the memory it occupies is not freed until destructor is called, even if v.clear() is called.To explicitly deallocate this piece of memory, use this tri

2013-10-13 11:02:31 476

原创 Summarize of network protocol in c

Internet Addrin_port_t: uint16_t, 16 bits for portssocket * create new socketint socket (int namespace, int style, int protocol)style: SOCK_STREAM or SOCK_DGRAM * bind a namesp

2013-10-06 13:52:05 514

原创 Understanding Memcached Source Code

I am trying to learn how memcached works by reading its testcase step by step------------------------------------------------------------------------------------------------------------------------

2013-10-04 14:19:08 670

原创 Memcached and libmemcached Installation on Solaris 11

It seems possible to install memcached using Solaris pkg:#pkg list -a memcachedservice/memcached (or see http://pkg.oracle.com/solaris/release/en/catalog.shtml) However, since I may want t

2013-09-30 14:05:45 1627

原创 How to use Compiler

GNU: gcc: g++: Sun: cc: 1. Memory model, -m64 flag indicate 64 bit memory model, otherwise, could not access more than 2 GB memory spacecc -m64 -g mem_test.c CC:

2013-09-29 07:13:20 471

原创 Word Ladder I

Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that:Only one letter can be changed at a timeEach intermediat

2013-06-10 06:08:01 468

原创 LeetCode: Best Time to Buy and Sell Stock III

Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most two transactions.Note:You ma

2013-06-06 14:22:01 603

原创 LeetCode: Binary Tree Inorder Traversal, Morris In Order Traversal

Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,3,2].Note: Recursive sol

2013-06-02 15:39:55 685

原创 LeetCode: Interleaving String

Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example,Given:s1 = "aabcc",s2 = "dbbca",When s3 = "aadbbcbcac", return true.When s3 = "aadbbbaccc",

2013-05-29 11:18:43 835

原创 LeetCode: Unique Binary Search Trees II, Dynamic Programming

Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example,Given n = 3, your program should return all 5 unique BST's shown below. 1

2013-05-23 12:56:13 862

原创 LeetCode: Unique Binary Search Trees, Dynamic Programming

Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1

2013-05-23 12:02:08 805

原创 LeetCode: Scramble String, a naive recursion solution

Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation of s1 = "great": great / \ gr

2013-05-20 14:07:02 1126

原创 LeetCode: Largest Rectangle in Histogram, a naive solution

Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where width of each bar

2013-05-15 14:25:02 583

原创 LeetCode: Minimum Window Substring

Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S = "ADOBECODEBANC"T = "ABC"Minimum window is "BAN

2013-05-11 11:19:14 478

原创 Set Matrix Zeros

Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.Follow up:Did you use extra space?A straight forward solution using O(mn) space is probably a b

2013-05-09 14:32:51 458

原创 LeetCode: Edit Distance of Two Words

Edit Distance of the Two WordsGiven two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 opera

2013-05-09 13:29:18 550

原创 LeetCode: N Queens II

Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.a DFS search will be exponential increase in terms of N.  B

2013-04-24 10:41:37 584

原创 use map<key, val> in C++, solve LeetCode Anagrams 240 ms pass large test set

AnagramsGiven an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.The basic idea is easy.  From the definition of anagrams, we just n

2013-04-21 16:22:04 914

原创 External Merge Sort, time complexity analysis

The time complexity of Merge Sort is nlogn.  How about the external merge sort?1. One pass external merge sortstep 1. break N data to k groups, each group has N/k data, complexity is N/klog(N/

2013-04-19 12:17:46 2026

原创 LeetCode: 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 consta

2013-04-15 16:00:47 505

原创 LeetCode: Combination Sum II

Again, similar as the previous one, this combination sum could also be solved by DFShttp://blog.csdn.net/u010204902/article/details/8803342How to make sure that the result is unique?  We nee

2013-04-15 15:43:02 623

原创 LeetCode: Combination Sum non recursive

The basic idea, shown in the previous blog http://blog.csdn.net/u010204902/article/details/8803342is to use DFSI tried to use non-recursive method to do the DFS.  I need to maintain a st

2013-04-15 15:16:43 1251

原创 LeetCode: 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

2013-04-15 13:02:37 1257

原创 A Fast Sudoku Solver: LeetCode Problem

This is an efficient and fast solver for Sudoku problem.  I passed the large test within 24ms.  The problem is below:Write a program to solve a Sudoku puzzle by filling the empty cells.

2013-04-15 07:01:36 646

原创 LeetCode Sudoku Solver

56 ms 过large test基本算法,有三个数组,分别记录每一行,每一列,每一个方块里面被填了的数,例如,如果第1行里,1已经被填了,那么row[0][0] = 1,这样,可以很快的测试对于board[i][j], 数字r是否可以填if(row[i][r] == 0 && col[j][r] == 0 && square[i/3*3+j/3][r] == 0)

2013-04-15 05:51:37 848

LeetCode Permutation

Source file for LeetCode Permutations Problem

2013-04-19

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除