原创 The Power of Two Random Choices - Summary

Algorithm Introduction: Introduction Paper: The Power of Two Random Choices

原创 [LeetCode 292] Nim Game

You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you

原创 [LeetCode 295] Find Median from Data Stream

Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So

原创 kafka in a nutshell -- kafka 簡介

Kafka is a messaging system. That’s it. So why all the hype? In realitymessaging is a hugely important piece of infr

原创 [LeetCode 156] Binary Tree Upside Down

Given a binary tree where all the right nodes are either leaf nodes with a sibling (a left node that shares the same

原创 [LeetCode 214] Shortest Palindrome

Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return th

原创 [LeetCode 290] Word Pattern

Given a pattern and a string str, find if str follows the same pattern. Examples: pattern = "abba", str = "dog cat cat

原创 System Design 之 Tiny Uri

http://www.zhihu.com/question/29270034?sort=created Requirement 1. Generate short url, from long to short url 2. Recove

原创 [LeetCode 218] The Skyline Problem

A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a di

原创 [LeetCode 228] Summary Ranges

Given a sorted integer array without duplicates, return the summary of its ranges. For example, given [0,1,2,4,5,7], r

原创 [LeetCode 188] Best Time to Buy and Sell Stock IV

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 th

原创 [LeetCode 289] Game of Life

According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised b

原创 [LeetCode 174] Dungeon Game

The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consi

原创 [LeetCode 293] Flip Game

You are playing the following Flip Game with your friend: Given a string that contains only these two characters:+ and

原创 [LeetCode 297] Serialize and Deserialize Binary Tree

Serialization is the process of converting a data structure or object into a sequence of bits so that it can be sto