原创 [leetcode] 8.String to Integer (atoi)

題目: Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you wa

原创 [leetcode] 14.Longest Common Prefix

題目: Write a function to find the longest common prefix string amongst an array of strings. 題意: 找出字符串的最長公共前綴。 思路

原创 [leetcode] 151.Reverse Words in a String

題目: Given an input string, reverse the string word by word. For example, Given s = “the sky is blue”, return “bl

原创 [leetcode] 76.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 co

原创 [leetcode] 273.Integer to English Words

題目: Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than

原创 [leetcode] 300. Longest Increasing Subsequence

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

原创 [leetcode] 306. Additive Number

題目: Additive number is a string whose digits can form additive sequence. A valid additive sequence should contain at l

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

原创 [leetcode] 329. Longest Increasing Path in a Matrix

題目: Given an integer matrix, find the length of the longest increasing path. From each cell, you can either move to fo

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

原创 [leetcode] 304. Range Sum Query 2D - Immutable

題目: Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1

原创 [leetcode] 140.Word Break II

題目: Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a vali

原创 [leetcode] 274.H-Index

題目: Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to comput

原创 [leetcode] 299. Bulls and Cows

題目: You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to

原创 [leetcode] 301. Remove Invalid Parentheses

題目: Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible resu