原创 Ten sort algorithms in interviews

http://www.admin10000.com/document/7042.html

原创 208. Implement Trie (Prefix Tree)

Implement a trie with insert, search, and startsWith methods. Note: You may assume that all inputs are consist of lo

原创 230. Kth Smallest Element in a BST

Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note:  You may assu

原创 131. Palindrome Partitioning

Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palin

原创 309. Best Time to Buy and Sell Stock with Cooldown

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

原创 241. Different Ways to Add Parentheses

Given a string of numbers and operators, return all possible results from computing all the different possible ways t

原创 96. Unique Binary Search Trees

Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example, Given n = 3,

原创 173. Binary Search Tree Iterator

Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.

原创 221. Maximal Square

Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area. Fo

原创 215. Kth Largest Element in an Array

Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not th

原创 211. Add and Search Word - Data structure design

Design a data structure that supports the following two operations: void addWord(word) bool search(word) search(wor

原创 300. Longest Increasing Subsequence

Given an unsorted array of integers, find the length of longest increasing subsequence. For example, Given [10, 9, 2

原创 Array Summary

The order of elements can be changed. It doesn't matter what you leave beyond the new length. You can just copy the ele

原创 130. Surrounded Regions

Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'. A region is captured by flipping al

原创 LInkedList

When using two pointers, do not use fast.next != nullfast may be null Given a sorted linked list, delete all nodes th