LeetCode Problems' Solutions

openset · · 1427 次点击 · · 开始浏览    
这是一个创建于 的文章,其中的信息可能已经有所发展或是发生改变。

# [LeetCode](https://openset.github.io/leetcode) LeetCode Problems' Solutions [![Build Status](https://travis-ci.org/openset/leetcode.svg?branch=master)](https://travis-ci.org/openset/leetcode) | # | Title | Solution | Difficulty | | :-: | - | - | :-: | | <span id="1">1</span> | [Two Sum](https://leetcode.com/problems/two-sum) | [Go](https://github.com/openset/leetcode/tree/master/problems/two-sum) | Easy | | <span id="2">2</span> | [Add Two Numbers](https://leetcode.com/problems/add-two-numbers) | [Go](https://github.com/openset/leetcode/tree/master/problems/add-two-numbers) | Medium | | <span id="3">3</span> | [Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters) | [Go](https://github.com/openset/leetcode/tree/master/problems/longest-substring-without-repeating-characters) | Medium | | <span id="4">4</span> | [Median of Two Sorted Arrays](https://leetcode.com/problems/median-of-two-sorted-arrays) | [Go](https://github.com/openset/leetcode/tree/master/problems/median-of-two-sorted-arrays) | Hard | | <span id="5">5</span> | [Longest Palindromic Substring](https://leetcode.com/problems/longest-palindromic-substring) | [Go](https://github.com/openset/leetcode/tree/master/problems/longest-palindromic-substring) | Medium | | <span id="6">6</span> | [ZigZag Conversion](https://leetcode.com/problems/zigzag-conversion) | [Go](https://github.com/openset/leetcode/tree/master/problems/zigzag-conversion) | Medium | | <span id="7">7</span> | [Reverse Integer](https://leetcode.com/problems/reverse-integer) | [Go](https://github.com/openset/leetcode/tree/master/problems/reverse-integer) | Easy | | <span id="8">8</span> | [String to Integer (atoi)](https://leetcode.com/problems/string-to-integer-atoi) | [Go](https://github.com/openset/leetcode/tree/master/problems/string-to-integer-atoi) | Medium | | <span id="9">9</span> | [Palindrome Number](https://leetcode.com/problems/palindrome-number) | [Go](https://github.com/openset/leetcode/tree/master/problems/palindrome-number) | Easy | | <span id="10">10</span> | [Regular Expression Matching](https://leetcode.com/problems/regular-expression-matching) | [Go](https://github.com/openset/leetcode/tree/master/problems/regular-expression-matching) | Hard | | <span id="11">11</span> | [Container With Most Water](https://leetcode.com/problems/container-with-most-water) | [Go](https://github.com/openset/leetcode/tree/master/problems/container-with-most-water) | Medium | | <span id="12">12</span> | [Integer to Roman](https://leetcode.com/problems/integer-to-roman) | [Go](https://github.com/openset/leetcode/tree/master/problems/integer-to-roman) | Medium | | <span id="13">13</span> | [Roman to Integer](https://leetcode.com/problems/roman-to-integer) | [Go](https://github.com/openset/leetcode/tree/master/problems/roman-to-integer) | Easy | | <span id="14">14</span> | [Longest Common Prefix](https://leetcode.com/problems/longest-common-prefix) | [Go](https://github.com/openset/leetcode/tree/master/problems/longest-common-prefix) | Easy | | <span id="15">15</span> | [3Sum](https://leetcode.com/problems/3sum) | [Go](https://github.com/openset/leetcode/tree/master/problems/3sum) | Medium | | <span id="16">16</span> | [3Sum Closest](https://leetcode.com/problems/3sum-closest) | [Go](https://github.com/openset/leetcode/tree/master/problems/3sum-closest) | Medium | | <span id="17">17</span> | [Letter Combinations of a Phone Number](https://leetcode.com/problems/letter-combinations-of-a-phone-number) | [Go](https://github.com/openset/leetcode/tree/master/problems/letter-combinations-of-a-phone-number) | Medium | | <span id="18">18</span> | [4Sum](https://leetcode.com/problems/4sum) | [Go](https://github.com/openset/leetcode/tree/master/problems/4sum) | Medium | | <span id="19">19</span> | [Remove Nth Node From End of List](https://leetcode.com/problems/remove-nth-node-from-end-of-list) | [Go](https://github.com/openset/leetcode/tree/master/problems/remove-nth-node-from-end-of-list) | Medium | | <span id="20">20</span> | [Valid Parentheses](https://leetcode.com/problems/valid-parentheses) | [Go](https://github.com/openset/leetcode/tree/master/problems/valid-parentheses) | Easy | | <span id="21">21</span> | [Merge Two Sorted Lists](https://leetcode.com/problems/merge-two-sorted-lists) | [Go](https://github.com/openset/leetcode/tree/master/problems/merge-two-sorted-lists) | Easy | | <span id="22">22</span> | [Generate Parentheses](https://leetcode.com/problems/generate-parentheses) | [Go](https://github.com/openset/leetcode/tree/master/problems/generate-parentheses) | Medium | | <span id="23">23</span> | [Merge k Sorted Lists](https://leetcode.com/problems/merge-k-sorted-lists) | [Go](https://github.com/openset/leetcode/tree/master/problems/merge-k-sorted-lists) | Hard | | <span id="24">24</span> | [Swap Nodes in Pairs](https://leetcode.com/problems/swap-nodes-in-pairs) | [Go](https://github.com/openset/leetcode/tree/master/problems/swap-nodes-in-pairs) | Medium | | <span id="25">25</span> | [Reverse Nodes in k-Group](https://leetcode.com/problems/reverse-nodes-in-k-group) | [Go](https://github.com/openset/leetcode/tree/master/problems/reverse-nodes-in-k-group) | Hard | | <span id="26">26</span> | [Remove Duplicates from Sorted Array](https://leetcode.com/problems/remove-duplicates-from-sorted-array) | [Go](https://github.com/openset/leetcode/tree/master/problems/remove-duplicates-from-sorted-array) | Easy | | <span id="27">27</span> | [Remove Element](https://leetcode.com/problems/remove-element) | [Go](https://github.com/openset/leetcode/tree/master/problems/remove-element) | Easy | | <span id="28">28</span> | [Implement strStr()](https://leetcode.com/problems/implement-strstr) | [Go](https://github.com/openset/leetcode/tree/master/problems/implement-strstr) | Easy | | <span id="29">29</span> | [Divide Two Integers](https://leetcode.com/problems/divide-two-integers) | [Go](https://github.com/openset/leetcode/tree/master/problems/divide-two-integers) | Medium | | <span id="30">30</span> | [Substring with Concatenation of All Words](https://leetcode.com/problems/substring-with-concatenation-of-all-words) | [Go](https://github.com/openset/leetcode/tree/master/problems/substring-with-concatenation-of-all-words) | Hard | | <span id="31">31</span> | [Next Permutation](https://leetcode.com/problems/next-permutation) | [Go](https://github.com/openset/leetcode/tree/master/problems/next-permutation) | Medium | | <span id="32">32</span> | [Longest Valid Parentheses](https://leetcode.com/problems/longest-valid-parentheses) | [Go](https://github.com/openset/leetcode/tree/master/problems/longest-valid-parentheses) | Hard | | <span id="33">33</span> | [Search in Rotated Sorted Array](https://leetcode.com/problems/search-in-rotated-sorted-array) | [Go](https://github.com/openset/leetcode/tree/master/problems/search-in-rotated-sorted-array) | Medium | | <span id="34">34</span> | [Find First and Last Position of Element in Sorted Array](https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array) | [Go](https://github.com/openset/leetcode/tree/master/problems/find-first-and-last-position-of-element-in-sorted-array) | Medium | | <span id="35">35</span> | [Search Insert Position](https://leetcode.com/problems/search-insert-position) | [Go](https://github.com/openset/leetcode/tree/master/problems/search-insert-position) | Easy | | <span id="36">36</span> | [Valid Sudoku](https://leetcode.com/problems/valid-sudoku) | [Go](https://github.com/openset/leetcode/tree/master/problems/valid-sudoku) | Medium | | <span id="37">37</span> | [Sudoku Solver](https://leetcode.com/problems/sudoku-solver) | [Go](https://github.com/openset/leetcode/tree/master/problems/sudoku-solver) | Hard | | <span id="38">38</span> | [Count and Say](https://leetcode.com/problems/count-and-say) | [Go](https://github.com/openset/leetcode/tree/master/problems/count-and-say) | Easy | | <span id="39">39</span> | [Combination Sum](https://leetcode.com/problems/combination-sum) | [Go](https://github.com/openset/leetcode/tree/master/problems/combination-sum) | Medium | | <span id="40">40</span> | [Combination Sum II](https://leetcode.com/problems/combination-sum-ii) | [Go](https://github.com/openset/leetcode/tree/master/problems/combination-sum-ii) | Medium | | <span id="41">41</span> | [First Missing Positive](https://leetcode.com/problems/first-missing-positive) | [Go](https://github.com/openset/leetcode/tree/master/problems/first-missing-positive) | Hard | | <span id="42">42</span> | [Trapping Rain Water](https://leetcode.com/problems/trapping-rain-water) | [Go](https://github.com/openset/leetcode/tree/master/problems/trapping-rain-water) | Hard | | <span id="43">43</span> | [Multiply Strings](https://leetcode.com/problems/multiply-strings) | [Go](https://github.com/openset/leetcode/tree/master/problems/multiply-strings) | Medium | | <span id="44">44</span> | [Wildcard Matching](https://leetcode.com/problems/wildcard-matching) | [Go](https://github.com/openset/leetcode/tree/master/problems/wildcard-matching) | Hard | | <span id="45">45</span> | [Jump Game II](https://leetcode.com/problems/jump-game-ii) | [Go](https://github.com/openset/leetcode/tree/master/problems/jump-game-ii) | Hard | | <span id="46">46</span> | [Permutations](https://leetcode.com/problems/permutations) | [Go](https://github.com/openset/leetcode/tree/master/problems/permutations) | Medium | | <span id="47">47</span> | [Permutations II](https://leetcode.com/problems/permutations-ii) | [Go](https://github.com/openset/leetcode/tree/master/problems/permutations-ii) | Medium | | <span id="48">48</span> | [Rotate Image](https://leetcode.com/problems/rotate-image) | [Go](https://github.com/openset/leetcode/tree/master/problems/rotate-image) | Medium | | <span id="49">49</span> | [Group Anagrams](https://leetcode.com/problems/group-anagrams) | [Go](https://github.com/openset/leetcode/tree/master/problems/group-anagrams) | Medium | | <span id="50">50</span> | [Pow(x, n)](https://leetcode.com/problems/powx-n) | [Go](https://github.com/openset/leetcode/tree/master/problems/powx-n) | Medium | | <span id="51">51</span> | [N-Queens](https://leetcode.com/problems/n-queens) | [Go](https://github.com/openset/leetcode/tree/master/problems/n-queens) | Hard | | <span id="52">52</span> | [N-Queens II](https://leetcode.com/problems/n-queens-ii) | [Go](https://github.com/openset/leetcode/tree/master/problems/n-queens-ii) | Hard | | <span id="53">53</span> | [Maximum Subarray](https://leetcode.com/problems/maximum-subarray) | [Go](https://github.com/openset/leetcode/tree/master/problems/maximum-subarray) | Easy | | <span id="54">54</span> | [Spiral Matrix](https://leetcode.com/problems/spiral-matrix) | [Go](https://github.com/openset/leetcode/tree/master/problems/spiral-matrix) | Medium | | <span id="55">55</span> | [Jump Game](https://leetcode.com/problems/jump-game) | [Go](https://github.com/openset/leetcode/tree/master/problems/jump-game) | Medium | | <span id="56">56</span> | [Merge Intervals](https://leetcode.com/problems/merge-intervals) | [Go](https://github.com/openset/leetcode/tree/master/problems/merge-intervals) | Medium | | <span id="57">57</span> | [Insert Interval](https://leetcode.com/problems/insert-interval) | [Go](https://github.com/openset/leetcode/tree/master/problems/insert-interval) | Hard | | <span id="58">58</span> | [Length of Last Word](https://leetcode.com/problems/length-of-last-word) | [Go](https://github.com/openset/leetcode/tree/master/problems/length-of-last-word) | Easy | | <span id="59">59</span> | [Spiral Matrix II](https://leetcode.com/problems/spiral-matrix-ii) | [Go](https://github.com/openset/leetcode/tree/master/problems/spiral-matrix-ii) | Medium | | <span id="60">60</span> | [Permutation Sequence](https://leetcode.com/problems/permutation-sequence) | [Go](https://github.com/openset/leetcode/tree/master/problems/permutation-sequence) | Medium | | <span id="61">61</span> | [Rotate List](https://leetcode.com/problems/rotate-list) | [Go](https://github.com/openset/leetcode/tree/master/problems/rotate-list) | Medium | | <span id="62">62</span> | [Unique Paths](https://leetcode.com/problems/unique-paths) | [Go](https://github.com/openset/leetcode/tree/master/problems/unique-paths) | Medium | | <span id="63">63</span> | [Unique Paths II](https://leetcode.com/problems/unique-paths-ii) | [Go](https://github.com/openset/leetcode/tree/master/problems/unique-paths-ii) | Medium | | <span id="64">64</span> | [Minimum Path Sum](https://leetcode.com/problems/minimum-path-sum) | [Go](https://github.com/openset/leetcode/tree/master/problems/minimum-path-sum) | Medium | | <span id="65">65</span> | [Valid Number](https://leetcode.com/problems/valid-number) | [Go](https://github.com/openset/leetcode/tree/master/problems/valid-number) | Hard | | <span id="66">66</span> | [Plus One](https://leetcode.com/problems/plus-one) | [Go](https://github.com/openset/leetcode/tree/master/problems/plus-one) | Easy | | <span id="67">67</span> | [Add Binary](https://leetcode.com/problems/add-binary) | [Go](https://github.com/openset/leetcode/tree/master/problems/add-binary) | Easy | | <span id="68">68</span> | [Text Justification](https://leetcode.com/problems/text-justification) | [Go](https://github.com/openset/leetcode/tree/master/problems/text-justification) | Hard | | <span id="69">69</span> | [Sqrt(x)](https://leetcode.com/problems/sqrtx) | [Go](https://github.com/openset/leetcode/tree/master/problems/sqrtx) | Easy | | <span id="70">70</span> | [Climbing Stairs](https://leetcode.com/problems/climbing-stairs) | [Go](https://github.com/openset/leetcode/tree/master/problems/climbing-stairs) | Easy | | <span id="71">71</span> | [Simplify Path](https://leetcode.com/problems/simplify-path) | [Go](https://github.com/openset/leetcode/tree/master/problems/simplify-path) | Medium | | <span id="72">72</span> | [Edit Distance](https://leetcode.com/problems/edit-distance) | [Go](https://github.com/openset/leetcode/tree/master/problems/edit-distance) | Hard | | <span id="73">73</span> | [Set Matrix Zeroes](https://leetcode.com/problems/set-matrix-zeroes) | [Go](https://github.com/openset/leetcode/tree/master/problems/set-matrix-zeroes) | Medium | | <span id="74">74</span> | [Search a 2D Matrix](https://leetcode.com/problems/search-a-2d-matrix) | [Go](https://github.com/openset/leetcode/tree/master/problems/search-a-2d-matrix) | Medium | | <span id="75">75</span> | [Sort Colors](https://leetcode.com/problems/sort-colors) | [Go](https://github.com/openset/leetcode/tree/master/problems/sort-colors) | Medium | | <span id="76">76</span> | [Minimum Window Substring](https://leetcode.com/problems/minimum-window-substring) | [Go](https://github.com/openset/leetcode/tree/master/problems/minimum-window-substring) | Hard | | <span id="77">77</span> | [Combinations](https://leetcode.com/problems/combinations) | [Go](https://github.com/openset/leetcode/tree/master/problems/combinations) | Medium | | <span id="78">78</span> | [Subsets](https://leetcode.com/problems/subsets) | [Go](https://github.com/openset/leetcode/tree/master/problems/subsets) | Medium | | <span id="79">79</span> | [Word Search](https://leetcode.com/problems/word-search) | [Go](https://github.com/openset/leetcode/tree/master/problems/word-search) | Medium | | <span id="80">80</span> | [Remove Duplicates from Sorted Array II](https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii) | [Go](https://github.com/openset/leetcode/tree/master/problems/remove-duplicates-from-sorted-array-ii) | Medium | | <span id="81">81</span> | [Search in Rotated Sorted Array II](https://leetcode.com/problems/search-in-rotated-sorted-array-ii) | [Go](https://github.com/openset/leetcode/tree/master/problems/search-in-rotated-sorted-array-ii) | Medium | | <span id="82">82</span> | [Remove Duplicates from Sorted List II](https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii) | [Go](https://github.com/openset/leetcode/tree/master/problems/remove-duplicates-from-sorted-list-ii) | Medium | | <span id="83">83</span> | [Remove Duplicates from Sorted List](https://leetcode.com/problems/remove-duplicates-from-sorted-list) | [Go](https://github.com/openset/leetcode/tree/master/problems/remove-duplicates-from-sorted-list) | Easy | | <span id="84">84</span> | [Largest Rectangle in Histogram](https://leetcode.com/problems/largest-rectangle-in-histogram) | [Go](https://github.com/openset/leetcode/tree/master/problems/largest-rectangle-in-histogram) | Hard | | <span id="85">85</span> | [Maximal Rectangle](https://leetcode.com/problems/maximal-rectangle) | [Go](https://github.com/openset/leetcode/tree/master/problems/maximal-rectangle) | Hard | | <span id="86">86</span> | [Partition List](https://leetcode.com/problems/partition-list) | [Go](https://github.com/openset/leetcode/tree/master/problems/partition-list) | Medium | | <span id="87">87</span> | [Scramble String](https://leetcode.com/problems/scramble-string) | [Go](https://github.com/openset/leetcode/tree/master/problems/scramble-string) | Hard | | <span id="88">88</span> | [Merge Sorted Array](https://leetcode.com/problems/merge-sorted-array) | [Go](https://github.com/openset/leetcode/tree/master/problems/merge-sorted-array) | Easy | | <span id="89">89</span> | [Gray Code](https://leetcode.com/problems/gray-code) | [Go](https://github.com/openset/leetcode/tree/master/problems/gray-code) | Medium | | <span id="90">90</span> | [Subsets II](https://leetcode.com/problems/subsets-ii) | [Go](https://github.com/openset/leetcode/tree/master/problems/subsets-ii) | Medium | | <span id="91">91</span> | [Decode Ways](https://leetcode.com/problems/decode-ways) | [Go](https://github.com/openset/leetcode/tree/master/problems/decode-ways) | Medium | | <span id="92">92</span> | [Reverse Linked List II](https://leetcode.com/problems/reverse-linked-list-ii) | [Go](https://github.com/openset/leetcode/tree/master/problems/reverse-linked-list-ii) | Medium | | <span id="93">93</span> | [Restore IP Addresses](https://leetcode.com/problems/restore-ip-addresses) | [Go](https://github.com/openset/leetcode/tree/master/problems/restore-ip-addresses) | Medium | | <span id="94">94</span> | [Binary Tree Inorder Traversal](https://leetcode.com/problems/binary-tree-inorder-traversal) | [Go](https://github.com/openset/leetcode/tree/master/problems/binary-tree-inorder-traversal) | Medium | | <span id="95">95</span> | [Unique Binary Search Trees II](https://leetcode.com/problems/unique-binary-search-trees-ii) | [Go](https://github.com/openset/leetcode/tree/master/problems/unique-binary-search-trees-ii) | Medium | | <span id="96">96</span> | [Unique Binary Search Trees](https://leetcode.com/problems/unique-binary-search-trees) | [Go](https://github.com/openset/leetcode/tree/master/problems/unique-binary-search-trees) | Medium | | <span id="97">97</span> | [Interleaving String](https://leetcode.com/problems/interleaving-string) | [Go](https://github.com/openset/leetcode/tree/master/problems/interleaving-string) | Hard | | <span id="98">98</span> | [Validate Binary Search Tree](https://leetcode.com/problems/validate-binary-search-tree) | [Go](https://github.com/openset/leetcode/tree/master/problems/validate-binary-search-tree) | Medium | | <span id="99">99</span> | [Recover Binary Search Tree](https://leetcode.com/problems/recover-binary-search-tree) | [Go](https://github.com/openset/leetcode/tree/master/problems/recover-binary-search-tree) | Hard | | <span id="100">100</span> | [Same Tree](https://leetcode.com/problems/same-tree) | [Go](https://github.com/openset/leetcode/tree/master/problems/same-tree) | Easy | ...... --- 欢迎各位同学Star、提交Pr、反馈问题。 [[阅读原文](https://openset.github.io/leetcode)]

有疑问加站长微信联系(非本文作者))

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

1427 次点击  ∙  1 赞  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传