原创 Surrounded Regions

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

原创 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 t

原创 Wildcard matching

Implement wildcard pattern matching with support for '?' and '*'. '?' Matches any single character. '*' Matches any

原创 Longest Consecutive Sequence

Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example, Give

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

原创 Candy

There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these child

原创 Max Points on a Line

Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. /* * A line

原创 word search II

Given a 2D board and a list of words from the dictionary, find all words in the board. Each word must be constructed

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

原创 LRU cache

Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:

原创 Valid Number

public class Solution { public boolean isNumber(String s) { s = s.trim(); boolean pointSeen = false; bo

原创 Regular Expression Matching

Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches ze

原创 Word Ladder II(BFS + DFS)

Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) f

原创 Expression Add Operators

Given a string that contains only digits 0-9 and a target value, return all possibilities to add binaryoperators (no

原创 數組:Remove Element&Merge Sorted Array&First Missing Positive

Remove Element public int removeElement(int[] nums, int val) { int count = 0; for(int i=0;i<nums.length