leetcode解題總匯

專開一欄來記錄leetcode的解題

目前都用c++寫,暫時只記一兩種解法,後面會陸續補全

1 Two Sum

雪之下雪乃:Leetcodes Solution 1 Two Sum?

zhuanlan.zhihu.com圖標

2 Add Two Numbers.

雪之下雪乃:Leetcodes Solution 2 Add Two Numbers?

zhuanlan.zhihu.com圖標

3 Longest Substring Without Repeating Characters

雪之下雪乃:Leetcodes Solution 3 Longest Substring Without Repeating Characters?

zhuanlan.zhihu.com圖標

4 Median of Two Sorted Arrays

雪之下雪乃:Leetcodes Solutions 4 Median of Two Sorted Arrays?

zhuanlan.zhihu.com圖標

5 Longest Palindromic Substring

雪之下雪乃:Leetcodes Solutions 5 Longest Palindromic Substring?

zhuanlan.zhihu.com圖標

6 ZigZag Conversion

雪之下雪乃:Leetcodes Solutions 6 ZigZag Conversion?

zhuanlan.zhihu.com圖標

7 Reverse Integer

雪之下雪乃:Leetcodes Solutions 7 Reverse Integer?

zhuanlan.zhihu.com圖標

8 String to Integer (atoi)

雪之下雪乃:Leetcodes Solutions 8 String to Integer (atoi)?

zhuanlan.zhihu.com圖標

9 Palindrome Number

雪之下雪乃:Leetcodes Solutions 9 Palindrome Number?

zhuanlan.zhihu.com圖標

10 Regular Expression Matching

雪之下雪乃:Leetcodes Solutions 10 Regular Expression Matching?

zhuanlan.zhihu.com圖標

11 Container With Most Water

雪之下雪乃:Leetcodes Solutions 11 Container With Most Water?

zhuanlan.zhihu.com圖標

12 Integer to Roman

雪之下雪乃:Leetcodes Solutions 12 Integer to Roman?

zhuanlan.zhihu.com圖標

13 Roman to Integer

雪之下雪乃:leetcodes solutions 13 Roman to Integer?

zhuanlan.zhihu.com圖標

14. Longest Common Prefix

雪之下雪乃:Leetcodes Solutions 14. Longest Common Prefix?

zhuanlan.zhihu.com圖標

15 3Sum

雪之下雪乃:Leetcodes Solutions 15 3Sum?

zhuanlan.zhihu.com圖標

16 3Sum closest

雪之下雪乃:Leetcodes Solutions 16 3Sum closest?

zhuanlan.zhihu.com圖標

17 Letter Combinations of a Phone Number

雪之下雪乃:Leetcodes Solutions 17 Letter Combinations of a Phone Number?

zhuanlan.zhihu.com圖標

18 4Sum

雪之下雪乃:Leetcodes Solutions 18 4Sum?

zhuanlan.zhihu.com圖標

19 Remove Nth Node From End of List

雪之下雪乃:Leetcodes Solutions 19 Remove Nth Node From End of List?

zhuanlan.zhihu.com圖標

20 Valid Parentheses

雪之下雪乃:Leetcodes Solutions 20 Valid Parentheses?

zhuanlan.zhihu.com圖標

21 Merge Two Sorted Lists

雪之下雪乃:Leetcodes Solutions 21 Merge Two Sorted Lists?

zhuanlan.zhihu.com圖標

22 Generate Parentheses

雪之下雪乃:Leetcodes Solutions 22 Generate Parentheses?

zhuanlan.zhihu.com圖標

23 Merge k Sorted Lists

雪之下雪乃:Leetcodes Solutions 23 Merge k Sorted Lists?

zhuanlan.zhihu.com圖標

24 Swap Nodes in Pairs

雪之下雪乃:Leetcodes Solutions 24 Swap Nodes in Pairs?

zhuanlan.zhihu.com圖標

25 Reverse Nodes in k-Group

雪之下雪乃:Leetcodes Solutions 25 Reverse Nodes in k-Group?

zhuanlan.zhihu.com圖標

26 Remove Duplicates from Sorted Array

雪之下雪乃:Leetcodes Solutinos 26 Remove Duplicates from Sorted Array?

zhuanlan.zhihu.com圖標

27 Remove Element

