原创 189. Rotate Array
Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] i
原创 274,275. H-Index I, II
Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the
原创 221. Maximal Square
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. Fo
原创 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(word
原创 10. Regular Expression Matching
Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches
原创 208. Implement Trie (Prefix Tree)
Implement a trie with insert, search, and startsWith methods. Note: You may assume that all inputs are consist of l
原创 301. Remove Invalid Parentheses
題目: Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible res
原创 325. Maximum Size Subarray Sum Equals k
題目 Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If there isn't one,
原创 164. Maximum Gap
Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Try to solve
原创 374,375. Guess Number Higher or Lower I,II
We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number
原创 30. Substring with Concatenation of All Words
You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of
原创 146. LRU Cache
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:
原创 91. Decode Ways
A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ...
原创 257. Binary Tree Paths
Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / \ 2
原创 Heap & Priority Queue
Heap: Array & Linked List & abstract implementation: http://cs.bluecc.edu/java/CS260/Notes/Priority.htm PriorityQueu