雪之下雪乃:Leetcodes Solution 27 Remove Element?

zhuanlan.zhihu.com圖標

28 Implement strStr()

雪之下雪乃:Leetcodes Solution 28 Implement strStr()?

zhuanlan.zhihu.com圖標

29 Divide Two Integers

雪之下雪乃:Leetcodes Solution 29 Divide Two Integers?

zhuanlan.zhihu.com圖標

30 Substring with Concatenation of All Words

雪之下雪乃:Leetcodes Solution 30 Substring with Concatenation of All Words?

zhuanlan.zhihu.com圖標

31 Next Permutation

雪之下雪乃:Leetcodes Solution 31 Next Permutation?

zhuanlan.zhihu.com圖標

32 Longest Valid Parentheses

雪之下雪乃:Leetcodes Solution 32 Longest Valid Parentheses?

zhuanlan.zhihu.com圖標

33 Search in Rotated Sorted Array

雪之下雪乃:Leetcodes Solution 33 Search in Rotated Sorted Array?

zhuanlan.zhihu.com圖標

34 Search for a Range

雪之下雪乃:Leetcodes Solution 34 Search for a Range?

zhuanlan.zhihu.com圖標

35 Search Insert Position

雪之下雪乃:Leetcodes Solution 35 Search Insert Position?

zhuanlan.zhihu.com圖標

36 Valid Sudoku

雪之下雪乃:Leetcodes Solution 36 Valid Sudoku?

zhuanlan.zhihu.com圖標

37 Sudoku Solver

雪之下雪乃:Leetcodes Solution 37 Sudoku Solver?

zhuanlan.zhihu.com圖標

38 Count and Say

雪之下雪乃:Leetcodes Solution 38 Count and Say?

zhuanlan.zhihu.com圖標

39 Combination Sum

雪之下雪乃:Leetcodes Solution 39 Combination Sum?

zhuanlan.zhihu.com圖標

40 Combination Sum II

雪之下雪乃:Leetcodes Solution 40 Combination Sum II?

zhuanlan.zhihu.com圖標

41 First Missing Positive

雪之下雪乃:Leetcodes Solution 41 First Missing Positive?

zhuanlan.zhihu.com圖標

42 Trapping Rain Water

雪之下雪乃:Leetcodes Solution 42 Trapping Rain Water?

zhuanlan.zhihu.com圖標

43 Multiply Strings

雪之下雪乃:Leetcodes Solution 43 Multiply Strings?

zhuanlan.zhihu.com圖標

44 Wildcard Matching

雪之下雪乃:Leetcodes Solution 44 Wildcard Matching?

zhuanlan.zhihu.com圖標

45 Jump Game II

雪之下雪乃:Leetcodes Solution 45 Jump Game II?

zhuanlan.zhihu.com圖標

46 Permutations

雪之下雪乃:Leetcodes Solution 46 Permutations?

zhuanlan.zhihu.com圖標

47 Permutations II

雪之下雪乃:Leetcodes Solutions 47 Permutations II?

zhuanlan.zhihu.com圖標

48 Rotate Image

雪之下雪乃:Leetcodes Solutions 48 Rotate Image?

zhuanlan.zhihu.com圖標

49 Group Anagrams

雪之下雪乃:Leetcodes Solutions 49 Group Anagrams?

zhuanlan.zhihu.com圖標

50 Pow(x, n)

雪之下雪乃:Leetcodes Solutions 50 Pow(x, n)?

zhuanlan.zhihu.com圖標

51 N-Queens

雪之下雪乃:Leetcodes Solutions 51 N-Queens?

zhuanlan.zhihu.com圖標

52 N-Queens II

雪之下雪乃:Leetcodes Solutions 52 N-Queens II?

zhuanlan.zhihu.com圖標

53 Maximum Subarray

雪之下雪乃:Leetcodes Solutions 53 Maximum Subarray?

zhuanlan.zhihu.com圖標

54 Spiral Matrix

雪之下雪乃:Leetcodes Solution 54 Spiral Matrix?

zhuanlan.zhihu.com圖標
推薦閱讀:

正則表達式匹配
替換空格
生日悖論
012 Integer to Roman[M]
調整數組順序使奇數位於偶數前面

TAG:編程 | 數據結構 | 演算法 |