diff --git a/.gitmodules b/.gitmodules index 75c212a..da34c03 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "Catch"] path = Catch - url = https://github.com/philsquared/Catch + url = https://github.com/catchorg/Catch2 diff --git a/000. Two Sum/README.md b/000. Two Sum/README.md new file mode 100644 index 0000000..28825ed --- /dev/null +++ b/000. Two Sum/README.md @@ -0,0 +1,18 @@ +# 思路(C++) + +好久没登录 LeetCode, 今天一登录,发现 No. 1 的题目都没做。惭愧,而且还是个 Easy 的。 +于是决定顺手解决了。 + +另外,LeetCode 现在有 711 道题了,当初我按照从易到难排序也逐步有些过时了。早知道还不如按照编号顺序来解题呢。这样一天容易一天难的,还挺好玩。 + +---- + +这道题有点像找配对。找到 `a`,找到 `b`,让 `a + b = target`。那么肯定得遍历,遍历的过程中,记录什么,成了思考的关键。 + +既然是配对,那么 kv 结构是非常合适的,于是上了 Hash 表。让 key 就是要找的 `b`,让 value 记录 `a` 的 index,也就是结果需要的索引。 + +这样思路就很简单明了了。 + +## Python + +基本与 C++ 的思路一致,只不过更简洁了。 \ No newline at end of file diff --git a/000. Two Sum/TEST.cc b/000. Two Sum/TEST.cc new file mode 100644 index 0000000..27251cd --- /dev/null +++ b/000. Two Sum/TEST.cc @@ -0,0 +1,17 @@ +#define CATCH_CONFIG_MAIN +#include "../Catch/single_include/catch.hpp" +#include "solution.h" + +TEST_CASE("Two Sum", "twoSum") +{ + Solution s; + + std::vector v1{2, 7, 11, 15}; + REQUIRE( (s.twoSum(v1, 9) == std::vector{0, 1}) ); + + std::vector v2{0, 4, 3, 0}; + REQUIRE( (s.twoSum(v2, 0) == std::vector{0, 3}) ); + + std::vector v3{-3, 4, 3, 90}; + REQUIRE( (s.twoSum(v3, 0) == std::vector{0, 2}) ); +} diff --git a/000. Two Sum/solution.h b/000. Two Sum/solution.h new file mode 100644 index 0000000..50b5d03 --- /dev/null +++ b/000. Two Sum/solution.h @@ -0,0 +1,18 @@ +#include +using std::vector; +#include +using std::unordered_map; + +class Solution { +public: + vector twoSum(vector& nums, int target) { + std::unordered_map record; + for (int i = 0; i != nums.size(); ++i) { + auto found = record.find(nums[i]); + if (found != record.end()) + return {found->second, i}; + record.emplace(target - nums[i], i); + } + return {-1, -1}; + } +}; \ No newline at end of file diff --git a/000. Two Sum/solution.py b/000. Two Sum/solution.py new file mode 100644 index 0000000..bd6c0b9 --- /dev/null +++ b/000. Two Sum/solution.py @@ -0,0 +1,24 @@ +#!python3 + + +class Solution: + def twoSum(self, nums, target): + """ + :type nums: List[int] + :type target: int + :rtype: List[int] + """ + dic = {} + for index, num in enumerate(nums): + if num in dic: + return [dic[num], index] + dic[target - num] = index + + +if __name__ == "__main__": + nums = [2, 7, 11, 15] + target = 9 + assert (Solution().twoSum(nums, target) == [0, 1]) + nums = [3, 2, 4] + target = 6 + assert (Solution().twoSum(nums, target) == [1, 2]) diff --git a/001. Add Two Numbers/README.md b/001. Add Two Numbers/README.md new file mode 100644 index 0000000..364b546 --- /dev/null +++ b/001. Add Two Numbers/README.md @@ -0,0 +1,43 @@ +# 思路(C++) + +这道题让我想起之前的 [Add Binary](../066.%20Add%20Binary). 思想几乎类似,难点在于**进位**。 + +其次,这种关系到两个链表的问题,dummy 节点应该是必不可少的了。 + +以上两点,便是这道题的核心。私以为,本题难度应为 Easy. + +----- + +具体说一下进位的事情。 + +STL 有一个专门的结构体叫做 `div_t`, 其包含两个成员,分别是 quot(quotient) 与 rem(remainder). 用来做什么,从命名上是否可以看出一点端倪呢? + +举例说明. + + 38 / 5 == 7 remainder 3 + +用 C++ 来描述,便是: + + div_t result = div(38, 5); + cout << result.quot << result.rem; + +前者为被除后的结果,后者为余数。 + +----- + +与这道题的关系是? + +本题的进位是基于十进制的,故两个节点相加之后的值,应判断是否超出了10,超出需要进位,留下的是余数。即,做了 div 操作后。sum.rem 是新链表的当前节点,sum.quot 是下一次加法运算的进位。 + +有: + +```cpp +if (l1) { sum.quot += l1->val; l1 = l1->next; } // 进位 + l1 +if (l2) { sum.quot += l2->val; l2 = l2->next; } // 进位 + l1 + l2 +sum = div(sum.quot, 10); // 除 10 操作,得到新的 quot 与 rem. +tail->next = new ListNode(sum.rem); // rem 为节点值, quot 留作下次迭代 +``` + +## Python + +STL 里的 `div` 方法对应 Python 里的 [`divmod`](https://docs.python.org/3/library/functions.html#divmod). 其等同于 (a // b, a % b). 其余的思路一致,不过 Python 里似乎不方便取地址直接修改内存,只好用傀儡节点的方法替代。 \ No newline at end of file diff --git a/102. Add Two Numbers/main.cpp b/001. Add Two Numbers/main.cpp similarity index 100% rename from 102. Add Two Numbers/main.cpp rename to 001. Add Two Numbers/main.cpp diff --git a/102. Add Two Numbers/solution.h b/001. Add Two Numbers/solution.h similarity index 100% rename from 102. Add Two Numbers/solution.h rename to 001. Add Two Numbers/solution.h diff --git a/001. Add Two Numbers/solution.py b/001. Add Two Numbers/solution.py new file mode 100644 index 0000000..49dacf4 --- /dev/null +++ b/001. Add Two Numbers/solution.py @@ -0,0 +1,54 @@ +#!python3 + + +# Definition for singly-linked list. +class ListNode: + def __init__(self, x): + self.val = x + self.next = None + + +class Solution: + def addTwoNumbers(self, l1, l2): + """ + :type l1: ListNode + :type l2: ListNode + :rtype: ListNode + """ + head = ListNode(0) + p = head + quot = 0 + while l1 or l2 or quot != 0: + if l1: + quot += l1.val + l1 = l1.next + if l2: + quot += l2.val + l2 = l2.next + quot, rem = divmod(quot, 10) + p.next = ListNode(rem) + p = p.next + + return head.next + + +def compareLinkedList(l1, l2): + while l1 or l2: + if not (l1 and l2) or l1.val != l2.val: + return False + l1 = l1.next + l2 = l2.next + return True + + +if __name__ == "__main__": + l1 = ListNode(2) + l1.next = ListNode(4) + l1.next.next = ListNode(3) + l2 = ListNode(5) + l2.next = ListNode(6) + l2.next.next = ListNode(4) + lsum = ListNode(7) + lsum.next = ListNode(0) + lsum.next.next = ListNode(8) + print(compareLinkedList(Solution().addTwoNumbers(l1, l2), lsum)) diff --git a/109. Longest Substring Without Repeating Characters/README.md b/002. Longest Substring Without Repeating Characters/README.md similarity index 61% rename from 109. Longest Substring Without Repeating Characters/README.md rename to 002. Longest Substring Without Repeating Characters/README.md index 224b0b8..2d12d03 100644 --- a/109. Longest Substring Without Repeating Characters/README.md +++ b/002. Longest Substring Without Repeating Characters/README.md @@ -1,9 +1,19 @@ +# 思路(C++) + +此题需要好好读懂题意:**没有重复字符**的最长子字符串的**长度**。 + +首先,求的只是长度,那么一定有一个 trace 来边记录边比较(max)。 +其次,没有重复字符几乎是唯一条件,那么检查重复显然用 k-v mapping. +最后,要考虑一次迭代过程中,如何度量这个长度。 + +---- + 设 substr 的起点为 start(s), 终点为 last(l). 每一次迭代,记录一张索引表。 abcabcbb ^ ^ s l - + |char|pos| |:--:|:-:| | a | 0 | @@ -25,7 +35,6 @@ cache[s[last]] = last; 注意最终还需要比较一次,返回 `max(ret, s.size() - start)` +## Python - - - +思路与 C++ 完全一致。 \ No newline at end of file diff --git a/109. Longest Substring Without Repeating Characters/TEST.cc b/002. Longest Substring Without Repeating Characters/TEST.cc similarity index 100% rename from 109. Longest Substring Without Repeating Characters/TEST.cc rename to 002. Longest Substring Without Repeating Characters/TEST.cc diff --git a/002. Longest Substring Without Repeating Characters/solution.h b/002. Longest Substring Without Repeating Characters/solution.h new file mode 100644 index 0000000..a614b1e --- /dev/null +++ b/002. Longest Substring Without Repeating Characters/solution.h @@ -0,0 +1,23 @@ +#include +using std::string; +#include +using std::unordered_map; +#include +using std::max; + +class Solution { +public: + int lengthOfLongestSubstring(string s) { + size_t ret = 0, start = 0; + unordered_map trace; + for (size_t i = 0; i < s.size(); ++i) { + auto found = trace.find(s[i]); + if (found != trace.end() && found->second >= start) { + ret = max(ret, i - start); + start = found->second + 1; + } + trace[s[i]] = i; + } + return max(ret, s.size() - start); + } +}; diff --git a/002. Longest Substring Without Repeating Characters/solution.py b/002. Longest Substring Without Repeating Characters/solution.py new file mode 100644 index 0000000..ee98a44 --- /dev/null +++ b/002. Longest Substring Without Repeating Characters/solution.py @@ -0,0 +1,24 @@ +#!python3 + + +class Solution: + def lengthOfLongestSubstring(self, s): + """ + :type s: str + :rtype: int + """ + rlen = 0 + start = 0 + trace = {} + for index, ch in enumerate(s): + if ch in trace and trace[ch] >= start: + rlen = max(rlen, index - start) + start = trace[ch] + 1 + trace[ch] = index + return max(rlen, len(s) - start) + + +if __name__ == "__main__": + print(Solution().lengthOfLongestSubstring("abcabcbb") == 3) + print(Solution().lengthOfLongestSubstring("abba") == 2) + print(Solution().lengthOfLongestSubstring("pwwkew") == 3) diff --git a/119. Longest Palindromic Substring/README.md b/004. Longest Palindromic Substring/README.md similarity index 100% rename from 119. Longest Palindromic Substring/README.md rename to 004. Longest Palindromic Substring/README.md diff --git a/119. Longest Palindromic Substring/TEST.cc b/004. Longest Palindromic Substring/TEST.cc similarity index 100% rename from 119. Longest Palindromic Substring/TEST.cc rename to 004. Longest Palindromic Substring/TEST.cc diff --git a/119. Longest Palindromic Substring/solution.h b/004. Longest Palindromic Substring/solution.h similarity index 100% rename from 119. Longest Palindromic Substring/solution.h rename to 004. Longest Palindromic Substring/solution.h diff --git a/099. ZigZag Conversion/README.md b/005. ZigZag Conversion/README.md similarity index 100% rename from 099. ZigZag Conversion/README.md rename to 005. ZigZag Conversion/README.md diff --git a/099. ZigZag Conversion/TEST.cc b/005. ZigZag Conversion/TEST.cc similarity index 100% rename from 099. ZigZag Conversion/TEST.cc rename to 005. ZigZag Conversion/TEST.cc diff --git a/099. ZigZag Conversion/solution.h b/005. ZigZag Conversion/solution.h similarity index 100% rename from 099. ZigZag Conversion/solution.h rename to 005. ZigZag Conversion/solution.h diff --git a/004. Reverse Integer/README.md b/006. Reverse Integer/README.md similarity index 100% rename from 004. Reverse Integer/README.md rename to 006. Reverse Integer/README.md diff --git a/004. Reverse Integer/main.cpp b/006. Reverse Integer/main.cpp similarity index 100% rename from 004. Reverse Integer/main.cpp rename to 006. Reverse Integer/main.cpp diff --git a/004. Reverse Integer/solution.h b/006. Reverse Integer/solution.h similarity index 100% rename from 004. Reverse Integer/solution.h rename to 006. Reverse Integer/solution.h diff --git a/057. Palindrome Number/README.md b/008. Palindrome Number/README.md similarity index 100% rename from 057. Palindrome Number/README.md rename to 008. Palindrome Number/README.md diff --git a/057. Palindrome Number/TEST.cc b/008. Palindrome Number/TEST.cc similarity index 100% rename from 057. Palindrome Number/TEST.cc rename to 008. Palindrome Number/TEST.cc diff --git a/057. Palindrome Number/solution.h b/008. Palindrome Number/solution.h similarity index 100% rename from 057. Palindrome Number/solution.h rename to 008. Palindrome Number/solution.h diff --git a/009. Regular Expression Matching/README.md b/009. Regular Expression Matching/README.md new file mode 100644 index 0000000..582e0ef --- /dev/null +++ b/009. Regular Expression Matching/README.md @@ -0,0 +1,51 @@ +讨厌这种不清不楚的题目。 + +`.` 代表任意单字符,`*` 可以代表将前面的字符去掉,也可以代表是对前面字符的重复(数目无限)。 + +下面分析题目中给出的例子: + + aa a // 不匹配,很明显 + aa aa // 匹配,也很明显 + aaa aa // 不匹配 + aa a* // 匹配,* 可以重复为a + aa .* // 匹配,. 可以是 a, * 可以重复 a。 + ab .* // 匹配,等等,不对啊,什么玩意。先放一放。 + aab c*a*b // 匹配,第一个 * 可以是 0,剩下 a*b,* 可以是 a 的重复,则 aab 匹配。 + +貌似唯一的疑问出在 `ab .*` 的匹配上。这个我也困惑了好久好久。无奈之下查看了[讨论](https://leetcode.com/discuss/4514/ismatch-ab-%E2%86%92-true-why-ab-c-expected-false) + +摘录让我醍醐灌顶的解释: + +> `.*` means zero or any occurrence of `.`, which can be (no dot at all), `.`, `..`, `...`, etc. `aab` matches `...`, which is one of the possible meanings of `.*`, `ab` matches `..` which is another possible meaning of `.*`. So `isMatch("ab",".*") = isMatch("aab", ".*") = True`. + +> So in short, `.*` can match any string. + +> One step further, `.*c` matches any string ending with `c`, which does not include `ab`. So `isMatch("ab", ".*c") = False` + +> ----- +> by @MoonKnight + +是否看明白了呢?`.*`中 `*` 重复的并不是某一个特定的字符,而是 `.` 本身。所以 `.*` 可以是 `..`。 +这样一来,第一个`.`匹配`a`,第二个`.`匹配`b`。这不就与`ab`匹配上了吗? + +再往远了想一想,`.*` 可以匹配任意字符串啊。(本质在于咱们脑子里规定了一个与出题人不一致的顺序,我们认为要先确定`.`,然后再去看 `*`。) + +说这题不清不楚,没说错吧。如果你一开始就能会意,恭喜你了。 + +----- + +我的思路是,要判断字符串,肯定要从字符开始。这就简化了问题,比较两个字符是否匹配很容易。 + +```cpp +// char s,p; +if (s == p || (p == '.' && s != '\0')) // same character. +``` + +首先,迭代 `p`,如果 `*p == '\0'`,那么可以直接返回 `return *s == '\0';` + +其次,判断后面有没有跟`*`,即 `if (p[1] != '*')` 那么就正常比较当前字符。若跟了 `*`, +则与判断 `isMatch(s, p+2)` 无异。(因为 `*` 可以代表0) + +最后,一旦出现不同字符,直接返回 `false`。 + +代码很简单,5行搞定。 diff --git a/009. Regular Expression Matching/TEST.cc b/009. Regular Expression Matching/TEST.cc new file mode 100644 index 0000000..193e932 --- /dev/null +++ b/009. Regular Expression Matching/TEST.cc @@ -0,0 +1,16 @@ +#define CATCH_CONFIG_MAIN +#include "../Catch/single_include/catch.hpp" +#include "solution.h" + +TEST_CASE("Regular Expression Matching", "isMatch") +{ + Solution s; + + REQUIRE_FALSE(s.isMatch("aa", "a")); + REQUIRE(s.isMatch("aa", "aa")); + REQUIRE_FALSE(s.isMatch("aaa", "aa")); + REQUIRE(s.isMatch("aa", "a*")); + REQUIRE(s.isMatch("aa", ".*")); + REQUIRE(s.isMatch("ab", ".*")); + REQUIRE(s.isMatch("aab", "c*a*b")); +} diff --git a/009. Regular Expression Matching/solution.h b/009. Regular Expression Matching/solution.h new file mode 100644 index 0000000..3d42731 --- /dev/null +++ b/009. Regular Expression Matching/solution.h @@ -0,0 +1,11 @@ +class Solution { +public: + bool isMatch(const char *s, const char *p) { + for (char c=*p; c != '\0'; ++s, c=*p) { + if (p[1] != '*') ++p; + else if (isMatch(s, p+2)) return true; + if (!(c == *s || (c == '.' && *s != '\0'))) return false; + } + return *s == '\0'; + } +}; diff --git a/033. Container With Most Water/README.md b/010. Container With Most Water/README.md similarity index 100% rename from 033. Container With Most Water/README.md rename to 010. Container With Most Water/README.md diff --git a/033. Container With Most Water/main.cc b/010. Container With Most Water/main.cc similarity index 100% rename from 033. Container With Most Water/main.cc rename to 010. Container With Most Water/main.cc diff --git a/033. Container With Most Water/solution.h b/010. Container With Most Water/solution.h similarity index 100% rename from 033. Container With Most Water/solution.h rename to 010. Container With Most Water/solution.h diff --git a/017. Integer to Roman/README.md b/011. Integer to Roman/README.md similarity index 100% rename from 017. Integer to Roman/README.md rename to 011. Integer to Roman/README.md diff --git a/017. Integer to Roman/TEST.cc b/011. Integer to Roman/TEST.cc similarity index 100% rename from 017. Integer to Roman/TEST.cc rename to 011. Integer to Roman/TEST.cc diff --git a/017. Integer to Roman/solution.h b/011. Integer to Roman/solution.h similarity index 100% rename from 017. Integer to Roman/solution.h rename to 011. Integer to Roman/solution.h diff --git a/016. Roman to Integer/README.md b/012. Roman to Integer/README.md similarity index 100% rename from 016. Roman to Integer/README.md rename to 012. Roman to Integer/README.md diff --git a/016. Roman to Integer/TEST.cc b/012. Roman to Integer/TEST.cc similarity index 100% rename from 016. Roman to Integer/TEST.cc rename to 012. Roman to Integer/TEST.cc diff --git a/016. Roman to Integer/solution.h b/012. Roman to Integer/solution.h similarity index 100% rename from 016. Roman to Integer/solution.h rename to 012. Roman to Integer/solution.h diff --git a/070. Longest Common Prefix/README.md b/013. Longest Common Prefix/README.md similarity index 100% rename from 070. Longest Common Prefix/README.md rename to 013. Longest Common Prefix/README.md diff --git a/070. Longest Common Prefix/TEST.cc b/013. Longest Common Prefix/TEST.cc similarity index 100% rename from 070. Longest Common Prefix/TEST.cc rename to 013. Longest Common Prefix/TEST.cc diff --git a/070. Longest Common Prefix/solution.h b/013. Longest Common Prefix/solution.h similarity index 100% rename from 070. Longest Common Prefix/solution.h rename to 013. Longest Common Prefix/solution.h diff --git a/014. Maximum Subarray/README.md b/014. Maximum Subarray/README.md deleted file mode 100644 index 72e6077..0000000 --- a/014. Maximum Subarray/README.md +++ /dev/null @@ -1,32 +0,0 @@ -这道题我一看到,我就想到了我的最爱——**[贪心算法](http://zh.wikipedia.org/wiki/%E8%B4%AA%E5%BF%83%E6%B3%95)**,太典型了好么。 -求拥有最大**和**的子序列,那么秉承贪心原则,假设初始解为A[0],那么我增加一个元素(A[1]),我就需要考虑,我的利益是多了,还是损失了。 -由于题意要求,子序列至少要连续,所以没可能跳过 A[1], 只有两个选择: - -1. A[0] + A[1] -2. A[1] - -说白了,就是,要么容纳新文化(改良派),要么重新开始(革命派)。哪一种可以带来最大利益,就选择哪一种。(因为人类社会也是连续的) - -但这里,如果发生了革命,就会产生断链。把镜头拉远,从整条历史长河去看,每一条链子,哪一条最长呢?至少你得记录下巅峰的最大利益吧? - -根据上述两条原则,我们写下了我们的算法: -```cpp -benefited = max(A[i], benefited + A[i]); -maxv = max(benefited, maxv); -``` - -聪明的你一定发现了,第一句条恰是**当权者的决策**,第二条恰是**历史学家的总结**。 横批:人类是贪婪的。 - -所以不要怪任何一方,从他们的立场看,都是最优解。局部最优能否导致整体最优呢? 千年谜题。 - ------- - -题目比较基础,扯了点政治与历史。谁说计算机与人文不是密切相关的。。。 - ------- - -另外,该题下面说到 More practice, 提到要用分治法?我没什么思路,请明白者提点。 - ->If you have figured out the O(n) solution, try coding another solution using the divide and conquer approach, which is more subtle - -咳咳咳, @Mooophy ,该出来了。。。 diff --git a/073. 3Sum Closest/README.md b/015. 3Sum Closest/README.md similarity index 100% rename from 073. 3Sum Closest/README.md rename to 015. 3Sum Closest/README.md diff --git a/073. 3Sum Closest/TEST.cc b/015. 3Sum Closest/TEST.cc similarity index 100% rename from 073. 3Sum Closest/TEST.cc rename to 015. 3Sum Closest/TEST.cc diff --git a/073. 3Sum Closest/solution.h b/015. 3Sum Closest/solution.h similarity index 100% rename from 073. 3Sum Closest/solution.h rename to 015. 3Sum Closest/solution.h diff --git a/080. Letter Combinations of a Phone Number/README.md b/016. Letter Combinations of a Phone Number/README.md similarity index 100% rename from 080. Letter Combinations of a Phone Number/README.md rename to 016. Letter Combinations of a Phone Number/README.md diff --git a/080. Letter Combinations of a Phone Number/main.cpp b/016. Letter Combinations of a Phone Number/main.cpp similarity index 100% rename from 080. Letter Combinations of a Phone Number/main.cpp rename to 016. Letter Combinations of a Phone Number/main.cpp diff --git a/080. Letter Combinations of a Phone Number/solution.h b/016. Letter Combinations of a Phone Number/solution.h similarity index 100% rename from 080. Letter Combinations of a Phone Number/solution.h rename to 016. Letter Combinations of a Phone Number/solution.h diff --git a/112. 4Sum/README.md b/017. 4Sum/README.md similarity index 100% rename from 112. 4Sum/README.md rename to 017. 4Sum/README.md diff --git a/112. 4Sum/main.cpp b/017. 4Sum/main.cpp similarity index 100% rename from 112. 4Sum/main.cpp rename to 017. 4Sum/main.cpp diff --git a/112. 4Sum/solution.h b/017. 4Sum/solution.h similarity index 100% rename from 112. 4Sum/solution.h rename to 017. 4Sum/solution.h diff --git a/053. Remove Nth Node from End of List/README.md b/018. Remove Nth Node from End of List/README.md similarity index 100% rename from 053. Remove Nth Node from End of List/README.md rename to 018. Remove Nth Node from End of List/README.md diff --git a/053. Remove Nth Node from End of List/main.cc b/018. Remove Nth Node from End of List/main.cc similarity index 100% rename from 053. Remove Nth Node from End of List/main.cc rename to 018. Remove Nth Node from End of List/main.cc diff --git a/053. Remove Nth Node from End of List/solution.h b/018. Remove Nth Node from End of List/solution.h similarity index 100% rename from 053. Remove Nth Node from End of List/solution.h rename to 018. Remove Nth Node from End of List/solution.h diff --git a/059. Valid Parentheses/README.md b/019. Valid Parentheses/README.md similarity index 100% rename from 059. Valid Parentheses/README.md rename to 019. Valid Parentheses/README.md diff --git a/059. Valid Parentheses/TEST.cc b/019. Valid Parentheses/TEST.cc similarity index 100% rename from 059. Valid Parentheses/TEST.cc rename to 019. Valid Parentheses/TEST.cc diff --git a/059. Valid Parentheses/solution.h b/019. Valid Parentheses/solution.h similarity index 100% rename from 059. Valid Parentheses/solution.h rename to 019. Valid Parentheses/solution.h diff --git a/019. Merge Two Sorted Lists/README.md b/020. Merge Two Sorted Lists/README.md similarity index 100% rename from 019. Merge Two Sorted Lists/README.md rename to 020. Merge Two Sorted Lists/README.md diff --git a/019. Merge Two Sorted Lists/TEST.cc b/020. Merge Two Sorted Lists/TEST.cc similarity index 100% rename from 019. Merge Two Sorted Lists/TEST.cc rename to 020. Merge Two Sorted Lists/TEST.cc diff --git a/019. Merge Two Sorted Lists/solution.h b/020. Merge Two Sorted Lists/solution.h similarity index 100% rename from 019. Merge Two Sorted Lists/solution.h rename to 020. Merge Two Sorted Lists/solution.h diff --git a/031. Generate Parentheses/README.md b/021. Generate Parentheses/README.md similarity index 100% rename from 031. Generate Parentheses/README.md rename to 021. Generate Parentheses/README.md diff --git a/031. Generate Parentheses/main.cc b/021. Generate Parentheses/main.cc similarity index 100% rename from 031. Generate Parentheses/main.cc rename to 021. Generate Parentheses/main.cc diff --git a/031. Generate Parentheses/solution.h b/021. Generate Parentheses/solution.h similarity index 100% rename from 031. Generate Parentheses/solution.h rename to 021. Generate Parentheses/solution.h diff --git a/115. Merge k Sorted Lists/README.md b/022. Merge k Sorted Lists/README.md similarity index 100% rename from 115. Merge k Sorted Lists/README.md rename to 022. Merge k Sorted Lists/README.md diff --git a/115. Merge k Sorted Lists/main.cpp b/022. Merge k Sorted Lists/main.cpp similarity index 100% rename from 115. Merge k Sorted Lists/main.cpp rename to 022. Merge k Sorted Lists/main.cpp diff --git a/115. Merge k Sorted Lists/solution.h b/022. Merge k Sorted Lists/solution.h similarity index 100% rename from 115. Merge k Sorted Lists/solution.h rename to 022. Merge k Sorted Lists/solution.h diff --git a/091. Reverse Nodes in k-Group/README.md b/024. Reverse Nodes in k-Group/README.md similarity index 100% rename from 091. Reverse Nodes in k-Group/README.md rename to 024. Reverse Nodes in k-Group/README.md diff --git a/091. Reverse Nodes in k-Group/main.cpp b/024. Reverse Nodes in k-Group/main.cpp similarity index 100% rename from 091. Reverse Nodes in k-Group/main.cpp rename to 024. Reverse Nodes in k-Group/main.cpp diff --git a/091. Reverse Nodes in k-Group/solution.h b/024. Reverse Nodes in k-Group/solution.h similarity index 100% rename from 091. Reverse Nodes in k-Group/solution.h rename to 024. Reverse Nodes in k-Group/solution.h diff --git a/024. Remove Duplicates from Sorted Array/README.md b/025. Remove Duplicates from Sorted Array/README.md similarity index 100% rename from 024. Remove Duplicates from Sorted Array/README.md rename to 025. Remove Duplicates from Sorted Array/README.md diff --git a/024. Remove Duplicates from Sorted Array/TEST.cc b/025. Remove Duplicates from Sorted Array/TEST.cc similarity index 100% rename from 024. Remove Duplicates from Sorted Array/TEST.cc rename to 025. Remove Duplicates from Sorted Array/TEST.cc diff --git a/024. Remove Duplicates from Sorted Array/solution.h b/025. Remove Duplicates from Sorted Array/solution.h similarity index 100% rename from 024. Remove Duplicates from Sorted Array/solution.h rename to 025. Remove Duplicates from Sorted Array/solution.h diff --git a/020. Remove Element/README.md b/026. Remove Element/README.md similarity index 100% rename from 020. Remove Element/README.md rename to 026. Remove Element/README.md diff --git a/020. Remove Element/TEST.cc b/026. Remove Element/TEST.cc similarity index 100% rename from 020. Remove Element/TEST.cc rename to 026. Remove Element/TEST.cc diff --git a/020. Remove Element/solution.h b/026. Remove Element/solution.h similarity index 100% rename from 020. Remove Element/solution.h rename to 026. Remove Element/solution.h diff --git a/111. Implement strStr()/README.md b/027. Implement strStr()/README.md similarity index 100% rename from 111. Implement strStr()/README.md rename to 027. Implement strStr()/README.md diff --git a/111. Implement strStr()/TEST.cc b/027. Implement strStr()/TEST.cc similarity index 100% rename from 111. Implement strStr()/TEST.cc rename to 027. Implement strStr()/TEST.cc diff --git a/111. Implement strStr()/solution.h b/027. Implement strStr()/solution.h similarity index 100% rename from 111. Implement strStr()/solution.h rename to 027. Implement strStr()/solution.h diff --git a/089. Next Permutation/README.md b/030. Next Permutation/README.md similarity index 100% rename from 089. Next Permutation/README.md rename to 030. Next Permutation/README.md diff --git a/089. Next Permutation/main.cpp b/030. Next Permutation/main.cpp similarity index 100% rename from 089. Next Permutation/main.cpp rename to 030. Next Permutation/main.cpp diff --git a/089. Next Permutation/solution.h b/030. Next Permutation/solution.h similarity index 100% rename from 089. Next Permutation/solution.h rename to 030. Next Permutation/solution.h diff --git a/058. Search in Rotated Sorted Array/README.md b/032. Search in Rotated Sorted Array/README.md similarity index 100% rename from 058. Search in Rotated Sorted Array/README.md rename to 032. Search in Rotated Sorted Array/README.md diff --git a/058. Search in Rotated Sorted Array/TEST.cc b/032. Search in Rotated Sorted Array/TEST.cc similarity index 100% rename from 058. Search in Rotated Sorted Array/TEST.cc rename to 032. Search in Rotated Sorted Array/TEST.cc diff --git a/058. Search in Rotated Sorted Array/solution.h b/032. Search in Rotated Sorted Array/solution.h similarity index 100% rename from 058. Search in Rotated Sorted Array/solution.h rename to 032. Search in Rotated Sorted Array/solution.h diff --git a/033. Search for a Range/README.md b/033. Search for a Range/README.md new file mode 100644 index 0000000..5e72108 --- /dev/null +++ b/033. Search for a Range/README.md @@ -0,0 +1,42 @@ +这道题又是二分查找的变种。我因为时间有限,想出来的方法是最直接的。 + +首先先 init 一个 vector {-1,-1}, 这样如果没找到,直接返回无效值。 + +然后常规手法,二分查找,一旦找到,将 `vec[0] = vec[1] = mid`. + +由于咱们找的是一个范围,所以,仅需在这个位置上,前后扩展即可。 + +```cpp +while (vec[0]>0 && A[vec[0]-1] == target) + --vec[0]; +while (vec[1]{0, n-1}; +``` + +方法不惊艳,希望有更好解法的能告诉我。 + +----- + +在 [issue #11](https://github.com/pezy/LeetCode/issues/11) 中,@ender233 告诉了我一个更好的思路。 + +他的本质思想,是用三次**二分查找**来避免最坏情况。但后两次,皆为二分查找的变种,即查找的不是目标,而是目标应该插入的位置。 + +这个"变种"的二分查找我尝试写了一下,判断要多得多,而且写的很丑。智商捉急且懒散成性的情况下,我略改了一下思路: + +既然二分法可以从根本上将 O(n) 的情况减少到 O(logn) 的层次,那么三次二分与多次二分,差别其实并不大。(仍处于 O(logn) 的级别) + +那么: + +- 第一次二分,找到 target, 以及 `iPos`。 +- 接着二分左边 [0, iPos-1], 以及右边 [iPos+1, n-1]。依然找 target, 左边位置设为 `lo`(low), 右边位置设为 `hi`(high). +- 不断循环往左、右二分查找 target,直到找不到为止。那么此刻范围也就确定好了。 + +代码已更新。这样效率的确高,我去 LeetCode 试了一下,15ms, 属于 C++ 目前最高效率。 diff --git a/067. Search for a Range/TEST.cc b/033. Search for a Range/TEST.cc similarity index 100% rename from 067. Search for a Range/TEST.cc rename to 033. Search for a Range/TEST.cc diff --git a/033. Search for a Range/solution.h b/033. Search for a Range/solution.h new file mode 100644 index 0000000..dbdf4bd --- /dev/null +++ b/033. Search for a Range/solution.h @@ -0,0 +1,25 @@ +#include + +using std::vector; + +class Solution { + int binarySearch(int A[], int l, int r, int target) { + for (int mid; l <= r; ) { + mid = ( l + r ) >> 1; + if ( A[mid] < target ) l = mid + 1; + else if ( A[mid] > target ) r = mid - 1; + else return mid; + } + return -1; + } +public: + vector searchRange(int A[], int n, int target) { + int iPos = binarySearch( A, 0, n-1, target ), l = -1, r = -1; + if ( iPos != -1 ) { + l = r = iPos; + for (int lo = l; (lo = binarySearch(A, 0, lo-1, target)) != -1; l = lo ) ; + for (int hi = r; (hi = binarySearch(A, hi+1, n-1, target)) != -1; r = hi ) ; + } + return {l ,r}; + } +}; diff --git a/011. Search Insert Position/README.md b/034. Search Insert Position/README.md similarity index 100% rename from 011. Search Insert Position/README.md rename to 034. Search Insert Position/README.md diff --git a/011. Search Insert Position/main.cc b/034. Search Insert Position/main.cc similarity index 100% rename from 011. Search Insert Position/main.cc rename to 034. Search Insert Position/main.cc diff --git a/011. Search Insert Position/solution.h b/034. Search Insert Position/solution.h similarity index 100% rename from 011. Search Insert Position/solution.h rename to 034. Search Insert Position/solution.h diff --git a/064. Valid Sudoku/README.md b/035. Valid Sudoku/README.md similarity index 100% rename from 064. Valid Sudoku/README.md rename to 035. Valid Sudoku/README.md diff --git a/064. Valid Sudoku/main.cc b/035. Valid Sudoku/main.cc similarity index 100% rename from 064. Valid Sudoku/main.cc rename to 035. Valid Sudoku/main.cc diff --git a/064. Valid Sudoku/solution.h b/035. Valid Sudoku/solution.h similarity index 100% rename from 064. Valid Sudoku/solution.h rename to 035. Valid Sudoku/solution.h diff --git a/118. Sudoku Solver/README.md b/036. Sudoku Solver/README.md similarity index 100% rename from 118. Sudoku Solver/README.md rename to 036. Sudoku Solver/README.md diff --git a/118. Sudoku Solver/main.cpp b/036. Sudoku Solver/main.cpp similarity index 100% rename from 118. Sudoku Solver/main.cpp rename to 036. Sudoku Solver/main.cpp diff --git a/118. Sudoku Solver/solution.h b/036. Sudoku Solver/solution.h similarity index 100% rename from 118. Sudoku Solver/solution.h rename to 036. Sudoku Solver/solution.h diff --git a/069. Count and Say/README.md b/037. Count and Say/README.md similarity index 100% rename from 069. Count and Say/README.md rename to 037. Count and Say/README.md diff --git a/069. Count and Say/TEST.cc b/037. Count and Say/TEST.cc similarity index 100% rename from 069. Count and Say/TEST.cc rename to 037. Count and Say/TEST.cc diff --git a/069. Count and Say/solution.h b/037. Count and Say/solution.h similarity index 100% rename from 069. Count and Say/solution.h rename to 037. Count and Say/solution.h diff --git a/075. Combination Sum/README.md b/038. Combination Sum/README.md similarity index 100% rename from 075. Combination Sum/README.md rename to 038. Combination Sum/README.md diff --git a/075. Combination Sum/main.cc b/038. Combination Sum/main.cc similarity index 100% rename from 075. Combination Sum/main.cc rename to 038. Combination Sum/main.cc diff --git a/075. Combination Sum/solution.h b/038. Combination Sum/solution.h similarity index 100% rename from 075. Combination Sum/solution.h rename to 038. Combination Sum/solution.h diff --git a/096. Combination Sum II/README.md b/039. Combination Sum II/README.md similarity index 100% rename from 096. Combination Sum II/README.md rename to 039. Combination Sum II/README.md diff --git a/096. Combination Sum II/main.cpp b/039. Combination Sum II/main.cpp similarity index 100% rename from 096. Combination Sum II/main.cpp rename to 039. Combination Sum II/main.cpp diff --git a/096. Combination Sum II/solution.h b/039. Combination Sum II/solution.h similarity index 100% rename from 096. Combination Sum II/solution.h rename to 039. Combination Sum II/solution.h diff --git a/105. First Missing Positive/README.md b/040. First Missing Positive/README.md similarity index 100% rename from 105. First Missing Positive/README.md rename to 040. First Missing Positive/README.md diff --git a/105. First Missing Positive/TEST.cc b/040. First Missing Positive/TEST.cc similarity index 100% rename from 105. First Missing Positive/TEST.cc rename to 040. First Missing Positive/TEST.cc diff --git a/105. First Missing Positive/solution.h b/040. First Missing Positive/solution.h similarity index 100% rename from 105. First Missing Positive/solution.h rename to 040. First Missing Positive/solution.h diff --git a/056. Trapping Rain Water/README.md b/041. Trapping Rain Water/README.md similarity index 100% rename from 056. Trapping Rain Water/README.md rename to 041. Trapping Rain Water/README.md diff --git a/056. Trapping Rain Water/TEST.cc b/041. Trapping Rain Water/TEST.cc similarity index 100% rename from 056. Trapping Rain Water/TEST.cc rename to 041. Trapping Rain Water/TEST.cc diff --git a/056. Trapping Rain Water/solution.h b/041. Trapping Rain Water/solution.h similarity index 100% rename from 056. Trapping Rain Water/solution.h rename to 041. Trapping Rain Water/solution.h diff --git a/124. Multiply Strings/README.md b/042. Multiply Strings/README.md similarity index 100% rename from 124. Multiply Strings/README.md rename to 042. Multiply Strings/README.md diff --git a/124. Multiply Strings/TEST.cc b/042. Multiply Strings/TEST.cc similarity index 100% rename from 124. Multiply Strings/TEST.cc rename to 042. Multiply Strings/TEST.cc diff --git a/124. Multiply Strings/solution.h b/042. Multiply Strings/solution.h similarity index 100% rename from 124. Multiply Strings/solution.h rename to 042. Multiply Strings/solution.h diff --git a/095. Jump Game II/README.md b/044. Jump Game II/README.md similarity index 100% rename from 095. Jump Game II/README.md rename to 044. Jump Game II/README.md diff --git a/095. Jump Game II/TEST.cc b/044. Jump Game II/TEST.cc similarity index 100% rename from 095. Jump Game II/TEST.cc rename to 044. Jump Game II/TEST.cc diff --git a/095. Jump Game II/solution.h b/044. Jump Game II/solution.h similarity index 100% rename from 095. Jump Game II/solution.h rename to 044. Jump Game II/solution.h diff --git a/034. Permutations/README.md b/045. Permutations/README.md similarity index 100% rename from 034. Permutations/README.md rename to 045. Permutations/README.md diff --git a/034. Permutations/main.cc b/045. Permutations/main.cc similarity index 100% rename from 034. Permutations/main.cc rename to 045. Permutations/main.cc diff --git a/034. Permutations/solution.h b/045. Permutations/solution.h similarity index 100% rename from 034. Permutations/solution.h rename to 045. Permutations/solution.h diff --git a/093. Permutations II/README.md b/046. Permutations II/README.md similarity index 100% rename from 093. Permutations II/README.md rename to 046. Permutations II/README.md diff --git a/093. Permutations II/main.cc b/046. Permutations II/main.cc similarity index 100% rename from 093. Permutations II/main.cc rename to 046. Permutations II/main.cc diff --git a/093. Permutations II/solution.h b/046. Permutations II/solution.h similarity index 100% rename from 093. Permutations II/solution.h rename to 046. Permutations II/solution.h diff --git a/035. Rotate Image/README.md b/047. Rotate Image/README.md similarity index 100% rename from 035. Rotate Image/README.md rename to 047. Rotate Image/README.md diff --git a/035. Rotate Image/main.cc b/047. Rotate Image/main.cc similarity index 100% rename from 035. Rotate Image/main.cc rename to 047. Rotate Image/main.cc diff --git a/035. Rotate Image/solution.h b/047. Rotate Image/solution.h similarity index 100% rename from 035. Rotate Image/solution.h rename to 047. Rotate Image/solution.h diff --git a/097. Anagrams/README.md b/048. Group Anagrams/README.md similarity index 100% rename from 097. Anagrams/README.md rename to 048. Group Anagrams/README.md diff --git a/097. Anagrams/main.cpp b/048. Group Anagrams/main.cpp similarity index 100% rename from 097. Anagrams/main.cpp rename to 048. Group Anagrams/main.cpp diff --git a/097. Anagrams/solution.h b/048. Group Anagrams/solution.h similarity index 100% rename from 097. Anagrams/solution.h rename to 048. Group Anagrams/solution.h diff --git a/082. Pow(x, n)/README.md b/049. Pow(x, n)/README.md similarity index 100% rename from 082. Pow(x, n)/README.md rename to 049. Pow(x, n)/README.md diff --git a/082. Pow(x, n)/TEST.cc b/049. Pow(x, n)/TEST.cc similarity index 100% rename from 082. Pow(x, n)/TEST.cc rename to 049. Pow(x, n)/TEST.cc diff --git a/082. Pow(x, n)/solution.h b/049. Pow(x, n)/solution.h similarity index 100% rename from 082. Pow(x, n)/solution.h rename to 049. Pow(x, n)/solution.h diff --git a/083. N-Queens/README.md b/050. N-Queens/README.md similarity index 100% rename from 083. N-Queens/README.md rename to 050. N-Queens/README.md diff --git a/083. N-Queens/main.cc b/050. N-Queens/main.cc similarity index 100% rename from 083. N-Queens/main.cc rename to 050. N-Queens/main.cc diff --git a/083. N-Queens/solution.h b/050. N-Queens/solution.h similarity index 100% rename from 083. N-Queens/solution.h rename to 050. N-Queens/solution.h diff --git a/015. N-Queens II/README.md b/051. N-Queens II/README.md similarity index 100% rename from 015. N-Queens II/README.md rename to 051. N-Queens II/README.md diff --git a/015. N-Queens II/TEST.cpp b/051. N-Queens II/TEST.cpp similarity index 100% rename from 015. N-Queens II/TEST.cpp rename to 051. N-Queens II/TEST.cpp diff --git a/015. N-Queens II/solution.h b/051. N-Queens II/solution.h similarity index 100% rename from 015. N-Queens II/solution.h rename to 051. N-Queens II/solution.h diff --git a/052. Maximum Subarray/README.md b/052. Maximum Subarray/README.md new file mode 100644 index 0000000..87dc94c --- /dev/null +++ b/052. Maximum Subarray/README.md @@ -0,0 +1,73 @@ +~~这道题我一看到,我就想到了我的最爱——**[贪心算法](http://zh.wikipedia.org/wiki/%E8%B4%AA%E5%BF%83%E6%B3%95)**,太典型了好么。 +求拥有最大**和**的子序列,那么秉承贪心原则,假设初始解为A[0],那么我增加一个元素(A[1]),我就需要考虑,我的利益是多了,还是损失了。~~ + +经 @Mooophy 在 [issue](https://github.com/pezy/LeetCode/issues/10) 里指出,下述思路并不属于贪心的范畴。荣誉属于 DP,另外得知它有一个历史名字:[Kadane's algorithm](http://en.wikipedia.org/wiki/Maximum_subarray_problem). + +---- +**贪心法与 DP 的最大区别在于**: + +- 动态规划讲究"**记录历史**"以及"**根据历史记录做出最优选择**"。 +- 贪心法对历史无记录,每一次是根据 **当前情况做出最优选择**。 + +---- + +由于题意要求,子序列至少要连续,所以没可能跳过 A[1], 只有两个选择: + +1. A[0] + A[1] +2. A[1] + +说白了,就是,要么容纳新文化(改良派),要么重新开始(革命派)。哪一种可以带来最大利益,就选择哪一种。(因为人类社会也是连续的) + +但这里,如果发生了革命,就会产生断链。把镜头拉远,从整条历史长河去看,每一条链子,哪一条最长呢?至少你得记录下巅峰的最大利益吧? + +根据上述两条原则,我们写下了我们的算法: +```cpp +benefited = max(A[i], benefited + A[i]); +maxv = max(benefited, maxv); +``` + +聪明的你一定发现了,第一句条恰是**当权者的决策**,第二条恰是**历史学家的总结**。 横批:人类是贪婪的。 + +**由于我们累计了 `benefited`,并根据其值进行每一次选择。故该解法的本质是 DP 而非贪心。** + +----- + +另外,该题下面说到 More practice, 提到要用分治法?我没什么思路,请明白者提点。 + +>If you have figured out the O(n) solution, try coding another solution using the divide and conquer approach, which is more subtle + +咳咳咳, @Mooophy ,该出来了。。。 + +----- + +@Mooophy 应约而出,给出了[代码](https://github.com/pezy/LeetCode/pull/9/files),我根据其代码,尝试分析一下分治法的策略: + +分治法的灵魂在于一个 **"分"** 字。对于这道题而言,求`A`的最大和子序列,可以给`A`来一刀: + + −2,1,−3,4,−1,2,1,−5,4 + left | right + crossing + +由于子序列连续,它必然属于上述划分中的某一种情况: + +- 完全属于 left 部分 +- 完全属于 right 部分 +- 属于 crossing 部分(即跨越中点) + +于是其核心代码如下: + +```cpp +int maxSubArray(int A[], int l, int h) { + if (l == h) return A[l]; // 仅有一个数 + int m = (l + h) / 2; // 中点位置(划分点) + return std::max({maxSubArray(A, l, m), maxSubArray(A, m+1, h), maxCrossing(A, l, m, h)}); +} +``` + +是否非常的简洁呢? + +下面问题集中在 `maxCrossing` 的策略,这个过程可以线性求出。即将其属于 `left` 范畴的 `sum` 与属于 `right` 范畴的 `sum` 加起来即可。 + +实现代码请见:[divide_conquer.h](divide_conquer.h) + +这部分的详细思路可参考 CLRS 的第四章分治法的第一小节。 diff --git a/052. Maximum Subarray/divide_conquer.h b/052. Maximum Subarray/divide_conquer.h new file mode 100644 index 0000000..75d1f74 --- /dev/null +++ b/052. Maximum Subarray/divide_conquer.h @@ -0,0 +1,27 @@ +#include +#include + +class Solution { + int maxCrossing(int A[], int l, int m, int h) { + int left_max = INT_MIN, right_max = INT_MIN; + for (int i=m, sum=0; i >= l; --i) { + sum += A[i]; + if (left_max < sum) left_max = sum; + } + for (int i=m+1, sum=0; i <= h; ++i) { + sum += A[i]; + if (right_max < sum) right_max = sum; + } + return left_max + right_max; + } + + int maxSubArray(int A[], int l, int h) { + if (l == h) return A[l]; + int m = (l + h) / 2; + return std::max({maxSubArray(A, l, m), maxSubArray(A, m+1, h), maxCrossing(A, l, m, h)}); + } +public: + int maxSubArray(int A[], int n) { + return maxSubArray(A, 0, n-1); + } +}; diff --git a/014. Maximum Subarray/main.cc b/052. Maximum Subarray/main.cc similarity index 65% rename from 014. Maximum Subarray/main.cc rename to 052. Maximum Subarray/main.cc index 30f9295..f1a0a08 100644 --- a/014. Maximum Subarray/main.cc +++ b/052. Maximum Subarray/main.cc @@ -1,10 +1,12 @@ #include #include "solution.h" +//#include "divide_conquer.h" int main() { - int A[] = {-2,1,-3,4,-1,2,1,-5,4}; + int A[] = {-2,1,-3,4,-1,2,1,-5,4}; Solution s; std::cout << s.maxSubArray(A, 9) << std::endl; + return 0; -} +} diff --git a/014. Maximum Subarray/solution.h b/052. Maximum Subarray/solution.h similarity index 100% rename from 014. Maximum Subarray/solution.h rename to 052. Maximum Subarray/solution.h diff --git a/121. Spiral Matrix/README.md b/053. Spiral Matrix/README.md similarity index 100% rename from 121. Spiral Matrix/README.md rename to 053. Spiral Matrix/README.md diff --git a/121. Spiral Matrix/TEST.cc b/053. Spiral Matrix/TEST.cc similarity index 100% rename from 121. Spiral Matrix/TEST.cc rename to 053. Spiral Matrix/TEST.cc diff --git a/121. Spiral Matrix/solution.h b/053. Spiral Matrix/solution.h similarity index 100% rename from 121. Spiral Matrix/solution.h rename to 053. Spiral Matrix/solution.h diff --git a/068. Jump Game/README.md b/054. Jump Game/README.md similarity index 100% rename from 068. Jump Game/README.md rename to 054. Jump Game/README.md diff --git a/068. Jump Game/TEST.cc b/054. Jump Game/TEST.cc similarity index 100% rename from 068. Jump Game/TEST.cc rename to 054. Jump Game/TEST.cc diff --git a/068. Jump Game/solution.h b/054. Jump Game/solution.h similarity index 100% rename from 068. Jump Game/solution.h rename to 054. Jump Game/solution.h diff --git a/117. Merge Intervals/README.md b/055. Merge Intervals/README.md similarity index 100% rename from 117. Merge Intervals/README.md rename to 055. Merge Intervals/README.md diff --git a/117. Merge Intervals/main.cpp b/055. Merge Intervals/main.cpp similarity index 100% rename from 117. Merge Intervals/main.cpp rename to 055. Merge Intervals/main.cpp diff --git a/117. Merge Intervals/solution.h b/055. Merge Intervals/solution.h similarity index 100% rename from 117. Merge Intervals/solution.h rename to 055. Merge Intervals/solution.h diff --git a/120. Insert Interval/README.md b/056. Insert Interval/README.md similarity index 100% rename from 120. Insert Interval/README.md rename to 056. Insert Interval/README.md diff --git a/120. Insert Interval/TEST.cc b/056. Insert Interval/TEST.cc similarity index 100% rename from 120. Insert Interval/TEST.cc rename to 056. Insert Interval/TEST.cc diff --git a/120. Insert Interval/solution.h b/056. Insert Interval/solution.h similarity index 100% rename from 120. Insert Interval/solution.h rename to 056. Insert Interval/solution.h diff --git a/055. Length of Last Word/README.md b/057. Length of Last Word/README.md similarity index 100% rename from 055. Length of Last Word/README.md rename to 057. Length of Last Word/README.md diff --git a/055. Length of Last Word/TEST.cc b/057. Length of Last Word/TEST.cc similarity index 100% rename from 055. Length of Last Word/TEST.cc rename to 057. Length of Last Word/TEST.cc diff --git a/055. Length of Last Word/solution.h b/057. Length of Last Word/solution.h similarity index 100% rename from 055. Length of Last Word/solution.h rename to 057. Length of Last Word/solution.h diff --git a/055. Length of Last Word/solution_string.h b/057. Length of Last Word/solution_string.h similarity index 100% rename from 055. Length of Last Word/solution_string.h rename to 057. Length of Last Word/solution_string.h diff --git a/045. Spiral Matrix II/README.md b/058. Spiral Matrix II/README.md similarity index 100% rename from 045. Spiral Matrix II/README.md rename to 058. Spiral Matrix II/README.md diff --git a/045. Spiral Matrix II/main.cc b/058. Spiral Matrix II/main.cc similarity index 100% rename from 045. Spiral Matrix II/main.cc rename to 058. Spiral Matrix II/main.cc diff --git a/045. Spiral Matrix II/solution.h b/058. Spiral Matrix II/solution.h similarity index 100% rename from 045. Spiral Matrix II/solution.h rename to 058. Spiral Matrix II/solution.h diff --git a/108. Permutation Sequence/README.md b/059. Permutation Sequence/README.md similarity index 100% rename from 108. Permutation Sequence/README.md rename to 059. Permutation Sequence/README.md diff --git a/108. Permutation Sequence/TEST.cc b/059. Permutation Sequence/TEST.cc similarity index 100% rename from 108. Permutation Sequence/TEST.cc rename to 059. Permutation Sequence/TEST.cc diff --git a/108. Permutation Sequence/solution.h b/059. Permutation Sequence/solution.h similarity index 100% rename from 108. Permutation Sequence/solution.h rename to 059. Permutation Sequence/solution.h diff --git a/110. Rotate List/README.md b/060. Rotate List/README.md similarity index 100% rename from 110. Rotate List/README.md rename to 060. Rotate List/README.md diff --git a/110. Rotate List/main.cpp b/060. Rotate List/main.cpp similarity index 100% rename from 110. Rotate List/main.cpp rename to 060. Rotate List/main.cpp diff --git a/110. Rotate List/solution.h b/060. Rotate List/solution.h similarity index 100% rename from 110. Rotate List/solution.h rename to 060. Rotate List/solution.h diff --git a/029. Unique Paths/README.md b/061. Unique Paths/README.md similarity index 100% rename from 029. Unique Paths/README.md rename to 061. Unique Paths/README.md diff --git a/029. Unique Paths/main.cc b/061. Unique Paths/main.cc similarity index 100% rename from 029. Unique Paths/main.cc rename to 061. Unique Paths/main.cc diff --git a/029. Unique Paths/solution.h b/061. Unique Paths/solution.h similarity index 100% rename from 029. Unique Paths/solution.h rename to 061. Unique Paths/solution.h diff --git a/038. Minimum Path Sum/README.md b/063. Minimum Path Sum/README.md similarity index 100% rename from 038. Minimum Path Sum/README.md rename to 063. Minimum Path Sum/README.md diff --git a/038. Minimum Path Sum/main.cc b/063. Minimum Path Sum/main.cc similarity index 100% rename from 038. Minimum Path Sum/main.cc rename to 063. Minimum Path Sum/main.cc diff --git a/038. Minimum Path Sum/solution.h b/063. Minimum Path Sum/solution.h similarity index 100% rename from 038. Minimum Path Sum/solution.h rename to 063. Minimum Path Sum/solution.h diff --git a/030. Plus One/README.md b/065. Plus One/README.md similarity index 100% rename from 030. Plus One/README.md rename to 065. Plus One/README.md diff --git a/030. Plus One/main.cc b/065. Plus One/main.cc similarity index 100% rename from 030. Plus One/main.cc rename to 065. Plus One/main.cc diff --git a/030. Plus One/solution.h b/065. Plus One/solution.h similarity index 100% rename from 030. Plus One/solution.h rename to 065. Plus One/solution.h diff --git a/087. Add Binary/README.md b/066. Add Binary/README.md similarity index 100% rename from 087. Add Binary/README.md rename to 066. Add Binary/README.md diff --git a/087. Add Binary/TEST.cc b/066. Add Binary/TEST.cc similarity index 100% rename from 087. Add Binary/TEST.cc rename to 066. Add Binary/TEST.cc diff --git a/087. Add Binary/solution.h b/066. Add Binary/solution.h similarity index 100% rename from 087. Add Binary/solution.h rename to 066. Add Binary/solution.h diff --git a/067. Search for a Range/README.md b/067. Search for a Range/README.md deleted file mode 100644 index 9a04dcd..0000000 --- a/067. Search for a Range/README.md +++ /dev/null @@ -1,24 +0,0 @@ -这道题又是二分查找的变种。我因为时间有限,想出来的方法是最直接的。 - -首先先 init 一个 vector {-1,-1}, 这样如果没找到,直接返回无效值。 - -然后常规手法,二分查找,一旦找到,将 `vec[0] = vec[1] = mid`. - -由于咱们找的是一个范围,所以,仅需在这个位置上,前后扩展即可。 - -```cpp -while (vec[0]>0 && A[vec[0]-1] == target) - --vec[0]; -while (vec[1]{0, n-1}; -``` - -方法不惊艳,希望有更好解法的能告诉我。 diff --git a/067. Search for a Range/solution.h b/067. Search for a Range/solution.h deleted file mode 100644 index f3e088e..0000000 --- a/067. Search for a Range/solution.h +++ /dev/null @@ -1,22 +0,0 @@ -#include - -using std::vector; - -class Solution { -public: - vector searchRange(int A[], int n, int target) { - if (A[0] == A[n-1] && A[0] == target) return vector{0, n-1}; - vector retv{-1, -1}; - for (int i=0, j=n-1; i<=j; ) { - int mid = (i + j) >> 1; - if (target == A[mid]) {retv[0] = retv[1] = mid; break;} - else if (target < A[mid]) j = mid-1; - else i = mid + 1; - } - while (retv[0]>0 && A[retv[0]-1] == target) - --retv[0]; - while (retv[1] +using std::string; + +#include +using std::vector; + +#include +using std::istringstream; + +class Solution { +public: + string simplifyPath(string path) { + string ret, tmp; + vector stack; + for ( istringstream iss(path); getline(iss, tmp, '/'); ) { + if (tmp == ".." && !stack.empty()) stack.pop_back(); + else if (tmp == "." || tmp == ".." || tmp == "") continue; + else stack.push_back(tmp); + } + for (auto str : stack) { ret += "/" + str; } + return ret.empty() ? "/" : ret; + } +}; diff --git a/088. Edit Distance/README.md b/071. Edit Distance/README.md similarity index 100% rename from 088. Edit Distance/README.md rename to 071. Edit Distance/README.md diff --git a/088. Edit Distance/TEST.cc b/071. Edit Distance/TEST.cc similarity index 100% rename from 088. Edit Distance/TEST.cc rename to 071. Edit Distance/TEST.cc diff --git a/088. Edit Distance/solution.h b/071. Edit Distance/solution.h similarity index 100% rename from 088. Edit Distance/solution.h rename to 071. Edit Distance/solution.h diff --git a/044. Set Matrix Zeroes/README.md b/072. Set Matrix Zeroes/README.md similarity index 100% rename from 044. Set Matrix Zeroes/README.md rename to 072. Set Matrix Zeroes/README.md diff --git a/044. Set Matrix Zeroes/main.cc b/072. Set Matrix Zeroes/main.cc similarity index 100% rename from 044. Set Matrix Zeroes/main.cc rename to 072. Set Matrix Zeroes/main.cc diff --git a/044. Set Matrix Zeroes/solution.h b/072. Set Matrix Zeroes/solution.h similarity index 100% rename from 044. Set Matrix Zeroes/solution.h rename to 072. Set Matrix Zeroes/solution.h diff --git a/036. Search a 2D Matrix/README.md b/073. Search a 2D Matrix/README.md similarity index 100% rename from 036. Search a 2D Matrix/README.md rename to 073. Search a 2D Matrix/README.md diff --git a/036. Search a 2D Matrix/TEST.cc b/073. Search a 2D Matrix/TEST.cc similarity index 100% rename from 036. Search a 2D Matrix/TEST.cc rename to 073. Search a 2D Matrix/TEST.cc diff --git a/036. Search a 2D Matrix/solution.h b/073. Search a 2D Matrix/solution.h similarity index 100% rename from 036. Search a 2D Matrix/solution.h rename to 073. Search a 2D Matrix/solution.h diff --git a/025. Sort Colors/README.md b/074. Sort Colors/README.md similarity index 100% rename from 025. Sort Colors/README.md rename to 074. Sort Colors/README.md diff --git a/025. Sort Colors/main.cc b/074. Sort Colors/main.cc similarity index 100% rename from 025. Sort Colors/main.cc rename to 074. Sort Colors/main.cc diff --git a/025. Sort Colors/solution.h b/074. Sort Colors/solution.h similarity index 100% rename from 025. Sort Colors/solution.h rename to 074. Sort Colors/solution.h diff --git a/051. Combinations/README.md b/076. Combinations/README.md similarity index 100% rename from 051. Combinations/README.md rename to 076. Combinations/README.md diff --git a/051. Combinations/main.cc b/076. Combinations/main.cc similarity index 100% rename from 051. Combinations/main.cc rename to 076. Combinations/main.cc diff --git a/051. Combinations/solution.h b/076. Combinations/solution.h similarity index 100% rename from 051. Combinations/solution.h rename to 076. Combinations/solution.h diff --git a/063. Subsets/README.md b/077. Subsets/README.md similarity index 100% rename from 063. Subsets/README.md rename to 077. Subsets/README.md diff --git a/063. Subsets/main.cc b/077. Subsets/main.cc similarity index 100% rename from 063. Subsets/main.cc rename to 077. Subsets/main.cc diff --git a/063. Subsets/solution.h b/077. Subsets/solution.h similarity index 100% rename from 063. Subsets/solution.h rename to 077. Subsets/solution.h diff --git a/046. Remove Duplicates from Sorted Array II/README.md b/079. Remove Duplicates from Sorted Array II/README.md similarity index 100% rename from 046. Remove Duplicates from Sorted Array II/README.md rename to 079. Remove Duplicates from Sorted Array II/README.md diff --git a/046. Remove Duplicates from Sorted Array II/TEST.cc b/079. Remove Duplicates from Sorted Array II/TEST.cc similarity index 100% rename from 046. Remove Duplicates from Sorted Array II/TEST.cc rename to 079. Remove Duplicates from Sorted Array II/TEST.cc diff --git a/046. Remove Duplicates from Sorted Array II/solution.h b/079. Remove Duplicates from Sorted Array II/solution.h similarity index 100% rename from 046. Remove Duplicates from Sorted Array II/solution.h rename to 079. Remove Duplicates from Sorted Array II/solution.h diff --git a/041. Search in Rotated Sorted Array II/README.md b/080. Search in Rotated Sorted Array II/README.md similarity index 100% rename from 041. Search in Rotated Sorted Array II/README.md rename to 080. Search in Rotated Sorted Array II/README.md diff --git a/041. Search in Rotated Sorted Array II/TEST.cc b/080. Search in Rotated Sorted Array II/TEST.cc similarity index 100% rename from 041. Search in Rotated Sorted Array II/TEST.cc rename to 080. Search in Rotated Sorted Array II/TEST.cc diff --git a/041. Search in Rotated Sorted Array II/solution.h b/080. Search in Rotated Sorted Array II/solution.h similarity index 100% rename from 041. Search in Rotated Sorted Array II/solution.h rename to 080. Search in Rotated Sorted Array II/solution.h diff --git a/094. Remove Duplicates from Sorted List II/README.md b/081. Remove Duplicates from Sorted List II/README.md similarity index 100% rename from 094. Remove Duplicates from Sorted List II/README.md rename to 081. Remove Duplicates from Sorted List II/README.md diff --git a/094. Remove Duplicates from Sorted List II/main.cpp b/081. Remove Duplicates from Sorted List II/main.cpp similarity index 100% rename from 094. Remove Duplicates from Sorted List II/main.cpp rename to 081. Remove Duplicates from Sorted List II/main.cpp diff --git a/094. Remove Duplicates from Sorted List II/solution.h b/081. Remove Duplicates from Sorted List II/solution.h similarity index 100% rename from 094. Remove Duplicates from Sorted List II/solution.h rename to 081. Remove Duplicates from Sorted List II/solution.h diff --git a/012. Remove Duplicates from Sorted List/README.md b/082. Remove Duplicates from Sorted List/README.md similarity index 100% rename from 012. Remove Duplicates from Sorted List/README.md rename to 082. Remove Duplicates from Sorted List/README.md diff --git a/012. Remove Duplicates from Sorted List/main.cc b/082. Remove Duplicates from Sorted List/main.cc similarity index 100% rename from 012. Remove Duplicates from Sorted List/main.cc rename to 082. Remove Duplicates from Sorted List/main.cc diff --git a/012. Remove Duplicates from Sorted List/solution.h b/082. Remove Duplicates from Sorted List/solution.h similarity index 100% rename from 012. Remove Duplicates from Sorted List/solution.h rename to 082. Remove Duplicates from Sorted List/solution.h diff --git a/114. Largest Rectangle in Histogram/README.md b/083. Largest Rectangle in Histogram/README.md similarity index 100% rename from 114. Largest Rectangle in Histogram/README.md rename to 083. Largest Rectangle in Histogram/README.md diff --git a/114. Largest Rectangle in Histogram/TEST.cc b/083. Largest Rectangle in Histogram/TEST.cc similarity index 100% rename from 114. Largest Rectangle in Histogram/TEST.cc rename to 083. Largest Rectangle in Histogram/TEST.cc diff --git a/114. Largest Rectangle in Histogram/solution.h b/083. Largest Rectangle in Histogram/solution.h similarity index 100% rename from 114. Largest Rectangle in Histogram/solution.h rename to 083. Largest Rectangle in Histogram/solution.h diff --git a/113. Maximal Rectangle/README.md b/084. Maximal Rectangle/README.md similarity index 100% rename from 113. Maximal Rectangle/README.md rename to 084. Maximal Rectangle/README.md diff --git a/113. Maximal Rectangle/TEST.cc b/084. Maximal Rectangle/TEST.cc similarity index 100% rename from 113. Maximal Rectangle/TEST.cc rename to 084. Maximal Rectangle/TEST.cc diff --git a/113. Maximal Rectangle/solution.h b/084. Maximal Rectangle/solution.h similarity index 100% rename from 113. Maximal Rectangle/solution.h rename to 084. Maximal Rectangle/solution.h diff --git a/072. Partition List/README.md b/085. Partition List/README.md similarity index 100% rename from 072. Partition List/README.md rename to 085. Partition List/README.md diff --git a/072. Partition List/main.cc b/085. Partition List/main.cc similarity index 100% rename from 072. Partition List/main.cc rename to 085. Partition List/main.cc diff --git a/072. Partition List/solution.h b/085. Partition List/solution.h similarity index 100% rename from 072. Partition List/solution.h rename to 085. Partition List/solution.h diff --git a/072. Partition List/solution_lambda.h b/085. Partition List/solution_lambda.h similarity index 100% rename from 072. Partition List/solution_lambda.h rename to 085. Partition List/solution_lambda.h diff --git a/103. Scramble String/README.md b/086. Scramble String/README.md similarity index 100% rename from 103. Scramble String/README.md rename to 086. Scramble String/README.md diff --git a/103. Scramble String/TEST.cc b/086. Scramble String/TEST.cc similarity index 100% rename from 103. Scramble String/TEST.cc rename to 086. Scramble String/TEST.cc diff --git a/103. Scramble String/solution.h b/086. Scramble String/solution.h similarity index 100% rename from 103. Scramble String/solution.h rename to 086. Scramble String/solution.h diff --git a/026. Merge Sorted Array/README.md b/087. Merge Sorted Array/README.md similarity index 100% rename from 026. Merge Sorted Array/README.md rename to 087. Merge Sorted Array/README.md diff --git a/026. Merge Sorted Array/main.cc b/087. Merge Sorted Array/main.cc similarity index 100% rename from 026. Merge Sorted Array/main.cc rename to 087. Merge Sorted Array/main.cc diff --git a/026. Merge Sorted Array/solution.h b/087. Merge Sorted Array/solution.h similarity index 100% rename from 026. Merge Sorted Array/solution.h rename to 087. Merge Sorted Array/solution.h diff --git a/028. Gray Code/README.md b/088. Gray Code/README.md similarity index 100% rename from 028. Gray Code/README.md rename to 088. Gray Code/README.md diff --git a/028. Gray Code/main.cc b/088. Gray Code/main.cc similarity index 100% rename from 028. Gray Code/main.cc rename to 088. Gray Code/main.cc diff --git a/028. Gray Code/solution.h b/088. Gray Code/solution.h similarity index 100% rename from 028. Gray Code/solution.h rename to 088. Gray Code/solution.h diff --git a/071. Subsets II/README.md b/089. Subsets II/README.md similarity index 100% rename from 071. Subsets II/README.md rename to 089. Subsets II/README.md diff --git a/071. Subsets II/main.cc b/089. Subsets II/main.cc similarity index 100% rename from 071. Subsets II/main.cc rename to 089. Subsets II/main.cc diff --git a/071. Subsets II/solution.h b/089. Subsets II/solution.h similarity index 100% rename from 071. Subsets II/solution.h rename to 089. Subsets II/solution.h diff --git a/081. Reverse Linked List II/README.md b/091. Reverse Linked List II/README.md similarity index 100% rename from 081. Reverse Linked List II/README.md rename to 091. Reverse Linked List II/README.md diff --git a/081. Reverse Linked List II/main.cc b/091. Reverse Linked List II/main.cc similarity index 100% rename from 081. Reverse Linked List II/main.cc rename to 091. Reverse Linked List II/main.cc diff --git a/081. Reverse Linked List II/solution.h b/091. Reverse Linked List II/solution.h similarity index 100% rename from 081. Reverse Linked List II/solution.h rename to 091. Reverse Linked List II/solution.h diff --git a/123. Restore IP Addresses/README.md b/092. Restore IP Addresses/README.md similarity index 100% rename from 123. Restore IP Addresses/README.md rename to 092. Restore IP Addresses/README.md diff --git a/123. Restore IP Addresses/main.cpp b/092. Restore IP Addresses/main.cpp similarity index 100% rename from 123. Restore IP Addresses/main.cpp rename to 092. Restore IP Addresses/main.cpp diff --git a/123. Restore IP Addresses/solution.h b/092. Restore IP Addresses/solution.h similarity index 100% rename from 123. Restore IP Addresses/solution.h rename to 092. Restore IP Addresses/solution.h diff --git a/008. Binary Tree Inorder Traversal/README.md b/093. Binary Tree Inorder Traversal/README.md similarity index 100% rename from 008. Binary Tree Inorder Traversal/README.md rename to 093. Binary Tree Inorder Traversal/README.md diff --git a/008. Binary Tree Inorder Traversal/main.cpp b/093. Binary Tree Inorder Traversal/main.cpp similarity index 100% rename from 008. Binary Tree Inorder Traversal/main.cpp rename to 093. Binary Tree Inorder Traversal/main.cpp diff --git a/008. Binary Tree Inorder Traversal/recursion.h b/093. Binary Tree Inorder Traversal/recursion.h similarity index 100% rename from 008. Binary Tree Inorder Traversal/recursion.h rename to 093. Binary Tree Inorder Traversal/recursion.h diff --git a/008. Binary Tree Inorder Traversal/solution.h b/093. Binary Tree Inorder Traversal/solution.h similarity index 100% rename from 008. Binary Tree Inorder Traversal/solution.h rename to 093. Binary Tree Inorder Traversal/solution.h diff --git a/065. Unique Binary Search Trees II/README.md b/094. Unique Binary Search Trees II/README.md similarity index 100% rename from 065. Unique Binary Search Trees II/README.md rename to 094. Unique Binary Search Trees II/README.md diff --git a/065. Unique Binary Search Trees II/main.cc b/094. Unique Binary Search Trees II/main.cc similarity index 100% rename from 065. Unique Binary Search Trees II/main.cc rename to 094. Unique Binary Search Trees II/main.cc diff --git a/065. Unique Binary Search Trees II/solution.h b/094. Unique Binary Search Trees II/solution.h similarity index 100% rename from 065. Unique Binary Search Trees II/solution.h rename to 094. Unique Binary Search Trees II/solution.h diff --git a/006. Unique Binary Search Trees/README.md b/095. Unique Binary Search Trees/README.md similarity index 100% rename from 006. Unique Binary Search Trees/README.md rename to 095. Unique Binary Search Trees/README.md diff --git a/006. Unique Binary Search Trees/main.cpp b/095. Unique Binary Search Trees/main.cpp similarity index 100% rename from 006. Unique Binary Search Trees/main.cpp rename to 095. Unique Binary Search Trees/main.cpp diff --git a/006. Unique Binary Search Trees/solution.h b/095. Unique Binary Search Trees/solution.h similarity index 100% rename from 006. Unique Binary Search Trees/solution.h rename to 095. Unique Binary Search Trees/solution.h diff --git a/086. Validate Binary Search Tree/README.md b/097. Validate Binary Search Tree/README.md similarity index 100% rename from 086. Validate Binary Search Tree/README.md rename to 097. Validate Binary Search Tree/README.md diff --git a/086. Validate Binary Search Tree/main.cc b/097. Validate Binary Search Tree/main.cc similarity index 100% rename from 086. Validate Binary Search Tree/main.cc rename to 097. Validate Binary Search Tree/main.cc diff --git a/086. Validate Binary Search Tree/solution.h b/097. Validate Binary Search Tree/solution.h similarity index 100% rename from 086. Validate Binary Search Tree/solution.h rename to 097. Validate Binary Search Tree/solution.h diff --git a/003. Same Tree/README.md b/099. Same Tree/README.md similarity index 57% rename from 003. Same Tree/README.md rename to 099. Same Tree/README.md index 95ea248..1854f2c 100644 --- a/003. Same Tree/README.md +++ b/099. Same Tree/README.md @@ -1,4 +1,12 @@ +# 思路(C++) + 这道题没啥好说的,太简单了,尤其是刚做过昨天那道。我几乎直接在LeetCode上写下了答案,连本地编译都没用,抱着试试运气的心态,竟直接AC了。 花了不到3分钟。 递归还是那个递归,门口有一颗二叉树,另一颗也是二叉树。它们长得一样不?从根开始看呗。好无聊。 + +## Python + +值得注意的是,Python 里更习惯用 `is` 来比较,如果只是判断非零(有效)时,可以直接用 `if p:` 这样更简洁的方式。 + +参考: \ No newline at end of file diff --git a/003. Same Tree/main.cpp b/099. Same Tree/main.cpp similarity index 100% rename from 003. Same Tree/main.cpp rename to 099. Same Tree/main.cpp diff --git a/003. Same Tree/solution.h b/099. Same Tree/solution.h similarity index 100% rename from 003. Same Tree/solution.h rename to 099. Same Tree/solution.h diff --git a/099. Same Tree/solution.py b/099. Same Tree/solution.py new file mode 100644 index 0000000..d181f98 --- /dev/null +++ b/099. Same Tree/solution.py @@ -0,0 +1,41 @@ +#!python3 + + +class TreeNode: + def __init__(self, x): + self.val = x + self.left = None + self.right = None + + +class Solution: + def isSameTree(self, p, q): + """ + :type p: TreeNode + :type q: TreeNode + :rtype: bool + """ + if p and q: + return p.val == q.val and self.isSameTree(p.left, q.left) and self.isSameTree(p.right, q.right) + return p is q + + +if __name__ == "__main__": + example1 = TreeNode(1) + example1.left = TreeNode(2) + example1.right = TreeNode(3) + assert(Solution().isSameTree(example1, example1) is True) + + example2l = TreeNode(1) + example2l.left = TreeNode(2) + example2r = TreeNode(1) + example2r.right = TreeNode(2) + assert(Solution().isSameTree(example2l, example2r) is False) + + example3l = TreeNode(1) + example3l.left = TreeNode(2) + example3l.right = TreeNode(1) + example3r = TreeNode(1) + example3r.left = TreeNode(1) + example3r.right = TreeNode(2) + assert(Solution().isSameTree(example3l, example3r) is False) diff --git a/027. Symmetric Tree/README.md b/100. Symmetric Tree/README.md similarity index 100% rename from 027. Symmetric Tree/README.md rename to 100. Symmetric Tree/README.md diff --git a/027. Symmetric Tree/main.cc b/100. Symmetric Tree/main.cc similarity index 100% rename from 027. Symmetric Tree/main.cc rename to 100. Symmetric Tree/main.cc diff --git a/027. Symmetric Tree/solution.h b/100. Symmetric Tree/solution.h similarity index 100% rename from 027. Symmetric Tree/solution.h rename to 100. Symmetric Tree/solution.h diff --git a/048. Binary Tree Level Order Traversal/README.md b/101. Binary Tree Level Order Traversal/README.md similarity index 100% rename from 048. Binary Tree Level Order Traversal/README.md rename to 101. Binary Tree Level Order Traversal/README.md diff --git a/048. Binary Tree Level Order Traversal/main.cc b/101. Binary Tree Level Order Traversal/main.cc similarity index 100% rename from 048. Binary Tree Level Order Traversal/main.cc rename to 101. Binary Tree Level Order Traversal/main.cc diff --git a/048. Binary Tree Level Order Traversal/solution.h b/101. Binary Tree Level Order Traversal/solution.h similarity index 100% rename from 048. Binary Tree Level Order Traversal/solution.h rename to 101. Binary Tree Level Order Traversal/solution.h diff --git a/102. Add Two Numbers/README.md b/102. Add Two Numbers/README.md deleted file mode 100644 index 3334219..0000000 --- a/102. Add Two Numbers/README.md +++ /dev/null @@ -1,37 +0,0 @@ -֮ǰ [Add Binary](../87. Add Binary). ˼뼸ƣѵ**λ** - -Σֹϵ⣬dummy ڵӦDZزٵˡ - -㣬ĺġ˽ΪѶӦΪ Easy. - ------ - -˵һ½λ顣 - -STL һרŵĽṹ `div_t`, Աֱ quot(quotient) rem(remainder). ʲôǷԿһأ - -˵. - - 38 / 5 == 7 remainder 3 - - C++ ǣ - - div_t result = div(38, 5); - cout << result.quot << result.rem; - -ǰΪĽΪ - ------ - -Ĺϵǣ - -ĽλǻʮƵģڵֵ֮ӦжǷ񳬳10Ҫλµ div sum.rem ĵǰڵ㣬sum.quot һμӷĽλ - -У - -```cpp -if (l1) { sum.quot += l1->val; l1 = l1->next; } // λ + l1 -if (l2) { sum.quot += l2->val; l2 = l2->next; } // λ + l1 + l2 -sum = div(sum.quot, 10); // 10 õµ quot rem. -tail->next = new ListNode(sum.rem); // rem Ϊڵֵ, quot ´ε -``` \ No newline at end of file diff --git a/078. Binary Tree Zigzag Level Order Traversal/README.md b/102. Binary Tree Zigzag Level Order Traversal/README.md similarity index 100% rename from 078. Binary Tree Zigzag Level Order Traversal/README.md rename to 102. Binary Tree Zigzag Level Order Traversal/README.md diff --git a/078. Binary Tree Zigzag Level Order Traversal/main.cc b/102. Binary Tree Zigzag Level Order Traversal/main.cc similarity index 100% rename from 078. Binary Tree Zigzag Level Order Traversal/main.cc rename to 102. Binary Tree Zigzag Level Order Traversal/main.cc diff --git a/078. Binary Tree Zigzag Level Order Traversal/solution.h b/102. Binary Tree Zigzag Level Order Traversal/solution.h similarity index 100% rename from 078. Binary Tree Zigzag Level Order Traversal/solution.h rename to 102. Binary Tree Zigzag Level Order Traversal/solution.h diff --git a/002. Maximum Depth of Binary Tree/README.md b/103. Maximum Depth of Binary Tree/README.md similarity index 55% rename from 002. Maximum Depth of Binary Tree/README.md rename to 103. Maximum Depth of Binary Tree/README.md index 5f39a94..545f337 100644 --- a/002. Maximum Depth of Binary Tree/README.md +++ b/103. Maximum Depth of Binary Tree/README.md @@ -1,30 +1,33 @@ -这道题应该算是基本题了。我顺便复习了一下[二叉树的基本概念](http://en.wikipedia.org/wiki/Binary_tree),并回顾了一下**深度优先遍历**和**广度优先遍历**两个重点知识。 -而这道题就是脱胎于前者的思想。 +# 思路(C++) -求 root 的最大深度,那么我就需要求出 left 的最大深度,以及 right 的最大深度。把 root 替换成 left 或 right 又会再重复上面的步骤。 -这显然是**递归**。 +这道题应该算是基本题了。我顺便复习了一下[二叉树的基本概念](http://en.wikipedia.org/wiki/Binary_tree),并回顾了一下**深度优先遍历**和**广度优先遍历**两个重点知识。而这道题就是脱胎于前者的思想。 + +求 root 的最大深度,那么我就需要求出 left 的最大深度,以及 right 的最大深度。把 root 替换成 left 或 right 又会再重复上面的步骤。这显然是**递归**。 于是我们写个框架出来: + ```cpp - int leftDepth = maxDepth(root->left); - int rightDepth = maxDepth(root->right); - return leftDepth > rightDepth ? leftDepth : rightDepth; +int leftDepth = maxDepth(root->left); +int rightDepth = maxDepth(root->right); +return leftDepth > rightDepth ? leftDepth : rightDepth; ``` 基本思路出来了,就需要考虑几个特殊情况: 1. 叶子节点返回什么? 显然应该是1. (叶子节点的深度应该是1) -2. 如何判断是叶子节点? `left == NULL, right == NULL` +1. 如何判断是叶子节点? `left == NULL, right == NULL` 好了,补充上述框架: + ```cpp - if (root == NULL) return 0; - int leftDepth = maxDepth(root->left); - int rightDepth = maxDepth(root->right); - return leftDepth > rightDepth ? ++leftDepth : ++rightDepth; // 如果是叶子节点,leftDepth和rightDepth都是0,返回1. +if (root == NULL) return 0; +int leftDepth = maxDepth(root->left); +int rightDepth = maxDepth(root->right); +return leftDepth > rightDepth ? ++leftDepth : ++rightDepth; // 如果是叶子节点,leftDepth rightDepth都是0,返回1. ``` 这基本就OK了。但看起来不够简洁啊。最后一步不就是求个最大值?用 STL 得了。 + ```cpp if (root == NULL) return 0; return std::max(maxDepth(root->left), maxDepth(root->right))+1; @@ -33,3 +36,7 @@ return std::max(maxDepth(root->left), maxDepth(root->right))+1; 这就是我的最后答案。 PS: C++ 11 更推荐使用 `nullptr` 来代替 `NULL` ,但是原数据结构中使用了 `NULL` ,这里只好妥协。 + +## Python + +思路与 C++ 一致,本来想用迭代的方式写个不一样的,但写完觉得实在太啰嗦了,还是这个解法看起来简洁明了。 diff --git a/002. Maximum Depth of Binary Tree/main.cpp b/103. Maximum Depth of Binary Tree/main.cpp similarity index 100% rename from 002. Maximum Depth of Binary Tree/main.cpp rename to 103. Maximum Depth of Binary Tree/main.cpp diff --git a/002. Maximum Depth of Binary Tree/solution.h b/103. Maximum Depth of Binary Tree/solution.h similarity index 100% rename from 002. Maximum Depth of Binary Tree/solution.h rename to 103. Maximum Depth of Binary Tree/solution.h diff --git a/103. Maximum Depth of Binary Tree/solution.py b/103. Maximum Depth of Binary Tree/solution.py new file mode 100644 index 0000000..35b76f0 --- /dev/null +++ b/103. Maximum Depth of Binary Tree/solution.py @@ -0,0 +1,33 @@ +#!python3 + +class TreeNode: + def __init__(self, x): + self.val = x + self.left = None + self.right = None + + +class Solution: + def maxDepth(self, root): + """ + :type root: TreeNode + :rtype: int + """ + if root is None: + return 0 + return max(self.maxDepth(root.left), self.maxDepth(root.right)) + 1 + + +if __name__ == "__main__": + root = TreeNode(1) + root.left = TreeNode(2) + root.right = TreeNode(3) + root.left.left = TreeNode(4) + root.left.right = TreeNode(5) + root.right.left = TreeNode(6) + root.left.left.left = TreeNode(7) + root.left.left.right = TreeNode(8) + root.left.left.right.left = TreeNode(9) + + print(Solution().maxDepth(root)) + diff --git a/079. Construct Binary Tree from Preorder and Inorder Traversal/README.md b/104. Construct Binary Tree from Preorder and Inorder Traversal/README.md similarity index 100% rename from 079. Construct Binary Tree from Preorder and Inorder Traversal/README.md rename to 104. Construct Binary Tree from Preorder and Inorder Traversal/README.md diff --git a/079. Construct Binary Tree from Preorder and Inorder Traversal/main.cpp b/104. Construct Binary Tree from Preorder and Inorder Traversal/main.cpp similarity index 100% rename from 079. Construct Binary Tree from Preorder and Inorder Traversal/main.cpp rename to 104. Construct Binary Tree from Preorder and Inorder Traversal/main.cpp diff --git a/079. Construct Binary Tree from Preorder and Inorder Traversal/solution.h b/104. Construct Binary Tree from Preorder and Inorder Traversal/solution.h similarity index 100% rename from 079. Construct Binary Tree from Preorder and Inorder Traversal/solution.h rename to 104. Construct Binary Tree from Preorder and Inorder Traversal/solution.h diff --git a/077. Construct Binary Tree from Inorder and Postorder Traversal/README.md b/105. Construct Binary Tree from Inorder and Postorder Traversal/README.md similarity index 100% rename from 077. Construct Binary Tree from Inorder and Postorder Traversal/README.md rename to 105. Construct Binary Tree from Inorder and Postorder Traversal/README.md diff --git a/077. Construct Binary Tree from Inorder and Postorder Traversal/main.cc b/105. Construct Binary Tree from Inorder and Postorder Traversal/main.cc similarity index 100% rename from 077. Construct Binary Tree from Inorder and Postorder Traversal/main.cc rename to 105. Construct Binary Tree from Inorder and Postorder Traversal/main.cc diff --git a/077. Construct Binary Tree from Inorder and Postorder Traversal/solution.h b/105. Construct Binary Tree from Inorder and Postorder Traversal/solution.h similarity index 100% rename from 077. Construct Binary Tree from Inorder and Postorder Traversal/solution.h rename to 105. Construct Binary Tree from Inorder and Postorder Traversal/solution.h diff --git a/040. Binary Tree Level Order Traversal II/README.md b/106. Binary Tree Level Order Traversal II/README.md similarity index 100% rename from 040. Binary Tree Level Order Traversal II/README.md rename to 106. Binary Tree Level Order Traversal II/README.md diff --git a/040. Binary Tree Level Order Traversal II/main.cc b/106. Binary Tree Level Order Traversal II/main.cc similarity index 100% rename from 040. Binary Tree Level Order Traversal II/main.cc rename to 106. Binary Tree Level Order Traversal II/main.cc diff --git a/040. Binary Tree Level Order Traversal II/solution.h b/106. Binary Tree Level Order Traversal II/solution.h similarity index 100% rename from 040. Binary Tree Level Order Traversal II/solution.h rename to 106. Binary Tree Level Order Traversal II/solution.h diff --git a/021. Convert Sorted Array to Binary Search Tree/README.md b/107. Convert Sorted Array to Binary Search Tree/README.md similarity index 100% rename from 021. Convert Sorted Array to Binary Search Tree/README.md rename to 107. Convert Sorted Array to Binary Search Tree/README.md diff --git a/021. Convert Sorted Array to Binary Search Tree/main.cc b/107. Convert Sorted Array to Binary Search Tree/main.cc similarity index 100% rename from 021. Convert Sorted Array to Binary Search Tree/main.cc rename to 107. Convert Sorted Array to Binary Search Tree/main.cc diff --git a/021. Convert Sorted Array to Binary Search Tree/solution.h b/107. Convert Sorted Array to Binary Search Tree/solution.h similarity index 100% rename from 021. Convert Sorted Array to Binary Search Tree/solution.h rename to 107. Convert Sorted Array to Binary Search Tree/solution.h diff --git a/066. Convert Sorted List to Binary Search Tree/README.md b/108. Convert Sorted List to Binary Search Tree/README.md similarity index 100% rename from 066. Convert Sorted List to Binary Search Tree/README.md rename to 108. Convert Sorted List to Binary Search Tree/README.md diff --git a/066. Convert Sorted List to Binary Search Tree/main.cc b/108. Convert Sorted List to Binary Search Tree/main.cc similarity index 100% rename from 066. Convert Sorted List to Binary Search Tree/main.cc rename to 108. Convert Sorted List to Binary Search Tree/main.cc diff --git a/066. Convert Sorted List to Binary Search Tree/solution.h b/108. Convert Sorted List to Binary Search Tree/solution.h similarity index 100% rename from 066. Convert Sorted List to Binary Search Tree/solution.h rename to 108. Convert Sorted List to Binary Search Tree/solution.h diff --git a/022. Balanced Binary Tree/README.md b/109. Balanced Binary Tree/README.md similarity index 100% rename from 022. Balanced Binary Tree/README.md rename to 109. Balanced Binary Tree/README.md diff --git a/022. Balanced Binary Tree/main.cc b/109. Balanced Binary Tree/main.cc similarity index 100% rename from 022. Balanced Binary Tree/main.cc rename to 109. Balanced Binary Tree/main.cc diff --git a/022. Balanced Binary Tree/solution.h b/109. Balanced Binary Tree/solution.h similarity index 100% rename from 022. Balanced Binary Tree/solution.h rename to 109. Balanced Binary Tree/solution.h diff --git a/109. Longest Substring Without Repeating Characters/solution.h b/109. Longest Substring Without Repeating Characters/solution.h deleted file mode 100644 index 6c463e6..0000000 --- a/109. Longest Substring Without Repeating Characters/solution.h +++ /dev/null @@ -1,23 +0,0 @@ -#include -using std::string; -#include -using std::unordered_map; -#include -using std::max; - -class Solution { -public: - int lengthOfLongestSubstring(string s) { - size_t ret=0, start=0; - unordered_map cache = {{s.front(), 0}}; - for (size_t last=1; last < s.size(); ++last) { - auto found = cache.find(s[last]); - if (found != cache.end() && found->second >= start) { - ret = max(ret, last - start); - start = found->second + 1; - } - cache[s[last]] = last; - } - return max(ret, s.size()-start); - } -}; diff --git a/054. Minimum Depth of Binary Tree/README.md b/110. Minimum Depth of Binary Tree/README.md similarity index 100% rename from 054. Minimum Depth of Binary Tree/README.md rename to 110. Minimum Depth of Binary Tree/README.md diff --git a/054. Minimum Depth of Binary Tree/main.cc b/110. Minimum Depth of Binary Tree/main.cc similarity index 100% rename from 054. Minimum Depth of Binary Tree/main.cc rename to 110. Minimum Depth of Binary Tree/main.cc diff --git a/054. Minimum Depth of Binary Tree/solution.h b/110. Minimum Depth of Binary Tree/solution.h similarity index 100% rename from 054. Minimum Depth of Binary Tree/solution.h rename to 110. Minimum Depth of Binary Tree/solution.h diff --git a/049. Path Sum/README.md b/111. Path Sum/README.md similarity index 100% rename from 049. Path Sum/README.md rename to 111. Path Sum/README.md diff --git a/049. Path Sum/TEST.cc b/111. Path Sum/TEST.cc similarity index 100% rename from 049. Path Sum/TEST.cc rename to 111. Path Sum/TEST.cc diff --git a/049. Path Sum/solution.h b/111. Path Sum/solution.h similarity index 100% rename from 049. Path Sum/solution.h rename to 111. Path Sum/solution.h diff --git a/074. Path Sum II/README.md b/112. Path Sum II/README.md similarity index 100% rename from 074. Path Sum II/README.md rename to 112. Path Sum II/README.md diff --git a/074. Path Sum II/main.cc b/112. Path Sum II/main.cc similarity index 100% rename from 074. Path Sum II/main.cc rename to 112. Path Sum II/main.cc diff --git a/074. Path Sum II/solution.h b/112. Path Sum II/solution.h similarity index 100% rename from 074. Path Sum II/solution.h rename to 112. Path Sum II/solution.h diff --git a/060. Flatten Binary Tree to Linked List/README.md b/113. Flatten Binary Tree to Linked List/README.md similarity index 100% rename from 060. Flatten Binary Tree to Linked List/README.md rename to 113. Flatten Binary Tree to Linked List/README.md diff --git a/060. Flatten Binary Tree to Linked List/main.cc b/113. Flatten Binary Tree to Linked List/main.cc similarity index 100% rename from 060. Flatten Binary Tree to Linked List/main.cc rename to 113. Flatten Binary Tree to Linked List/main.cc diff --git a/060. Flatten Binary Tree to Linked List/solution.h b/113. Flatten Binary Tree to Linked List/solution.h similarity index 100% rename from 060. Flatten Binary Tree to Linked List/solution.h rename to 113. Flatten Binary Tree to Linked List/solution.h diff --git a/092. Distinct Subsequences/README.md b/114. Distinct Subsequences/README.md similarity index 100% rename from 092. Distinct Subsequences/README.md rename to 114. Distinct Subsequences/README.md diff --git a/092. Distinct Subsequences/TEST.cc b/114. Distinct Subsequences/TEST.cc similarity index 100% rename from 092. Distinct Subsequences/TEST.cc rename to 114. Distinct Subsequences/TEST.cc diff --git a/092. Distinct Subsequences/solution.h b/114. Distinct Subsequences/solution.h similarity index 100% rename from 092. Distinct Subsequences/solution.h rename to 114. Distinct Subsequences/solution.h diff --git a/010. Populating Next Right Pointers in Each Node/README.md b/115. Populating Next Right Pointers in Each Node/README.md similarity index 100% rename from 010. Populating Next Right Pointers in Each Node/README.md rename to 115. Populating Next Right Pointers in Each Node/README.md diff --git a/010. Populating Next Right Pointers in Each Node/main.cpp b/115. Populating Next Right Pointers in Each Node/main.cpp similarity index 100% rename from 010. Populating Next Right Pointers in Each Node/main.cpp rename to 115. Populating Next Right Pointers in Each Node/main.cpp diff --git a/010. Populating Next Right Pointers in Each Node/solution.h b/115. Populating Next Right Pointers in Each Node/solution.h similarity index 100% rename from 010. Populating Next Right Pointers in Each Node/solution.h rename to 115. Populating Next Right Pointers in Each Node/solution.h diff --git a/047. Populating Next Right Pointers in Each Node II/README.md b/116. Populating Next Right Pointers in Each Node II/README.md similarity index 100% rename from 047. Populating Next Right Pointers in Each Node II/README.md rename to 116. Populating Next Right Pointers in Each Node II/README.md diff --git a/047. Populating Next Right Pointers in Each Node II/main.cpp b/116. Populating Next Right Pointers in Each Node II/main.cpp similarity index 100% rename from 047. Populating Next Right Pointers in Each Node II/main.cpp rename to 116. Populating Next Right Pointers in Each Node II/main.cpp diff --git a/047. Populating Next Right Pointers in Each Node II/solution.h b/116. Populating Next Right Pointers in Each Node II/solution.h similarity index 100% rename from 047. Populating Next Right Pointers in Each Node II/solution.h rename to 116. Populating Next Right Pointers in Each Node II/solution.h diff --git a/032. Pascal's Triangle/README.md b/117. Pascal's Triangle/README.md similarity index 100% rename from 032. Pascal's Triangle/README.md rename to 117. Pascal's Triangle/README.md diff --git a/032. Pascal's Triangle/main.cc b/117. Pascal's Triangle/main.cc similarity index 100% rename from 032. Pascal's Triangle/main.cc rename to 117. Pascal's Triangle/main.cc diff --git a/032. Pascal's Triangle/solution.h b/117. Pascal's Triangle/solution.h similarity index 100% rename from 032. Pascal's Triangle/solution.h rename to 117. Pascal's Triangle/solution.h diff --git a/050. Pascal's Triangle II/README.md b/118. Pascal's Triangle II/README.md similarity index 100% rename from 050. Pascal's Triangle II/README.md rename to 118. Pascal's Triangle II/README.md diff --git a/050. Pascal's Triangle II/main.cc b/118. Pascal's Triangle II/main.cc similarity index 100% rename from 050. Pascal's Triangle II/main.cc rename to 118. Pascal's Triangle II/main.cc diff --git a/050. Pascal's Triangle II/solution.h b/118. Pascal's Triangle II/solution.h similarity index 100% rename from 050. Pascal's Triangle II/solution.h rename to 118. Pascal's Triangle II/solution.h diff --git a/076. Triangle/README.md b/119. Triangle/README.md similarity index 100% rename from 076. Triangle/README.md rename to 119. Triangle/README.md diff --git a/076. Triangle/TEST.cc b/119. Triangle/TEST.cc similarity index 100% rename from 076. Triangle/TEST.cc rename to 119. Triangle/TEST.cc diff --git a/076. Triangle/solution.h b/119. Triangle/solution.h similarity index 100% rename from 076. Triangle/solution.h rename to 119. Triangle/solution.h diff --git a/039. Best Time to Buy and Sell Stock/README.md b/120. Best Time to Buy and Sell Stock/README.md similarity index 100% rename from 039. Best Time to Buy and Sell Stock/README.md rename to 120. Best Time to Buy and Sell Stock/README.md diff --git a/039. Best Time to Buy and Sell Stock/main.cc b/120. Best Time to Buy and Sell Stock/main.cc similarity index 100% rename from 039. Best Time to Buy and Sell Stock/main.cc rename to 120. Best Time to Buy and Sell Stock/main.cc diff --git a/039. Best Time to Buy and Sell Stock/solution.h b/120. Best Time to Buy and Sell Stock/solution.h similarity index 100% rename from 039. Best Time to Buy and Sell Stock/solution.h rename to 120. Best Time to Buy and Sell Stock/solution.h diff --git a/005. Best Time to Buy and Sell Stock II/README.md b/121. Best Time to Buy and Sell Stock II/README.md similarity index 100% rename from 005. Best Time to Buy and Sell Stock II/README.md rename to 121. Best Time to Buy and Sell Stock II/README.md diff --git a/005. Best Time to Buy and Sell Stock II/main.cpp b/121. Best Time to Buy and Sell Stock II/main.cpp similarity index 100% rename from 005. Best Time to Buy and Sell Stock II/main.cpp rename to 121. Best Time to Buy and Sell Stock II/main.cpp diff --git a/005. Best Time to Buy and Sell Stock II/solution.h b/121. Best Time to Buy and Sell Stock II/solution.h similarity index 100% rename from 005. Best Time to Buy and Sell Stock II/solution.h rename to 121. Best Time to Buy and Sell Stock II/solution.h diff --git a/106. Best Time to Buy and Sell Stock III/README.md b/122. Best Time to Buy and Sell Stock III/README.md similarity index 100% rename from 106. Best Time to Buy and Sell Stock III/README.md rename to 122. Best Time to Buy and Sell Stock III/README.md diff --git a/106. Best Time to Buy and Sell Stock III/TEST.cc b/122. Best Time to Buy and Sell Stock III/TEST.cc similarity index 100% rename from 106. Best Time to Buy and Sell Stock III/TEST.cc rename to 122. Best Time to Buy and Sell Stock III/TEST.cc diff --git a/106. Best Time to Buy and Sell Stock III/solution.h b/122. Best Time to Buy and Sell Stock III/solution.h similarity index 100% rename from 106. Best Time to Buy and Sell Stock III/solution.h rename to 122. Best Time to Buy and Sell Stock III/solution.h diff --git a/123. Binary Tree Maximum Path Sum/README.md b/123. Binary Tree Maximum Path Sum/README.md new file mode 100644 index 0000000..a8eb66d --- /dev/null +++ b/123. Binary Tree Maximum Path Sum/README.md @@ -0,0 +1,51 @@ +这道题难点是个障眼法。 + +例子给出的二叉树一点代表性也没,我来给一个,说明题意: + + 1 + / \ + 2 3 + / \ \ + 4 5 6 + +我们列举一下,这里面有多少种可能的路径(限完整的路径): + + 2 1 1 + / \ / \ / \ + 4 5 2 3 2 3 + (11) \ \ / \ + 5 6 4 6 + (17) (16) + +显然,咱们应该返回中间那个 sum, 是 17.这结果是咱们肉眼看出来的,需进一步分析其规律性。 + +首先,右边两个来自同一棵“大树”,为何选择了 17 呢,显然是取最大值。 + +其次,左边那棵树,实际是根节点的左子树。同理我们还可以列出其右子树: + + 3 + \ + 6 + (9) + +那么左子树和右子树若没有这个例子里面这样简单,也有分支呢?那么还是求其最大值即可。咦,这是否有种递归性? + +这个例子还有一个盲点,即所有节点值皆为正数,会不会有负数?如果有负数,可能咱们不需要“完整的路径”。 + +更全局的看,如果某个子树的 max sum 是个负数,还不如没有。“没有”如何表达?是了,`sum == 0.` + +好了,分析到这里,可以开始尝试写递归函数了: + +```cpp +int maxPathSum(TreeNode *root, int &maxSum) { + if (!root) return 0; + int leftMax = std::max(0, maxPathSum(root->left, maxSum)); + int rightMax = std::max(0, maxPathSum(root->right, maxSum)); + maxSum = std::max(sum, root->val + leftMax + rightMax); + return root->val + std::max(leftMax, rightMax); +} +``` + +好像很简单的样子。主函数中,将 `maxSum` 初始化为最小值:`INT_MIN` 即可。 + +提交试试,AC. diff --git a/123. Binary Tree Maximum Path Sum/main.cpp b/123. Binary Tree Maximum Path Sum/main.cpp new file mode 100644 index 0000000..cc9471e --- /dev/null +++ b/123. Binary Tree Maximum Path Sum/main.cpp @@ -0,0 +1,21 @@ +#include "solution.h" +#include + +int main() +{ + Solution s; + TreeNode root(1); + TreeNode node1(2); + TreeNode node2(3); + TreeNode node3(4); + TreeNode node4(5); + TreeNode node5(6); + + root.left = &node1; + root.right = &node2; + node1.left = &node3; + node1.right = &node4; + node2.right = &node5; + + std::cout << s.maxPathSum(&root) << std::endl; +} diff --git a/123. Binary Tree Maximum Path Sum/solution.h b/123. Binary Tree Maximum Path Sum/solution.h new file mode 100644 index 0000000..6dae0e5 --- /dev/null +++ b/123. Binary Tree Maximum Path Sum/solution.h @@ -0,0 +1,26 @@ +#include +#include + +struct TreeNode { + int val; + TreeNode *left; + TreeNode *right; + TreeNode(int x) : val(x), left(NULL), right(NULL) {} +}; + +class Solution { + int maxPathSum(TreeNode *root, int &maxSum) { + if (!root) return 0; + int leftMax = std::max(0, maxPathSum(root->left, maxSum)); + int rightMax = std::max(0, maxPathSum(root->right, maxSum)); + maxSum = std::max(maxSum, leftMax+rightMax+root->val); + return root->val + std::max(leftMax, rightMax); + } + +public: + int maxPathSum(TreeNode *root) { + int maxSum = INT_MIN; + maxPathSum(root, maxSum); + return maxSum; + } +}; diff --git a/104. Valid Palindrome/README.md b/124. Valid Palindrome/README.md similarity index 100% rename from 104. Valid Palindrome/README.md rename to 124. Valid Palindrome/README.md diff --git a/104. Valid Palindrome/TEST.cc b/124. Valid Palindrome/TEST.cc similarity index 100% rename from 104. Valid Palindrome/TEST.cc rename to 124. Valid Palindrome/TEST.cc diff --git a/104. Valid Palindrome/solution.h b/124. Valid Palindrome/solution.h similarity index 100% rename from 104. Valid Palindrome/solution.h rename to 124. Valid Palindrome/solution.h diff --git a/125. Reorder List/README.md b/125. Reorder List/README.md new file mode 100644 index 0000000..0913e90 --- /dev/null +++ b/125. Reorder List/README.md @@ -0,0 +1,53 @@ +举例: + + 1->2->3->4->5->6->7->8 + +要求重排为: + + 1->8->2->7->3->6->4->5 + +看似摸不着头绪,单链表的最大问题不就是没法走回头路吗? + +但如果我们将链表切成两部分呢? + + 1->2->3->4 + 5->6->7->8 + +然后回忆一下链表基本操作,咦,是否将第二个链表逆序一下即可? + + 1->2->3->4 + 8->7->6->5 + +到了这一步,差不多真相大白了吧。两个链表合并,貌似没一点难度。 + +------ + +**具体技术** + +逆序的技巧不需多说,切成两部分,关键是找中点,这个可以利用我们常用的技巧:快慢指针。 + + 1->2->3->4->5->6->7->8->null + ^ ^ ^ ^ ^ ^ ^ ^ ^ + s f | | | | | | | + s | f | | | | | | + s | f | | | | | + s | | f | | | | + s | f | | | + s | f | | + s f | + s f + +可以看到,`s` 正好停在指向 `4` 的地方。 + +逆序之后,链表应呈现以下情形: + + 1->2->3->4->8->7->6->5->null + ^ ^ + head slow + +再进一步,将该链表分为两个: + + 1->2->3->4->null + 8->7->6->5->null + +然后用咱们现成的 `shuffleMerge` 即可。 diff --git a/125. Reorder List/main.cpp b/125. Reorder List/main.cpp new file mode 100644 index 0000000..f8b4f13 --- /dev/null +++ b/125. Reorder List/main.cpp @@ -0,0 +1,37 @@ +#include "solution.h" +#include +#include +using namespace std; + +ListNode *create_linkedlist(std::initializer_list lst) +{ + auto iter = lst.begin(); + ListNode *head = lst.size() ? new ListNode(*iter++) : nullptr; + for (ListNode *cur=head; iter != lst.end(); cur=cur->next) + cur->next = new ListNode(*iter++); + return head; +} + +void clear(ListNode *head) +{ + while (head) { + ListNode *del = head; + head = head->next; + delete del; + } +} + +void printList(ListNode *head) { + for (ListNode *cur = head; cur; cur = cur->next) + cout << cur->val << "->"; + cout << "\b\b " << endl; +} + +int main() +{ + Solution s; + ListNode *a = create_linkedlist({1,2,3,4,5,6,7,8,9}); + s.reorderList(a); + printList(a); + clear(a); +} diff --git a/125. Reorder List/solution.h b/125. Reorder List/solution.h new file mode 100644 index 0000000..859c635 --- /dev/null +++ b/125. Reorder List/solution.h @@ -0,0 +1,55 @@ +#include + +struct ListNode { + int val; + ListNode *next; + ListNode(int x) : val(x), next(NULL) {} +}; + +class Solution { + ListNode* reverseList(ListNode *head) { + ListNode *newHead = NULL; + while (head) { + ListNode *next = head->next; + head->next = newHead; + newHead = head; + head = next; + } + return newHead; + } + + ListNode *shuffleMerge(ListNode *a, ListNode *b) { + ListNode *ret = NULL, **lastRef = &ret; + while (a && b) { + moveNode(lastRef, &a); + lastRef = &((*lastRef)->next); + moveNode(lastRef, &b); + lastRef = &((*lastRef)->next); + } + *lastRef = a ? a : b; + return ret; + } + + void moveNode(ListNode **destRef, ListNode **sourceRef) { + ListNode *newNode = *sourceRef; + *sourceRef = newNode->next; + newNode->next = *destRef; + *destRef = newNode; + } + +public: + void reorderList(ListNode *head) { + if (head == NULL) return; + ListNode *slow = head, *fast = head->next; + while (fast) { + fast = fast->next; + if (fast) { + slow = slow->next; + fast = fast->next; + } + } + ListNode *back = reverseList(slow->next); + slow->next = NULL; + head = shuffleMerge(head, back); + } +}; diff --git a/061. Longest Consecutive Sequence/README.md b/127. Longest Consecutive Sequence/README.md similarity index 100% rename from 061. Longest Consecutive Sequence/README.md rename to 127. Longest Consecutive Sequence/README.md diff --git a/061. Longest Consecutive Sequence/TEST.cc b/127. Longest Consecutive Sequence/TEST.cc similarity index 100% rename from 061. Longest Consecutive Sequence/TEST.cc rename to 127. Longest Consecutive Sequence/TEST.cc diff --git a/061. Longest Consecutive Sequence/solution.h b/127. Longest Consecutive Sequence/solution.h similarity index 100% rename from 061. Longest Consecutive Sequence/solution.h rename to 127. Longest Consecutive Sequence/solution.h diff --git a/052. Sum Root to Leaf Numbers/README.md b/128. Sum Root to Leaf Numbers/README.md similarity index 100% rename from 052. Sum Root to Leaf Numbers/README.md rename to 128. Sum Root to Leaf Numbers/README.md diff --git a/052. Sum Root to Leaf Numbers/main.cc b/128. Sum Root to Leaf Numbers/main.cc similarity index 100% rename from 052. Sum Root to Leaf Numbers/main.cc rename to 128. Sum Root to Leaf Numbers/main.cc diff --git a/052. Sum Root to Leaf Numbers/solution.h b/128. Sum Root to Leaf Numbers/solution.h similarity index 100% rename from 052. Sum Root to Leaf Numbers/solution.h rename to 128. Sum Root to Leaf Numbers/solution.h diff --git a/085. Palindrome Partitioning/README.md b/130. Palindrome Partitioning/README.md similarity index 100% rename from 085. Palindrome Partitioning/README.md rename to 130. Palindrome Partitioning/README.md diff --git a/085. Palindrome Partitioning/main.cc b/130. Palindrome Partitioning/main.cc similarity index 100% rename from 085. Palindrome Partitioning/main.cc rename to 130. Palindrome Partitioning/main.cc diff --git a/085. Palindrome Partitioning/solution.h b/130. Palindrome Partitioning/solution.h similarity index 100% rename from 085. Palindrome Partitioning/solution.h rename to 130. Palindrome Partitioning/solution.h diff --git a/101. Clone Graph/README.md b/132. Clone Graph/README.md similarity index 100% rename from 101. Clone Graph/README.md rename to 132. Clone Graph/README.md diff --git a/101. Clone Graph/main.cpp b/132. Clone Graph/main.cpp similarity index 100% rename from 101. Clone Graph/main.cpp rename to 132. Clone Graph/main.cpp diff --git a/101. Clone Graph/solution.h b/132. Clone Graph/solution.h similarity index 100% rename from 101. Clone Graph/solution.h rename to 132. Clone Graph/solution.h diff --git a/084. Gas Station/README.md b/133. Gas Station/README.md similarity index 100% rename from 084. Gas Station/README.md rename to 133. Gas Station/README.md diff --git a/084. Gas Station/TEST.cc b/133. Gas Station/TEST.cc similarity index 100% rename from 084. Gas Station/TEST.cc rename to 133. Gas Station/TEST.cc diff --git a/084. Gas Station/solution.h b/133. Gas Station/solution.h similarity index 100% rename from 084. Gas Station/solution.h rename to 133. Gas Station/solution.h diff --git a/001. Single Number/README.md b/135. Single Number/README.md similarity index 84% rename from 001. Single Number/README.md rename to 135. Single Number/README.md index fc5c22b..15c2883 100644 --- a/001. Single Number/README.md +++ b/135. Single Number/README.md @@ -1,3 +1,5 @@ +# 思路(C++) + 昨晚看C++ Primer 5th的[习题5.14](https://github.com/pezy/Cpp-Primer/blob/master/ch05/ex5_14.cpp) 想了很常规的解法,但脑子里一直都在想有没有更好的方案,因为这道题很像是在一篇文章里检索连续的高频词。应该是非常常见的才对。 但因为多了一个要求**连续**的条件,所以却又不太一样。 @@ -18,3 +20,9 @@ C++ Primer 5th ==> 4.8. The Bitwise Operators ==> Bitwise AND, OR, and XOR Opera 异或(^)的特点是: **按位,同为0,异为1。** 所以这道题要找"落单"那哥们,就将他们全部异或,相同的小伙伴异或后为0了,可不就剩下那个老光棍了么。 + +## Python + +心血来潮用 python 再刷一遍, 这道题有一种更简洁的写法是用 `reduce`. 为啥我只用了最简单的 `for` 循环呢? + +请见 diff --git a/001. Single Number/main.cpp b/135. Single Number/main.cpp similarity index 91% rename from 001. Single Number/main.cpp rename to 135. Single Number/main.cpp index b9fded2..4add067 100644 --- a/001. Single Number/main.cpp +++ b/135. Single Number/main.cpp @@ -8,6 +8,4 @@ int main() Solution s; int A[7] = {1,2,3,5,2,1,3}; std::cout << s.singleNumber(A, 7) << std::endl; - - return 0; } diff --git a/001. Single Number/solution.h b/135. Single Number/solution.h similarity index 100% rename from 001. Single Number/solution.h rename to 135. Single Number/solution.h diff --git a/135. Single Number/solution.py b/135. Single Number/solution.py new file mode 100644 index 0000000..16fd36e --- /dev/null +++ b/135. Single Number/solution.py @@ -0,0 +1,15 @@ +class Solution: + def singleNumber(self, nums): + """ + :type nums: List[int] + :rtype: int + """ + single = 0 + for num in nums: + single ^= num + return single + + +# test +if __name__ == '__main__': + print(Solution().singleNumber([2, 4, 5, 4, 5, 2, 6, 7, 7])) diff --git a/018. Single Number II/README.md b/136. Single Number II/README.md similarity index 100% rename from 018. Single Number II/README.md rename to 136. Single Number II/README.md diff --git a/018. Single Number II/TEST.cc b/136. Single Number II/TEST.cc similarity index 100% rename from 018. Single Number II/TEST.cc rename to 136. Single Number II/TEST.cc diff --git a/018. Single Number II/solution.h b/136. Single Number II/solution.h similarity index 100% rename from 018. Single Number II/solution.h rename to 136. Single Number II/solution.h diff --git a/100. Copy List with Random Pointer/README.md b/137. Copy List with Random Pointer/README.md similarity index 100% rename from 100. Copy List with Random Pointer/README.md rename to 137. Copy List with Random Pointer/README.md diff --git a/100. Copy List with Random Pointer/main.cpp b/137. Copy List with Random Pointer/main.cpp similarity index 100% rename from 100. Copy List with Random Pointer/main.cpp rename to 137. Copy List with Random Pointer/main.cpp diff --git a/100. Copy List with Random Pointer/solution.h b/137. Copy List with Random Pointer/solution.h similarity index 100% rename from 100. Copy List with Random Pointer/solution.h rename to 137. Copy List with Random Pointer/solution.h diff --git a/116. Word Break/README.md b/138. Word Break/README.md similarity index 100% rename from 116. Word Break/README.md rename to 138. Word Break/README.md diff --git a/116. Word Break/TEST.cc b/138. Word Break/TEST.cc similarity index 100% rename from 116. Word Break/TEST.cc rename to 138. Word Break/TEST.cc diff --git a/116. Word Break/solution.h b/138. Word Break/solution.h similarity index 100% rename from 116. Word Break/solution.h rename to 138. Word Break/solution.h diff --git a/043. Linked List Cycle II/README.md b/141. Linked List Cycle II/README.md similarity index 100% rename from 043. Linked List Cycle II/README.md rename to 141. Linked List Cycle II/README.md diff --git a/043. Linked List Cycle II/main.cc b/141. Linked List Cycle II/main.cc similarity index 100% rename from 043. Linked List Cycle II/main.cc rename to 141. Linked List Cycle II/main.cc diff --git a/043. Linked List Cycle II/solution.h b/141. Linked List Cycle II/solution.h similarity index 100% rename from 043. Linked List Cycle II/solution.h rename to 141. Linked List Cycle II/solution.h diff --git a/009. Binary Tree Preorder Traversal/README.md b/143. Binary Tree Preorder Traversal/README.md similarity index 100% rename from 009. Binary Tree Preorder Traversal/README.md rename to 143. Binary Tree Preorder Traversal/README.md diff --git a/009. Binary Tree Preorder Traversal/main.cpp b/143. Binary Tree Preorder Traversal/main.cpp similarity index 100% rename from 009. Binary Tree Preorder Traversal/main.cpp rename to 143. Binary Tree Preorder Traversal/main.cpp diff --git a/009. Binary Tree Preorder Traversal/solution.h b/143. Binary Tree Preorder Traversal/solution.h similarity index 100% rename from 009. Binary Tree Preorder Traversal/solution.h rename to 143. Binary Tree Preorder Traversal/solution.h diff --git a/042. Binary Tree Postorder Traversal/README.md b/144. Binary Tree Postorder Traversal/README.md similarity index 100% rename from 042. Binary Tree Postorder Traversal/README.md rename to 144. Binary Tree Postorder Traversal/README.md diff --git a/042. Binary Tree Postorder Traversal/main.cc b/144. Binary Tree Postorder Traversal/main.cc similarity index 100% rename from 042. Binary Tree Postorder Traversal/main.cc rename to 144. Binary Tree Postorder Traversal/main.cc diff --git a/042. Binary Tree Postorder Traversal/solution.h b/144. Binary Tree Postorder Traversal/solution.h similarity index 100% rename from 042. Binary Tree Postorder Traversal/solution.h rename to 144. Binary Tree Postorder Traversal/solution.h diff --git a/037. Find Minimum in Rotated Sorted Array/README.md b/152. Find Minimum in Rotated Sorted Array/README.md similarity index 100% rename from 037. Find Minimum in Rotated Sorted Array/README.md rename to 152. Find Minimum in Rotated Sorted Array/README.md diff --git a/037. Find Minimum in Rotated Sorted Array/main.cc b/152. Find Minimum in Rotated Sorted Array/main.cc similarity index 100% rename from 037. Find Minimum in Rotated Sorted Array/main.cc rename to 152. Find Minimum in Rotated Sorted Array/main.cc diff --git a/037. Find Minimum in Rotated Sorted Array/solution.h b/152. Find Minimum in Rotated Sorted Array/solution.h similarity index 100% rename from 037. Find Minimum in Rotated Sorted Array/solution.h rename to 152. Find Minimum in Rotated Sorted Array/solution.h diff --git a/435. Find All Duplicates in an Array/README.md b/435. Find All Duplicates in an Array/README.md new file mode 100644 index 0000000..93beaf8 --- /dev/null +++ b/435. Find All Duplicates in an Array/README.md @@ -0,0 +1,29 @@ +这道题一定要审题,LeetCode 的特点是,题目言简意赅。那么就一定要从字字品味,获取思路。 + +首先,拿到这道题,如果没有这俩限制,是相当简单的: + +1. without extra space +2. O(n) runtime + +其一不让你多用空间,其二只允许一次遍历。这还让不让人活了?算法不就是空间与时间的游戏吗?俩都不让步,怎么玩。 + +沮丧之余,**只好再多读几遍题**。终于发现有几个奇怪的设定: + +1. some elements appear **twice** and others appear **once** +2. `1 <= a[i] <= n` (n = size of array) + +其一,简化场景,数组里要么出现两次,要么出现一次。其二,数组里的数字,肯定大于等于 1,并小于等于**数组长度**。 + +这时候该笑出声了,暗示的不能再明显了。不让你用多余的空间,因为数组里的数,可以无缝转化为 index. 不让你用多余的时间,因为要么两次,要么一次,一次迭代完全足够了。 + +既然数组里每一个数字,都可以映射为 index(这个 index 可以想象成坑位),那么我们就得想,怎么对坑位做个标记,知道这个坑位已经来过人了。 + +这个标记,你大可以按自己喜好来,就是个简单的加密解密思维,取余?+n/-n?都可以,这里最直观的标记,是正负号。为什么呢?因为数字肯定大于1,那么一定是正数,如果出现负数,就可以证明该坑位被用过。 + +于是这道所谓 Medium 的题,就成了 easy 档次的,3行就搞定了: + +```cpp +int index = abs(nums[i]) - 1; +if (nums(index) < 0) ret.push_back(index + 1); +nums[index] = -nums[index]; +``` \ No newline at end of file diff --git a/435. Find All Duplicates in an Array/main.cc b/435. Find All Duplicates in an Array/main.cc new file mode 100644 index 0000000..dd69506 --- /dev/null +++ b/435. Find All Duplicates in an Array/main.cc @@ -0,0 +1,14 @@ +#define CATCH_CONFIG_MAIN +#include "../Catch/single_include/catch.hpp" +#include "solution.h" + +TEST_CASE("Find All Duplicates in an Array", "[findDuplicates]") +{ + SECTION( "as question" ) + { + std::vector vec{4,3,2,7,8,2,3,1}; + std::vector ret{2,3}; + Solution s; + REQUIRE( s.findDuplicates(vec) == ret ); + } +} diff --git a/435. Find All Duplicates in an Array/solution.h b/435. Find All Duplicates in an Array/solution.h new file mode 100644 index 0000000..bdc6b94 --- /dev/null +++ b/435. Find All Duplicates in an Array/solution.h @@ -0,0 +1,15 @@ +#include +using std::vector; + +class Solution { +public: + vector findDuplicates(vector& nums) { + vector ret; + for (size_t i = 0; i != nums.size(); ++i) { + size_t id = static_cast(std::abs(nums[i]) - 1); + if (nums[id] < 0) ret.push_back(id + 1); + nums[id] = -nums[id]; + } + return ret; + } +}; \ No newline at end of file diff --git a/619. Maximum Average Subarray I/README.md b/619. Maximum Average Subarray I/README.md new file mode 100644 index 0000000..95f0d98 --- /dev/null +++ b/619. Maximum Average Subarray I/README.md @@ -0,0 +1,26 @@ +这道题虽然是求平均数,但可以视为求和。且已经规定了连续数组,那么就完全可以想像成一个长度为 k 的滑块。从头滑到尾,统计一下最大那个和就好了。 + +所以最常规的思路就是先求出滑块的初始和: + +```cpp +double sum = 0.0; +for (int i = 0; i != k; ++i) { + sum += nums[i]; +} +``` + +然后滑块开始滑动,滑动的过程可以理解为,去头接尾: + +```cpp +for (int i = 1; i + k <= nums.size(); ++i) { + sum += nums[i+k-1] - nums[i-1]; +} +``` + +然后另设一个变量,如 max_sum 来统计最大的 sum 即可。 + +---- + +稍微 trick 一点的改进呢,就是把滑块想像成一个蠕虫。蠕虫拱起来的最高点就是它前进的标志。那么在这个问题里,我们最关心的就是求和这个过程,所以可以把这个最高点视为求和。 + +那么蠕虫向前移动的步骤,就是不断累加和的过程,但吞一口,必须得拉一次,这个别忘了。 diff --git a/619. Maximum Average Subarray I/main.cc b/619. Maximum Average Subarray I/main.cc new file mode 100644 index 0000000..99a3e82 --- /dev/null +++ b/619. Maximum Average Subarray I/main.cc @@ -0,0 +1,19 @@ +#include "solution.h" +#define CATCH_CONFIG_MAIN +#include "../Catch/single_include/catch.hpp" + +TEST_CASE("Test findMaxAverage", "[vector]") { + Solution s; + SECTION("example case") { + std::vector arr{1, 12, -5, -6, 50, 3}; + int k = 4; + double ans = s.findMaxAverage(arr, k); + REQUIRE(ans == 12.75); + } + SECTION("include zero") { + std::vector arr{0, 4, 0, 3, 2}; + int k = 1; + double ans = s.findMaxAverage(arr, k); + REQUIRE(ans == 4.0); + } +} diff --git a/619. Maximum Average Subarray I/solution.h b/619. Maximum Average Subarray I/solution.h new file mode 100644 index 0000000..5e67488 --- /dev/null +++ b/619. Maximum Average Subarray I/solution.h @@ -0,0 +1,18 @@ +#include +#include +using std::vector; + +class Solution { + public: + double findMaxAverage(vector& nums, int k) { + for (int i = 1; i < k; ++i) { + nums[i] += nums[i - 1]; + } + double sum = nums[k - 1]; + for (int i = k; i < nums.size(); ++i) { + nums[i] += nums[i - 1]; + sum = std::max(sum, nums[i] - nums[i - k]); + } + return sum / k; + } +}; diff --git a/630. Maximum Binary Tree/README.md b/630. Maximum Binary Tree/README.md new file mode 100644 index 0000000..651d184 --- /dev/null +++ b/630. Maximum Binary Tree/README.md @@ -0,0 +1,17 @@ +好久不来做题,为什么百忙之中来写这道题呢。。。 + +因为这被用来作为我司的面试题,而我却竟然还没做过。。。然后一看,果然比较基础,所以在这里写出来也无妨。 + +虽然被标记为 Medium,但实际是 easy 难度的。因为读题就能发现其递归特性。root... left... right... + +所以如果面试遇到这个,你要笑开花了,用最直观的方式,按着题意写递归就好了。 + +首先将原函数拆解为递归形式:`constructMaximumBinaryTree(Iter beg, Iter end)`, 然后实现如下: + +1. root = max(beg, end); +2. root.left = constructMaximumBinaryTree(beg, root_pos) +3. root.right = constructMaximumBinaryTree(root_pos + 1, end) + +完。 + +对算法比较有追求的童鞋可以看下 [Cartesian tree](https://en.wikipedia.org/wiki/Cartesian_tree),这道题的灵感应该是从这里来的。 \ No newline at end of file diff --git a/630. Maximum Binary Tree/main.cc b/630. Maximum Binary Tree/main.cc new file mode 100644 index 0000000..1b241b3 --- /dev/null +++ b/630. Maximum Binary Tree/main.cc @@ -0,0 +1,36 @@ +#include "solution.h" +#include +#include +#include + +void print_bfs(TreeNode* p) +{ + if (!p) return; + std::vector retv; + std::queue q; + q.push(p); + do { + TreeNode *node = q.front(); q.pop(); + if (node) + retv.push_back(std::to_string(node->val)); + else { + retv.push_back("#"); + continue; + } + q.push(node->left); + q.push(node->right); + } while (!q.empty()); + + auto found = std::find_if(retv.rbegin(), retv.rend(), [](const std::string &s){ return s != "#"; }); + retv.erase(found.base(), retv.end()); + for (const auto &s : retv) + std::cout << s << ","; + std::cout << "\b " << std::endl; +} + +int main() +{ + Solution s; + std::vector array{3,2,1,6,0,5}; + print_bfs(s.constructMaximumBinaryTree(array)); +} diff --git a/630. Maximum Binary Tree/solution.h b/630. Maximum Binary Tree/solution.h new file mode 100644 index 0000000..e4ba448 --- /dev/null +++ b/630. Maximum Binary Tree/solution.h @@ -0,0 +1,28 @@ +#include +using std::vector; +#include + +struct TreeNode { + int val; + TreeNode *left; + TreeNode *right; + TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} +}; + +class Solution { +public: + TreeNode* constructMaximumBinaryTree(vector& nums) { + return constructMaximumBinaryTree(nums.cbegin(), nums.cend()); + } +private: + using Iter = vector::const_iterator; + TreeNode* constructMaximumBinaryTree(Iter beg, Iter end) { + if (beg == end) return nullptr; + auto max = std::max_element(beg, end); + TreeNode* root = new TreeNode(*max); + auto max_pos = std::distance(beg, max); + root->left = constructMaximumBinaryTree(beg, max); + root->right = constructMaximumBinaryTree(std::next(max), end); + return root; + } +}; \ No newline at end of file diff --git a/README.md b/README.md index acd0f1f..a1ae5ac 100644 --- a/README.md +++ b/README.md @@ -1,317 +1,719 @@ LeetCode ======== -LeetCode solutions in C++ 11. (From Easy to Hard) +LeetCode solutions in C++ 11 and Python3. -|NO.|Title|Solution|Add Date|Difficulty| -|---|-----|--------|--------|----------| -|1|[Single Number][1]|[C++](001. Single Number/solution.h)|2014/10/15|Medium| -|2|[Maximum Depth of Binary Tree][2]|[C++](002. Maximum Depth of Binary Tree/solution.h)|2014/10/16|Easy| -|3|[Same Tree][3]|[C++](003. Same Tree/solution.h)|2014/10/17|Easy| -|4|[Reverse Integer][4]|[C++](004. Reverse Integer/solution.h)|2014/10/18|Easy| -|5|[Best Time to Buy and Sell Stock II][5]|[C++](005. Best Time to Buy and Sell Stock II/solution.h)|2014/10/19|Medium| -|6|[Unique Binary Search Trees][6]|[C++](006. Unique Binary Search Trees/solution.h)|2014/10/20|Medium| -|7|[Linked List Cycle][7]|[C++](007. Linked List Cycle/solution.h)|2014/10/21|Medium| -|8|[Binary Tree Inorder Traversal][8]|[C++](008. Binary Tree Inorder Traversal/solution.h)|2014/10/22|Medium| -|9|[Binary Tree Preorder Traversal][9]|[C++](009. Binary Tree Preorder Traversal/solution.h)|2014/10/23|Medium| -|10|[Populating Next Right Pointers in Each Node][10]|[C++](010. Populating Next Right Pointers in Each Node/solution.h)|2014/10/24|Medium| -|11|[Search Insert Position][11]|[C++](011. Search Insert Position/solution.h)|2014/10/25|Medium| -|12|[Remove Duplicates from Sorted List][12]|[C++](012. Remove Duplicates from Sorted List/solution.h)|2014/10/26|Easy| -|13|[Climbing Stairs][13]|[C++](013. Climbing Stairs/solution.h)|2014/10/27|Easy| -|14|[Maximum Subarray][14]|[C++](014. Maximum Subarray/solution.h)|2014/10/28|Medium| -|15|[N-Queens II][15]|[C++](015. N-Queens II/solution.h)|2014/10/29|Hard| -|16|[Roman to Integer][16]|[C++](016. Roman to Integer/solution.h)|2014/10/30|Easy| -|17|[Integer to Roman][17]|[C++](017. Integer to Roman/solution.h)|2014/10/31|Medium| -|18|[Single Number II][18]|[C++](018. Single Number II/solution.h)|2014/11/01|Medium| -|19|[Merge Two Sorted Lists][19]|[C++](019. Merge Two Sorted Lists/solution.h)|2014/11/02|Easy| -|20|[Remove Element][20]|[C++](020. Remove Element/solution.h)|2014/11/03|Easy| -|21|[Convert Sorted Array to Binary Search Tree][21]|[C++](021. Convert Sorted Array to Binary Search Tree/solution.h)|2014/11/04|Medium| -|22|[Balanced Binary Tree][22]|[C++](022. Balanced Binary Tree/solution.h)|2014/11/05|Easy| -|23|[Swap Nodes in Pairs][23]|[C++](023. Swap Nodes in Pairs/solution.h)|2014/11/06|Medium| -|24|[Remove Duplicates from Sorted Array][24]|[C++](024. Remove Duplicates from Sorted Array/solution.h)|2014/11/07|Easy| -|25|[Sort Colors][25]|[C++](025. Sort Colors/solution.h)|2014/11/08|Medium| -|26|[Merge Sorted Array][26]|[C++](026. Merge Sorted Array/solution.h)|2014/11/09|Easy| -|27|[Symmetric Tree][27]|[C++](027. Symmetric Tree/solution.h)|2014/11/10|Easy| -|28|[Gray Code][28]|[C++](028. Gray Code/solution.h)|2014/11/11|Medium| -|29|[Unique Paths][29]|[C++](029. Unique Paths/solution.h)|2014/11/12|Medium| -|30|[Plus One][30]|[C++](030. Plus One/solution.h)|2014/11/13|Easy| -|31|[Generate Parentheses][31]|[C++](031. Generate Parentheses/solution.h)|2014/11/14|Medium| -|32|[Pascal's Triangle][32]|[C++](032. Pascal's Triangle/solution.h)|2014/11/15|Easy| -|33|[Container With Most Water][33]|[C++](033. Container With Most Water/solution.h)|2014/11/16|Medium| -|34|[Permutations][34]|[C++](034. Permutations/solution.h)|2014/11/17|Medium| -|35|[Rotate Image][35]|[C++](035. Rotate Image/solution.h)|2014/11/18|Medium| -|36|[Search a 2D Matrix][36]|[C++](036. Search a 2D Matrix/solution.h)|2014/11/19|Medium| -|37|[Find Minimum in Rotated Sorted Array][37]|[C++](037. Find Minimum in Rotated Sorted Array/solution.h)|2014/11/20|Medium| -|38|[Minimum Path Sum][38]|[C++](038. Minimum Path Sum/solution.h)|2014/11/21|Medium| -|39|[Best Time to Buy and Sell Stock][39]|[C++](039. Best Time to Buy and Sell Stock/solution.h)|2014/11/22|Medium| -|40|[Binary Tree Level Order Traversal II][40]|[C++](040. Binary Tree Level Order Traversal II/solution.h)|2014/11/23|Easy| -|41|[Search in Rotated Sorted Array II][41]|[C++](041. Search in Rotated Sorted Array II/solution.h)|2014/11/24|Medium| -|42|[Binary Tree Postorder Traversal][42]|[C++](042. Binary Tree Postorder Traversal/solution.h)|2014/11/25|Hard| -|43|[Linked List Cycle II][43]|[C++](043. Linked List Cycle II/solution.h)|2014/11/26|Medium| -|44|[Set Matrix Zeroes][44]|[C++](044. Set Matrix Zeroes/solution.h)|2014/11/27|Medium| -|45|[Spiral Matrix II][45]|[C++](045. Spiral Matrix II/solution.h)|2014/11/28|Medium| -|46|[Remove Duplicates from Sorted Array II][46]|[C++](046. Remove Duplicates from Sorted Array II/solution.h)|2014/11/29|Medium| -|47|[Populating Next Right Pointers in Each Node II][47]|[C++](047. Populating Next Right Pointers in Each Node II/solution.h)|2014/11/30|Hard| -|48|[Binary Tree Level Order Traversal][48]|[C++](048. Binary Tree Level Order Traversal/solution.h)|2014/12/01|Easy| -|49|[Path Sum][49]|[C++](049. Path Sum/solution.h)|2014/12/02|Easy| -|50|[Pascal's Triangle II][50]|[C++](050. Pascal's Triangle II/solution.h)|2014/12/03|Easy| -|51|[Combinations][51]|[C++](051. Combinations/solution.h)|2014/12/04|Medium| -|52|[Sum Root to Leaf Numbers][52]|[C++](052. Sum Root to Leaf Numbers/solution.h)|2014/12/05|Medium| -|53|[Remove Nth Node from End of List][53]|[C++](053. Remove Nth Node from End of List/solution.h)|2014/12/06|Easy| -|54|[Minimum Depth of Binary Tree][54]|[C++](054. Minimum Depth of Binary Tree/solution.h)|2014/12/07|Easy| -|55|[Length of Last Word][55]|[C++](055. Length of Last Word/solution.h)|2014/12/08|Easy| -|56|[Trapping Rain Water][56]|[C++](056. Trapping Rain Water/solution.h)|2014/12/09|Hard| -|57|[Palindrome Number][57]|[C++](057. Palindrome Number/solution.h)|2014/12/10|Easy| -|58|[Search in Rotated Sorted Array][58]|[C++](058. Search in Rotated Sorted Array/solution.h)|2014/12/11|Hard| -|59|[Valid Parentheses][59]|[C++](059. Valid Parentheses/solution.h)|2014/12/12|Easy| -|60|[Flatten Binary Tree to Linked List][60]|[C++](060. Flatten Binary Tree to Linked List/solution.h)|2014/12/13|Medium| -|61|[Longest Consecutive Sequence][61]|[C++](061. Longest Consecutive Sequence/solution.h)|2014/12/14|Hard| -|62|[Unique Paths II][62]|[C++](062. Unique Paths II/solution.h)|2014/12/15|Medium| -|63|[Subsets][63]|[C++](063. Subsets/solution.h)|2014/12/16|Medium| -|64|[Valid Sudoku][64]|[C++](064. Valid Sudoku/solution.h)|2014/12/17|Easy| -|65|[Unique Binary Search Trees II][65]|[C++](065. Unique Binary Search Trees II/solution.h)|2014/12/18|Medium| -|66|[Convert Sorted List to Binary Search Tree][66]|[C++](066. Convert Sorted List to Binary Search Tree/solution.h)|2014/12/19|Medium| -|67|[Search for a Range][67]|[C++](067. Search for a Range/solution.h)|2014/12/20|Medium| -|68|[Jump Game][68]|[C++](068. Jump Game/solution.h)|2014/12/21|Medium| -|69|[Count and Say][69]|[C++](069. Count and Say/solution.h)|2014/12/22|Easy| -|70|[Longest Common Prefix][70]|[C++](070. Longest Common Prefix/solution.h)|2014/12/23|Easy| -|71|[Subsets II][71]|[C++](071. Subsets II/solution.h)|2014/12/24|Medium| -|72|[Partition List][72]|[C++](072. Partition List/solution.h)|2014/12/25|Medium| -|73|[3Sum Closest][73]|[C++](073. 3Sum Closest/solution.h)|2014/12/26|Medium| -|74|[Path Sum II][74]|[C++](074. Path Sum II/solution.h)|2014/12/27|Medium| -|75|[Combination Sum][75]|[C++](075. Combination Sum/solution.h)|2014/12/28|Medium| -|76|[Triangle][76]|[C++](076. Triangle/solution.h)|2014/12/29|Medium| -|77|[Construct Binary Tree from Inorder and Postorder Traversal][77]|[C++](077. Construct Binary Tree from Inorder and Postorder Traversal/solution.h)|2014/12/30|Medium| -|78|[Binary Tree Zigzag Level Order Traversal][78]|[C++](078. Binary Tree Zigzag Level Order Traversal/solution.h)|2014/12/31|Medium| -|79|[Construct Binary Tree from Preorder and Inorder Traversal][79]|[C++](079. Construct Binary Tree from Preorder and Inorder Traversal/solution.h)|2015/01/01|Medium| -|80|[Letter Combinations of a Phone Number][80]|[C++](080. Letter Combinations of a Phone Number/solution.h)|2015/01/02|Medium| -|81|[Reverse Linked List II][81]|[C++](081. Reverse Linked List II/solution.h)|2015/01/03|Medium| -|82|[Pow(x, n)][82]|[C++](082. Pow(x, n)/solution.h)|2015/01/04|Medium| -|83|[N-Queens][83]|[C++](083. N-Queens/solution.h)|2015/01/05|Hard| -|84|[Gas Station][84]|[C++](084. Gas Station/solution.h)|2015/01/06|Medium| -|85|[Palindrome Partitioning][85]|[C++](085. Palindrome Partitioning/solution.h)|2015/01/07|Medium| -|86|[Validate Binary Search Tree][86]|[C++](086. Validate Binary Search Tree/solution.h)|2015/01/08|Medium| -|87|[Add Binary][87]|[C++](087. Add Binary/solution.h)|2015/01/09|Easy| -|88|[Edit Distance][88]|[C++](088. Edit Distance/solution.h)|2015/01/10|Hard| -|89|[Next Permutation][89]|[C++](089. Next Permutation/solution.h)|2015/01/11|Medium| -|90|[Insertion Sort List][90]|[C++](090. Insertion Sort List/solution.h)|2015/01/12|Medium| -|91|[Reverse Nodes in k-Group][91]|[C++](091. Reverse Nodes in k-Group/solution.h)|2015/01/13|Hard| -|92|[Distinct Subsequences][92]|[C++](092. Distinct Subsequences/solution.h)|2015/01/14|Hard| -|93|[Permutations II][93]|[C++](093. Permutations II/solution.h)|2015/01/15|Hard| -|94|[Remove Duplicates from Sorted List II][94]|[C++](094. Remove Duplicates from Sorted List II/solution.h)|2015/01/16|Medium| -|95|[Jump Game II][95]|[C++](095. Jump Game II/solution.h)|2015/01/17|Hard| -|96|[Combination Sum II][96]|[C++](096. Combination Sum II/solution.h)|2015/01/18|Medium| -|97|[Anagrams][97]|[C++](097. Anagrams/solution.h)|2015/01/19|Medium| -|98|[Recover Binary Search Tree][98]|[C++](098. Recover Binary Search Tree/solution.h)|2015/01/20|Hard| -|99|[ZigZag Conversion][99]|[C++](099. ZigZag Conversion/solution.h)|2015/01/21|Easy| -|100|[Copy List with Random Pointer][100]|[C++](100. Copy List with Random Pointer/solution.h)|2015/01/22|Hard| -|101|[Clone Graph][101]|[C++](101. Clone Graph/solution.h)|2015/01/23|Medium| -|102|[Add Two Numbers][102]|[C++](102. Add Two Numbers/solution.h)|2015/01/24|Medium| -|103|[Scramble String][103]|[C++](103. Scramble String/solution.h)|2015/01/25|Hard| -|104|[Valid Palindrome][104]|[C++](104. Valid Palindrome/solution.h)|2015/01/26|Easy| -|105|[First Missing Positive][105]|[C++](105. First Missing Positive/solution.h)|2015/01/27|Hard| -|106|[Best Time to Buy and Sell Stock III][106]|[C++](106. Best Time to Buy and Sell Stock III/solution.h)|2015/01/28|Hard| -|107|[Sqrt(x)][107]|[C++](107. Sqrt(x)/solution.h)|2015/01/29|Medium| -|108|[Permutation Sequence][108]|[C++](108. Permutation Sequence/solution.h)|2015/01/30|Medium| -|109|[Longest Substring Without Repeating Characters][109]|[C++](109. Longest Substring Without Repeating Characters/solution.h)|2015/01/31|Medium| -|110|[Rotate List][110]|[C++](110. Rotate List/solution.h)|2015/02/01|Medium| -|111|[Implement strStr()][111]|[C++](111. Implement strStr()/solution.h)|2015/02/02|Easy| -|112|[4Sum][112]|[C++](112. 4Sum/solution.h)|2015/02/03|Medium| -|113|[Maximal Rectangle][113]|[C++](113. Maximal Rectangle/solution.h)|2015/02/04|Hard| -|114|[Largest Rectangle in Histogram][114]|[C++](114. Largest Rectangle in Histogram/solution.h)|2015/02/05|Hard| -|115|[Merge k Sorted Lists][115]|[C++](115. Merge k Sorted Lists/solution.h)|2015/02/06|Hard| -|116|[Word Break][116]|[C++](116. Word Break/solution.h)|2015/02/07|Medium| -|117|[Merge Intervals][117]|[C++](117. Merge Intervals/solution.h)|2015/02/08|Hard| -|118|[Sudoku Solver][118]|[C++](118. Sudoku Solver/solution.h)|2015/02/09|Hard| -|119|[Longest Palindromic Substring][119]|[C++](119. Longest Palindromic Substring/solution.h)|2015/02/10|Medium| -|120|[Insert Interval][120]|[C++](120. Insert Interval/solution.h)|2015/02/11|Hard| -|121|[Spiral Matrix][121]|[C++](121. Spiral Matrix/solution.h)|2015/02/12|Medium| -|122|[Sort List][122]|[C++](122. Sort List/solution.h)|2015/02/13|Medium| -|123|[Restore IP Addresses][123]|[C++](123. Restore IP Addresses/solution.h)|2015/02/14|Medium| -|124|[Multiply Strings][124]|[C++](124. Multiply Strings/solution.h)|2015/02/15|Medium| -|125|[Reorder List][125]|[C++](125. Reorder List/solution.h)|2015/02/16|Medium| -|126|[Binary Tree Maximum Path Sum][126]|[C++](126. Binary Tree Maximum Path Sum/solution.h)|2015/02/17|Hard| -|127|[Regular Expression Matching][127]|[C++](127. Regular Expression Matching/solution.h)|2015/02/18|Hard| -|128|[Simplify Path][128]|[C++](128. Simplify Path/solution.h)|2015/02/19|Medium| -|129|[Word Search][129]|[C++](129. Word Search/solution.h)|2015/02/20|Medium| -|130|[Evaluate Reverse Polish Notation][130]|[C++](130. Evaluate Reverse Polish Notation/solution.h)|2015/02/21|Medium| -|131|[Longest Valid Parentheses][131]|[C++](131. Longest Valid Parentheses/solution.h)|2015/02/22|Hard| -|132|[Interleaving String][132]|[C++](132. Interleaving String/solution.h)|2015/02/23|Hard| -|133|[Candy][133]|[C++](133. Candy/solution.h)|2015/02/24|Hard| -|134|[Find Minimum in Rotated Sorted Array II][134]|[C++](134. Find Minimum in Rotated Sorted Array II/solution.h)|2015/02/25|Hard| -|135|[Word Ladder][135]|[C++](135. Word Ladder/solution.h)|2015/02/26|Medium| -|136|[Two Sum][136]|[C++](136. Two Sum/solution.h)|2015/02/27|Medium| -|137|[Palindrome Partitioning II][137]|[C++](137. Palindrome Partitioning II/solution.h)|2015/02/28|Hard| -|138|[Minimum Window Substring][138]|[C++](138. Minimum Window Substring/solution.h)|2015/03/01|Hard| -|139|[Substring with Concatenation of All Words][139]|[C++](139. Substring with Concatenation of All Words/solution.h)|2015/03/02|Hard| -|140|[Median of Two Sorted Arrays][140]|[C++](140. Median of Two Sorted Arrays/solution.h)|2015/03/03|Hard| -|141|[3Sum][141]|[C++](141. 3Sum/solution.h)|2015/03/04|Medium| -|142|[Divide Two Integers][142]|[C++](142. Divide Two Integers/solution.h)|2015/03/05|Medium| -|143|[Word Break II][143]|[C++](143. Word Break II/solution.h)|2015/03/06|Hard| -|144|[Decode Ways][144]|[C++](144. Decode Ways/solution.h)|2015/03/07|Medium| -|145|[Maximum Product Subarray][145]|[C++](145. Maximum Product Subarray/solution.h)|2015/03/08|Medium| -|146|[String to Integer (atoi)][146]|[C++](146. String to Integer (atoi)/solution.h)|2015/03/09|Easy| -|147|[Wildcard Matching][147]|[C++](147. Wildcard Matching/solution.h)|2015/03/10|Hard| -|148|[Surrounded Regions][148]|[C++](148. Surrounded Regions/solution.h)|2015/03/11|Medium| -|149|[Reverse Words in a String][149]|[C++](149. Reverse Words in a String/solution.h)|2015/03/12|Medium| -|150|[LRU Cache][150]|[C++](150. LRU Cache/solution.h)|2015/03/13|Hard| -|151|[Text Justification][151]|[C++](151. Text Justification/solution.h)|2015/03/14|Hard| -|152|[Word Ladder II][152]|[C++](152. Word Ladder II/solution.h)|2015/03/15|Hard| -|153|[Valid Number][153]|[C++](153. Valid Number/solution.h)|2015/03/16|Easy| -|154|[Max Points on a Line][154]|[C++](154. Max Points on a Line/solution.h)|2015/03/17|Hard| +|NO.|Title|Solution|Note|Difficulty|Tag| +|---|-----|--------|----|----------|---| +|0|[Two Sum](https://leetcode.com/problems/two-sum)|[C++](000.%20Two%20Sum/solution.h) [Python](000.%20Two%20Sum/solution.py)|[Note](000.%20Two%20Sum)|Easy|`Mapping`| +|1|[Add Two Numbers](https://leetcode.com/problems/add-two-numbers)|[C++](001.%20Add%20Two%20Numbers/solution.h) [Python](001.%20Add%20Two%20Numbers/solution.py)|[Note](001.%20Add%20Two%20Numbers)|Medium|`LinkedList`| +|2|[Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters)|[C++](002.%20Longest%20Substring%20Without%20Repeating%20Characters/solution.h) [Python](002.%20Longest%20Substring%20Without%20Repeating%20Characters/solution.py)|[Note](002.%20Longest%20Substring%20Without%20Repeating%20Characters)|Medium|`Mapping`| +|3|[Median of Two Sorted Arrays](https://leetcode.com/problems/median-of-two-sorted-arrays)|[C++](003.%20Median%20of%20Two%20Sorted%20Arrays/solution.h) [Python](003.%20Median%20of%20Two%20Sorted%20Arrays/solution.py)|[Note](003.%20Median%20of%20Two%20Sorted%20Arrays)|Hard| +|4|[Longest Palindromic Substring](https://leetcode.com/problems/longest-palindromic-substring)|[C++](004.%20Longest%20Palindromic%20Substring/solution.h) [Python](004.%20Longest%20Palindromic%20Substring/solution.py)|[Note](004.%20Longest%20Palindromic%20Substring)|Medium| +|5|[ZigZag Conversion](https://leetcode.com/problems/zigzag-conversion)|[C++](005.%20ZigZag%20Conversion/solution.h) [Python](005.%20ZigZag%20Conversion/solution.py)|[Note](005.%20ZigZag%20Conversion)|Medium| +|6|[Reverse Integer](https://leetcode.com/problems/reverse-integer)|[C++](006.%20Reverse%20Integer/solution.h) [Python](006.%20Reverse%20Integer/solution.py)|[Note](006.%20Reverse%20Integer)|Easy| +|7|[String to Integer (atoi)](https://leetcode.com/problems/string-to-integer-atoi)|[C++](007.%20String%20to%20Integer%20(atoi)/solution.h) [Python](007.%20String%20to%20Integer%20(atoi)/solution.py)|[Note](007.%20String%20to%20Integer%20(atoi))|Medium| +|8|[Palindrome Number](https://leetcode.com/problems/palindrome-number)|[C++](008.%20Palindrome%20Number/solution.h) [Python](008.%20Palindrome%20Number/solution.py)|[Note](008.%20Palindrome%20Number)|Easy| +|9|[Regular Expression Matching](https://leetcode.com/problems/regular-expression-matching)|[C++](009.%20Regular%20Expression%20Matching/solution.h) [Python](009.%20Regular%20Expression%20Matching/solution.py)|[Note](009.%20Regular%20Expression%20Matching)|Hard| +|10|[Container With Most Water](https://leetcode.com/problems/container-with-most-water)|[C++](010.%20Container%20With%20Most%20Water/solution.h) [Python](010.%20Container%20With%20Most%20Water/solution.py)|[Note](010.%20Container%20With%20Most%20Water)|Medium| +|11|[Integer to Roman](https://leetcode.com/problems/integer-to-roman)|[C++](011.%20Integer%20to%20Roman/solution.h) [Python](011.%20Integer%20to%20Roman/solution.py)|[Note](011.%20Integer%20to%20Roman)|Medium| +|12|[Roman to Integer](https://leetcode.com/problems/roman-to-integer)|[C++](012.%20Roman%20to%20Integer/solution.h) [Python](012.%20Roman%20to%20Integer/solution.py)|[Note](012.%20Roman%20to%20Integer)|Easy| +|13|[Longest Common Prefix](https://leetcode.com/problems/longest-common-prefix)|[C++](013.%20Longest%20Common%20Prefix/solution.h) [Python](013.%20Longest%20Common%20Prefix/solution.py)|[Note](013.%20Longest%20Common%20Prefix)|Easy| +|14|[3Sum](https://leetcode.com/problems/3sum)|[C++](014.%203Sum/solution.h) [Python](014.%203Sum/solution.py)|[Note](014.%203Sum)|Medium| +|15|[3Sum Closest](https://leetcode.com/problems/3sum-closest)|[C++](015.%203Sum%20Closest/solution.h) [Python](015.%203Sum%20Closest/solution.py)|[Note](015.%203Sum%20Closest)|Medium| +|16|[Letter Combinations of a Phone Number](https://leetcode.com/problems/letter-combinations-of-a-phone-number)|[C++](016.%20Letter%20Combinations%20of%20a%20Phone%20Number/solution.h) [Python](016.%20Letter%20Combinations%20of%20a%20Phone%20Number/solution.py)|[Note](016.%20Letter%20Combinations%20of%20a%20Phone%20Number)|Medium| +|17|[4Sum](https://leetcode.com/problems/4sum)|[C++](017.%204Sum/solution.h) [Python](017.%204Sum/solution.py)|[Note](017.%204Sum)|Medium| +|18|[Remove Nth Node From End of List](https://leetcode.com/problems/remove-nth-node-from-end-of-list)|[C++](018.%20Remove%20Nth%20Node%20From%20End%20of%20List/solution.h) [Python](018.%20Remove%20Nth%20Node%20From%20End%20of%20List/solution.py)|[Note](018.%20Remove%20Nth%20Node%20From%20End%20of%20List)|Medium| +|19|[Valid Parentheses](https://leetcode.com/problems/valid-parentheses)|[C++](019.%20Valid%20Parentheses/solution.h) [Python](019.%20Valid%20Parentheses/solution.py)|[Note](019.%20Valid%20Parentheses)|Easy| +|20|[Merge Two Sorted Lists](https://leetcode.com/problems/merge-two-sorted-lists)|[C++](020.%20Merge%20Two%20Sorted%20Lists/solution.h) [Python](020.%20Merge%20Two%20Sorted%20Lists/solution.py)|[Note](020.%20Merge%20Two%20Sorted%20Lists)|Easy| +|21|[Generate Parentheses](https://leetcode.com/problems/generate-parentheses)|[C++](021.%20Generate%20Parentheses/solution.h) [Python](021.%20Generate%20Parentheses/solution.py)|[Note](021.%20Generate%20Parentheses)|Medium| +|22|[Merge k Sorted Lists](https://leetcode.com/problems/merge-k-sorted-lists)|[C++](022.%20Merge%20k%20Sorted%20Lists/solution.h) [Python](022.%20Merge%20k%20Sorted%20Lists/solution.py)|[Note](022.%20Merge%20k%20Sorted%20Lists)|Hard| +|23|[Swap Nodes in Pairs](https://leetcode.com/problems/swap-nodes-in-pairs)|[C++](023.%20Swap%20Nodes%20in%20Pairs/solution.h) [Python](023.%20Swap%20Nodes%20in%20Pairs/solution.py)|[Note](023.%20Swap%20Nodes%20in%20Pairs)|Medium| +|24|[Reverse Nodes in k-Group](https://leetcode.com/problems/reverse-nodes-in-k-group)|[C++](024.%20Reverse%20Nodes%20in%20k-Group/solution.h) [Python](024.%20Reverse%20Nodes%20in%20k-Group/solution.py)|[Note](024.%20Reverse%20Nodes%20in%20k-Group)|Hard| +|25|[Remove Duplicates from Sorted Array](https://leetcode.com/problems/remove-duplicates-from-sorted-array)|[C++](025.%20Remove%20Duplicates%20from%20Sorted%20Array/solution.h) [Python](025.%20Remove%20Duplicates%20from%20Sorted%20Array/solution.py)|[Note](025.%20Remove%20Duplicates%20from%20Sorted%20Array)|Easy| +|26|[Remove Element](https://leetcode.com/problems/remove-element)|[C++](026.%20Remove%20Element/solution.h) [Python](026.%20Remove%20Element/solution.py)|[Note](026.%20Remove%20Element)|Easy| +|27|[Implement strStr()](https://leetcode.com/problems/implement-strstr)|[C++](027.%20Implement%20strStr()/solution.h) [Python](027.%20Implement%20strStr()/solution.py)|[Note](027.%20Implement%20strStr())|Easy| +|28|[Divide Two Integers](https://leetcode.com/problems/divide-two-integers)|[C++](028.%20Divide%20Two%20Integers/solution.h) [Python](028.%20Divide%20Two%20Integers/solution.py)|[Note](028.%20Divide%20Two%20Integers)|Medium| +|29|[Substring with Concatenation of All Words](https://leetcode.com/problems/substring-with-concatenation-of-all-words)|[C++](029.%20Substring%20with%20Concatenation%20of%20All%20Words/solution.h) [Python](029.%20Substring%20with%20Concatenation%20of%20All%20Words/solution.py)|[Note](029.%20Substring%20with%20Concatenation%20of%20All%20Words)|Hard| +|30|[Next Permutation](https://leetcode.com/problems/next-permutation)|[C++](030.%20Next%20Permutation/solution.h) [Python](030.%20Next%20Permutation/solution.py)|[Note](030.%20Next%20Permutation)|Medium| +|31|[Longest Valid Parentheses](https://leetcode.com/problems/longest-valid-parentheses)|[C++](031.%20Longest%20Valid%20Parentheses/solution.h) [Python](031.%20Longest%20Valid%20Parentheses/solution.py)|[Note](031.%20Longest%20Valid%20Parentheses)|Hard| +|32|[Search in Rotated Sorted Array](https://leetcode.com/problems/search-in-rotated-sorted-array)|[C++](032.%20Search%20in%20Rotated%20Sorted%20Array/solution.h) [Python](032.%20Search%20in%20Rotated%20Sorted%20Array/solution.py)|[Note](032.%20Search%20in%20Rotated%20Sorted%20Array)|Medium| +|33|[Search for a Range](https://leetcode.com/problems/search-for-a-range)|[C++](033.%20Search%20for%20a%20Range/solution.h) [Python](033.%20Search%20for%20a%20Range/solution.py)|[Note](033.%20Search%20for%20a%20Range)|Medium| +|34|[Search Insert Position](https://leetcode.com/problems/search-insert-position)|[C++](034.%20Search%20Insert%20Position/solution.h) [Python](034.%20Search%20Insert%20Position/solution.py)|[Note](034.%20Search%20Insert%20Position)|Easy| +|35|[Valid Sudoku](https://leetcode.com/problems/valid-sudoku)|[C++](035.%20Valid%20Sudoku/solution.h) [Python](035.%20Valid%20Sudoku/solution.py)|[Note](035.%20Valid%20Sudoku)|Medium| +|36|[Sudoku Solver](https://leetcode.com/problems/sudoku-solver)|[C++](036.%20Sudoku%20Solver/solution.h) [Python](036.%20Sudoku%20Solver/solution.py)|[Note](036.%20Sudoku%20Solver)|Hard| +|37|[Count and Say](https://leetcode.com/problems/count-and-say)|[C++](037.%20Count%20and%20Say/solution.h) [Python](037.%20Count%20and%20Say/solution.py)|[Note](037.%20Count%20and%20Say)|Easy| +|38|[Combination Sum](https://leetcode.com/problems/combination-sum)|[C++](038.%20Combination%20Sum/solution.h) [Python](038.%20Combination%20Sum/solution.py)|[Note](038.%20Combination%20Sum)|Medium| +|39|[Combination Sum II](https://leetcode.com/problems/combination-sum-ii)|[C++](039.%20Combination%20Sum%20II/solution.h) [Python](039.%20Combination%20Sum%20II/solution.py)|[Note](039.%20Combination%20Sum%20II)|Medium| +|40|[First Missing Positive](https://leetcode.com/problems/first-missing-positive)|[C++](040.%20First%20Missing%20Positive/solution.h) [Python](040.%20First%20Missing%20Positive/solution.py)|[Note](040.%20First%20Missing%20Positive)|Hard| +|41|[Trapping Rain Water](https://leetcode.com/problems/trapping-rain-water)|[C++](041.%20Trapping%20Rain%20Water/solution.h) [Python](041.%20Trapping%20Rain%20Water/solution.py)|[Note](041.%20Trapping%20Rain%20Water)|Hard| +|42|[Multiply Strings](https://leetcode.com/problems/multiply-strings)|[C++](042.%20Multiply%20Strings/solution.h) [Python](042.%20Multiply%20Strings/solution.py)|[Note](042.%20Multiply%20Strings)|Medium| +|43|[Wildcard Matching](https://leetcode.com/problems/wildcard-matching)|[C++](043.%20Wildcard%20Matching/solution.h) [Python](043.%20Wildcard%20Matching/solution.py)|[Note](043.%20Wildcard%20Matching)|Hard| +|44|[Jump Game II](https://leetcode.com/problems/jump-game-ii)|[C++](044.%20Jump%20Game%20II/solution.h) [Python](044.%20Jump%20Game%20II/solution.py)|[Note](044.%20Jump%20Game%20II)|Hard| +|45|[Permutations](https://leetcode.com/problems/permutations)|[C++](045.%20Permutations/solution.h) [Python](045.%20Permutations/solution.py)|[Note](045.%20Permutations)|Medium| +|46|[Permutations II](https://leetcode.com/problems/permutations-ii)|[C++](046.%20Permutations%20II/solution.h) [Python](046.%20Permutations%20II/solution.py)|[Note](046.%20Permutations%20II)|Medium| +|47|[Rotate Image](https://leetcode.com/problems/rotate-image)|[C++](047.%20Rotate%20Image/solution.h) [Python](047.%20Rotate%20Image/solution.py)|[Note](047.%20Rotate%20Image)|Medium| +|48|[Group Anagrams](https://leetcode.com/problems/group-anagrams)|[C++](048.%20Group%20Anagrams/solution.h) [Python](048.%20Group%20Anagrams/solution.py)|[Note](048.%20Group%20Anagrams)|Medium| +|49|[Pow(x, n)](https://leetcode.com/problems/powx-n)|[C++](049.%20Pow(x,%20n)/solution.h) [Python](049.%20Pow(x,%20n)/solution.py)|[Note](049.%20Pow(x,%20n))|Medium| +|50|[N-Queens](https://leetcode.com/problems/n-queens)|[C++](050.%20N-Queens/solution.h) [Python](050.%20N-Queens/solution.py)|[Note](050.%20N-Queens)|Hard| +|51|[N-Queens II](https://leetcode.com/problems/n-queens-ii)|[C++](051.%20N-Queens%20II/solution.h) [Python](051.%20N-Queens%20II/solution.py)|[Note](051.%20N-Queens%20II)|Hard| +|52|[Maximum Subarray](https://leetcode.com/problems/maximum-subarray)|[C++](052.%20Maximum%20Subarray/solution.h) [Python](052.%20Maximum%20Subarray/solution.py)|[Note](052.%20Maximum%20Subarray)|Easy| +|53|[Spiral Matrix](https://leetcode.com/problems/spiral-matrix)|[C++](053.%20Spiral%20Matrix/solution.h) [Python](053.%20Spiral%20Matrix/solution.py)|[Note](053.%20Spiral%20Matrix)|Medium| +|54|[Jump Game](https://leetcode.com/problems/jump-game)|[C++](054.%20Jump%20Game/solution.h) [Python](054.%20Jump%20Game/solution.py)|[Note](054.%20Jump%20Game)|Medium| +|55|[Merge Intervals](https://leetcode.com/problems/merge-intervals)|[C++](055.%20Merge%20Intervals/solution.h) [Python](055.%20Merge%20Intervals/solution.py)|[Note](055.%20Merge%20Intervals)|Medium| +|56|[Insert Interval](https://leetcode.com/problems/insert-interval)|[C++](056.%20Insert%20Interval/solution.h) [Python](056.%20Insert%20Interval/solution.py)|[Note](056.%20Insert%20Interval)|Hard| +|57|[Length of Last Word](https://leetcode.com/problems/length-of-last-word)|[C++](057.%20Length%20of%20Last%20Word/solution.h) [Python](057.%20Length%20of%20Last%20Word/solution.py)|[Note](057.%20Length%20of%20Last%20Word)|Easy| +|58|[Spiral Matrix II](https://leetcode.com/problems/spiral-matrix-ii)|[C++](058.%20Spiral%20Matrix%20II/solution.h) [Python](058.%20Spiral%20Matrix%20II/solution.py)|[Note](058.%20Spiral%20Matrix%20II)|Medium| +|59|[Permutation Sequence](https://leetcode.com/problems/permutation-sequence)|[C++](059.%20Permutation%20Sequence/solution.h) [Python](059.%20Permutation%20Sequence/solution.py)|[Note](059.%20Permutation%20Sequence)|Medium| +|60|[Rotate List](https://leetcode.com/problems/rotate-list)|[C++](060.%20Rotate%20List/solution.h) [Python](060.%20Rotate%20List/solution.py)|[Note](060.%20Rotate%20List)|Medium| +|61|[Unique Paths](https://leetcode.com/problems/unique-paths)|[C++](061.%20Unique%20Paths/solution.h) [Python](061.%20Unique%20Paths/solution.py)|[Note](061.%20Unique%20Paths)|Medium| +|62|[Unique Paths II](https://leetcode.com/problems/unique-paths-ii)|[C++](062.%20Unique%20Paths%20II/solution.h) [Python](062.%20Unique%20Paths%20II/solution.py)|[Note](062.%20Unique%20Paths%20II)|Medium| +|63|[Minimum Path Sum](https://leetcode.com/problems/minimum-path-sum)|[C++](063.%20Minimum%20Path%20Sum/solution.h) [Python](063.%20Minimum%20Path%20Sum/solution.py)|[Note](063.%20Minimum%20Path%20Sum)|Medium| +|64|[Valid Number](https://leetcode.com/problems/valid-number)|[C++](064.%20Valid%20Number/solution.h) [Python](064.%20Valid%20Number/solution.py)|[Note](064.%20Valid%20Number)|Hard| +|65|[Plus One](https://leetcode.com/problems/plus-one)|[C++](065.%20Plus%20One/solution.h) [Python](065.%20Plus%20One/solution.py)|[Note](065.%20Plus%20One)|Easy| +|66|[Add Binary](https://leetcode.com/problems/add-binary)|[C++](066.%20Add%20Binary/solution.h) [Python](066.%20Add%20Binary/solution.py)|[Note](066.%20Add%20Binary)|Easy| +|67|[Text Justification](https://leetcode.com/problems/text-justification)|[C++](067.%20Text%20Justification/solution.h) [Python](067.%20Text%20Justification/solution.py)|[Note](067.%20Text%20Justification)|Hard| +|68|[Sqrt(x)](https://leetcode.com/problems/sqrtx)|[C++](068.%20Sqrt(x)/solution.h) [Python](068.%20Sqrt(x)/solution.py)|[Note](068.%20Sqrt(x))|Easy| +|69|[Climbing Stairs](https://leetcode.com/problems/climbing-stairs)|[C++](069.%20Climbing%20Stairs/solution.h) [Python](069.%20Climbing%20Stairs/solution.py)|[Note](069.%20Climbing%20Stairs)|Easy| +|70|[Simplify Path](https://leetcode.com/problems/simplify-path)|[C++](070.%20Simplify%20Path/solution.h) [Python](070.%20Simplify%20Path/solution.py)|[Note](070.%20Simplify%20Path)|Medium| +|71|[Edit Distance](https://leetcode.com/problems/edit-distance)|[C++](071.%20Edit%20Distance/solution.h) [Python](071.%20Edit%20Distance/solution.py)|[Note](071.%20Edit%20Distance)|Hard| +|72|[Set Matrix Zeroes](https://leetcode.com/problems/set-matrix-zeroes)|[C++](072.%20Set%20Matrix%20Zeroes/solution.h) [Python](072.%20Set%20Matrix%20Zeroes/solution.py)|[Note](072.%20Set%20Matrix%20Zeroes)|Medium| +|73|[Search a 2D Matrix](https://leetcode.com/problems/search-a-2d-matrix)|[C++](073.%20Search%20a%202D%20Matrix/solution.h) [Python](073.%20Search%20a%202D%20Matrix/solution.py)|[Note](073.%20Search%20a%202D%20Matrix)|Medium| +|74|[Sort Colors](https://leetcode.com/problems/sort-colors)|[C++](074.%20Sort%20Colors/solution.h) [Python](074.%20Sort%20Colors/solution.py)|[Note](074.%20Sort%20Colors)|Medium| +|75|[Minimum Window Substring](https://leetcode.com/problems/minimum-window-substring)|[C++](075.%20Minimum%20Window%20Substring/solution.h) [Python](075.%20Minimum%20Window%20Substring/solution.py)|[Note](075.%20Minimum%20Window%20Substring)|Hard| +|76|[Combinations](https://leetcode.com/problems/combinations)|[C++](076.%20Combinations/solution.h) [Python](076.%20Combinations/solution.py)|[Note](076.%20Combinations)|Medium| +|77|[Subsets](https://leetcode.com/problems/subsets)|[C++](077.%20Subsets/solution.h) [Python](077.%20Subsets/solution.py)|[Note](077.%20Subsets)|Medium| +|78|[Word Search](https://leetcode.com/problems/word-search)|[C++](078.%20Word%20Search/solution.h) [Python](078.%20Word%20Search/solution.py)|[Note](078.%20Word%20Search)|Medium| +|79|[Remove Duplicates from Sorted Array II](https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii)|[C++](079.%20Remove%20Duplicates%20from%20Sorted%20Array%20II/solution.h) [Python](079.%20Remove%20Duplicates%20from%20Sorted%20Array%20II/solution.py)|[Note](079.%20Remove%20Duplicates%20from%20Sorted%20Array%20II)|Medium| +|80|[Search in Rotated Sorted Array II](https://leetcode.com/problems/search-in-rotated-sorted-array-ii)|[C++](080.%20Search%20in%20Rotated%20Sorted%20Array%20II/solution.h) [Python](080.%20Search%20in%20Rotated%20Sorted%20Array%20II/solution.py)|[Note](080.%20Search%20in%20Rotated%20Sorted%20Array%20II)|Medium| +|81|[Remove Duplicates from Sorted List II](https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii)|[C++](081.%20Remove%20Duplicates%20from%20Sorted%20List%20II/solution.h) [Python](081.%20Remove%20Duplicates%20from%20Sorted%20List%20II/solution.py)|[Note](081.%20Remove%20Duplicates%20from%20Sorted%20List%20II)|Medium| +|82|[Remove Duplicates from Sorted List](https://leetcode.com/problems/remove-duplicates-from-sorted-list)|[C++](082.%20Remove%20Duplicates%20from%20Sorted%20List/solution.h) [Python](082.%20Remove%20Duplicates%20from%20Sorted%20List/solution.py)|[Note](082.%20Remove%20Duplicates%20from%20Sorted%20List)|Easy| +|83|[Largest Rectangle in Histogram](https://leetcode.com/problems/largest-rectangle-in-histogram)|[C++](083.%20Largest%20Rectangle%20in%20Histogram/solution.h) [Python](083.%20Largest%20Rectangle%20in%20Histogram/solution.py)|[Note](083.%20Largest%20Rectangle%20in%20Histogram)|Hard| +|84|[Maximal Rectangle](https://leetcode.com/problems/maximal-rectangle)|[C++](084.%20Maximal%20Rectangle/solution.h) [Python](084.%20Maximal%20Rectangle/solution.py)|[Note](084.%20Maximal%20Rectangle)|Hard| +|85|[Partition List](https://leetcode.com/problems/partition-list)|[C++](085.%20Partition%20List/solution.h) [Python](085.%20Partition%20List/solution.py)|[Note](085.%20Partition%20List)|Medium| +|86|[Scramble String](https://leetcode.com/problems/scramble-string)|[C++](086.%20Scramble%20String/solution.h) [Python](086.%20Scramble%20String/solution.py)|[Note](086.%20Scramble%20String)|Hard| +|87|[Merge Sorted Array](https://leetcode.com/problems/merge-sorted-array)|[C++](087.%20Merge%20Sorted%20Array/solution.h) [Python](087.%20Merge%20Sorted%20Array/solution.py)|[Note](087.%20Merge%20Sorted%20Array)|Easy| +|88|[Gray Code](https://leetcode.com/problems/gray-code)|[C++](088.%20Gray%20Code/solution.h) [Python](088.%20Gray%20Code/solution.py)|[Note](088.%20Gray%20Code)|Medium| +|89|[Subsets II](https://leetcode.com/problems/subsets-ii)|[C++](089.%20Subsets%20II/solution.h) [Python](089.%20Subsets%20II/solution.py)|[Note](089.%20Subsets%20II)|Medium| +|90|[Decode Ways](https://leetcode.com/problems/decode-ways)|[C++](090.%20Decode%20Ways/solution.h) [Python](090.%20Decode%20Ways/solution.py)|[Note](090.%20Decode%20Ways)|Medium| +|91|[Reverse Linked List II](https://leetcode.com/problems/reverse-linked-list-ii)|[C++](091.%20Reverse%20Linked%20List%20II/solution.h) [Python](091.%20Reverse%20Linked%20List%20II/solution.py)|[Note](091.%20Reverse%20Linked%20List%20II)|Medium| +|92|[Restore IP Addresses](https://leetcode.com/problems/restore-ip-addresses)|[C++](092.%20Restore%20IP%20Addresses/solution.h) [Python](092.%20Restore%20IP%20Addresses/solution.py)|[Note](092.%20Restore%20IP%20Addresses)|Medium| +|93|[Binary Tree Inorder Traversal](https://leetcode.com/problems/binary-tree-inorder-traversal)|[C++](093.%20Binary%20Tree%20Inorder%20Traversal/solution.h) [Python](093.%20Binary%20Tree%20Inorder%20Traversal/solution.py)|[Note](093.%20Binary%20Tree%20Inorder%20Traversal)|Medium| +|94|[Unique Binary Search Trees II](https://leetcode.com/problems/unique-binary-search-trees-ii)|[C++](094.%20Unique%20Binary%20Search%20Trees%20II/solution.h) [Python](094.%20Unique%20Binary%20Search%20Trees%20II/solution.py)|[Note](094.%20Unique%20Binary%20Search%20Trees%20II)|Medium| +|95|[Unique Binary Search Trees](https://leetcode.com/problems/unique-binary-search-trees)|[C++](095.%20Unique%20Binary%20Search%20Trees/solution.h) [Python](095.%20Unique%20Binary%20Search%20Trees/solution.py)|[Note](095.%20Unique%20Binary%20Search%20Trees)|Medium| +|96|[Interleaving String](https://leetcode.com/problems/interleaving-string)|[C++](096.%20Interleaving%20String/solution.h) [Python](096.%20Interleaving%20String/solution.py)|[Note](096.%20Interleaving%20String)|Hard| +|97|[Validate Binary Search Tree](https://leetcode.com/problems/validate-binary-search-tree)|[C++](097.%20Validate%20Binary%20Search%20Tree/solution.h) [Python](097.%20Validate%20Binary%20Search%20Tree/solution.py)|[Note](097.%20Validate%20Binary%20Search%20Tree)|Medium| +|98|[Recover Binary Search Tree](https://leetcode.com/problems/recover-binary-search-tree)|[C++](098.%20Recover%20Binary%20Search%20Tree/solution.h) [Python](098.%20Recover%20Binary%20Search%20Tree/solution.py)|[Note](098.%20Recover%20Binary%20Search%20Tree)|Hard| +|99|[Same Tree](https://leetcode.com/problems/same-tree)|[C++](099.%20Same%20Tree/solution.h) [Python](099.%20Same%20Tree/solution.py)|[Note](099.%20Same%20Tree)|Easy| +|100|[Symmetric Tree](https://leetcode.com/problems/symmetric-tree)|[C++](100.%20Symmetric%20Tree/solution.h) [Python](100.%20Symmetric%20Tree/solution.py)|[Note](100.%20Symmetric%20Tree)|Easy| +|101|[Binary Tree Level Order Traversal](https://leetcode.com/problems/binary-tree-level-order-traversal)|[C++](101.%20Binary%20Tree%20Level%20Order%20Traversal/solution.h) [Python](101.%20Binary%20Tree%20Level%20Order%20Traversal/solution.py)|[Note](101.%20Binary%20Tree%20Level%20Order%20Traversal)|Medium| +|102|[Binary Tree Zigzag Level Order Traversal](https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal)|[C++](102.%20Binary%20Tree%20Zigzag%20Level%20Order%20Traversal/solution.h) [Python](102.%20Binary%20Tree%20Zigzag%20Level%20Order%20Traversal/solution.py)|[Note](102.%20Binary%20Tree%20Zigzag%20Level%20Order%20Traversal)|Medium| +|103|[Maximum Depth of Binary Tree](https://leetcode.com/problems/maximum-depth-of-binary-tree)|[C++](103.%20Maximum%20Depth%20of%20Binary%20Tree/solution.h) [Python](103.%20Maximum%20Depth%20of%20Binary%20Tree/solution.py)|[Note](103.%20Maximum%20Depth%20of%20Binary%20Tree)|Easy| +|104|[Construct Binary Tree from Preorder and Inorder Traversal](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal)|[C++](104.%20Construct%20Binary%20Tree%20from%20Preorder%20and%20Inorder%20Traversal/solution.h) [Python](104.%20Construct%20Binary%20Tree%20from%20Preorder%20and%20Inorder%20Traversal/solution.py)|[Note](104.%20Construct%20Binary%20Tree%20from%20Preorder%20and%20Inorder%20Traversal)|Medium| +|105|[Construct Binary Tree from Inorder and Postorder Traversal](https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal)|[C++](105.%20Construct%20Binary%20Tree%20from%20Inorder%20and%20Postorder%20Traversal/solution.h) [Python](105.%20Construct%20Binary%20Tree%20from%20Inorder%20and%20Postorder%20Traversal/solution.py)|[Note](105.%20Construct%20Binary%20Tree%20from%20Inorder%20and%20Postorder%20Traversal)|Medium| +|106|[Binary Tree Level Order Traversal II](https://leetcode.com/problems/binary-tree-level-order-traversal-ii)|[C++](106.%20Binary%20Tree%20Level%20Order%20Traversal%20II/solution.h) [Python](106.%20Binary%20Tree%20Level%20Order%20Traversal%20II/solution.py)|[Note](106.%20Binary%20Tree%20Level%20Order%20Traversal%20II)|Easy| +|107|[Convert Sorted Array to Binary Search Tree](https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree)|[C++](107.%20Convert%20Sorted%20Array%20to%20Binary%20Search%20Tree/solution.h) [Python](107.%20Convert%20Sorted%20Array%20to%20Binary%20Search%20Tree/solution.py)|[Note](107.%20Convert%20Sorted%20Array%20to%20Binary%20Search%20Tree)|Easy| +|108|[Convert Sorted List to Binary Search Tree](https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree)|[C++](108.%20Convert%20Sorted%20List%20to%20Binary%20Search%20Tree/solution.h) [Python](108.%20Convert%20Sorted%20List%20to%20Binary%20Search%20Tree/solution.py)|[Note](108.%20Convert%20Sorted%20List%20to%20Binary%20Search%20Tree)|Medium| +|109|[Balanced Binary Tree](https://leetcode.com/problems/balanced-binary-tree)|[C++](109.%20Balanced%20Binary%20Tree/solution.h) [Python](109.%20Balanced%20Binary%20Tree/solution.py)|[Note](109.%20Balanced%20Binary%20Tree)|Easy| +|110|[Minimum Depth of Binary Tree](https://leetcode.com/problems/minimum-depth-of-binary-tree)|[C++](110.%20Minimum%20Depth%20of%20Binary%20Tree/solution.h) [Python](110.%20Minimum%20Depth%20of%20Binary%20Tree/solution.py)|[Note](110.%20Minimum%20Depth%20of%20Binary%20Tree)|Easy| +|111|[Path Sum](https://leetcode.com/problems/path-sum)|[C++](111.%20Path%20Sum/solution.h) [Python](111.%20Path%20Sum/solution.py)|[Note](111.%20Path%20Sum)|Easy| +|112|[Path Sum II](https://leetcode.com/problems/path-sum-ii)|[C++](112.%20Path%20Sum%20II/solution.h) [Python](112.%20Path%20Sum%20II/solution.py)|[Note](112.%20Path%20Sum%20II)|Medium| +|113|[Flatten Binary Tree to Linked List](https://leetcode.com/problems/flatten-binary-tree-to-linked-list)|[C++](113.%20Flatten%20Binary%20Tree%20to%20Linked%20List/solution.h) [Python](113.%20Flatten%20Binary%20Tree%20to%20Linked%20List/solution.py)|[Note](113.%20Flatten%20Binary%20Tree%20to%20Linked%20List)|Medium| +|114|[Distinct Subsequences](https://leetcode.com/problems/distinct-subsequences)|[C++](114.%20Distinct%20Subsequences/solution.h) [Python](114.%20Distinct%20Subsequences/solution.py)|[Note](114.%20Distinct%20Subsequences)|Hard| +|115|[Populating Next Right Pointers in Each Node](https://leetcode.com/problems/populating-next-right-pointers-in-each-node)|[C++](115.%20Populating%20Next%20Right%20Pointers%20in%20Each%20Node/solution.h) [Python](115.%20Populating%20Next%20Right%20Pointers%20in%20Each%20Node/solution.py)|[Note](115.%20Populating%20Next%20Right%20Pointers%20in%20Each%20Node)|Medium| +|116|[Populating Next Right Pointers in Each Node II](https://leetcode.com/problems/populating-next-right-pointers-in-each-node-ii)|[C++](116.%20Populating%20Next%20Right%20Pointers%20in%20Each%20Node%20II/solution.h) [Python](116.%20Populating%20Next%20Right%20Pointers%20in%20Each%20Node%20II/solution.py)|[Note](116.%20Populating%20Next%20Right%20Pointers%20in%20Each%20Node%20II)|Medium| +|117|[Pascal's Triangle](https://leetcode.com/problems/pascals-triangle)|[C++](117.%20Pascal's%20Triangle/solution.h) [Python](117.%20Pascal's%20Triangle/solution.py)|[Note](117.%20Pascal's%20Triangle)|Easy| +|118|[Pascal's Triangle II](https://leetcode.com/problems/pascals-triangle-ii)|[C++](118.%20Pascal's%20Triangle%20II/solution.h) [Python](118.%20Pascal's%20Triangle%20II/solution.py)|[Note](118.%20Pascal's%20Triangle%20II)|Easy| +|119|[Triangle](https://leetcode.com/problems/triangle)|[C++](119.%20Triangle/solution.h) [Python](119.%20Triangle/solution.py)|[Note](119.%20Triangle)|Medium| +|120|[Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock)|[C++](120.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock/solution.h) [Python](120.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock/solution.py)|[Note](120.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock)|Easy| +|121|[Best Time to Buy and Sell Stock II](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii)|[C++](121.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock%20II/solution.h) [Python](121.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock%20II/solution.py)|[Note](121.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock%20II)|Easy| +|122|[Best Time to Buy and Sell Stock III](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii)|[C++](122.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock%20III/solution.h) [Python](122.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock%20III/solution.py)|[Note](122.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock%20III)|Hard| +|123|[Binary Tree Maximum Path Sum](https://leetcode.com/problems/binary-tree-maximum-path-sum)|[C++](123.%20Binary%20Tree%20Maximum%20Path%20Sum/solution.h) [Python](123.%20Binary%20Tree%20Maximum%20Path%20Sum/solution.py)|[Note](123.%20Binary%20Tree%20Maximum%20Path%20Sum)|Hard| +|124|[Valid Palindrome](https://leetcode.com/problems/valid-palindrome)|[C++](124.%20Valid%20Palindrome/solution.h) [Python](124.%20Valid%20Palindrome/solution.py)|[Note](124.%20Valid%20Palindrome)|Easy| +|125|[Word Ladder II](https://leetcode.com/problems/word-ladder-ii)|[C++](125.%20Word%20Ladder%20II/solution.h) [Python](125.%20Word%20Ladder%20II/solution.py)|[Note](125.%20Word%20Ladder%20II)|Hard| +|126|[Word Ladder](https://leetcode.com/problems/word-ladder)|[C++](126.%20Word%20Ladder/solution.h) [Python](126.%20Word%20Ladder/solution.py)|[Note](126.%20Word%20Ladder)|Medium| +|127|[Longest Consecutive Sequence](https://leetcode.com/problems/longest-consecutive-sequence)|[C++](127.%20Longest%20Consecutive%20Sequence/solution.h) [Python](127.%20Longest%20Consecutive%20Sequence/solution.py)|[Note](127.%20Longest%20Consecutive%20Sequence)|Hard| +|128|[Sum Root to Leaf Numbers](https://leetcode.com/problems/sum-root-to-leaf-numbers)|[C++](128.%20Sum%20Root%20to%20Leaf%20Numbers/solution.h) [Python](128.%20Sum%20Root%20to%20Leaf%20Numbers/solution.py)|[Note](128.%20Sum%20Root%20to%20Leaf%20Numbers)|Medium| +|129|[Surrounded Regions](https://leetcode.com/problems/surrounded-regions)|[C++](129.%20Surrounded%20Regions/solution.h) [Python](129.%20Surrounded%20Regions/solution.py)|[Note](129.%20Surrounded%20Regions)|Medium| +|130|[Palindrome Partitioning](https://leetcode.com/problems/palindrome-partitioning)|[C++](130.%20Palindrome%20Partitioning/solution.h) [Python](130.%20Palindrome%20Partitioning/solution.py)|[Note](130.%20Palindrome%20Partitioning)|Medium| +|131|[Palindrome Partitioning II](https://leetcode.com/problems/palindrome-partitioning-ii)|[C++](131.%20Palindrome%20Partitioning%20II/solution.h) [Python](131.%20Palindrome%20Partitioning%20II/solution.py)|[Note](131.%20Palindrome%20Partitioning%20II)|Hard| +|132|[Clone Graph](https://leetcode.com/problems/clone-graph)|[C++](132.%20Clone%20Graph/solution.h) [Python](132.%20Clone%20Graph/solution.py)|[Note](132.%20Clone%20Graph)|Medium| +|133|[Gas Station](https://leetcode.com/problems/gas-station)|[C++](133.%20Gas%20Station/solution.h) [Python](133.%20Gas%20Station/solution.py)|[Note](133.%20Gas%20Station)|Medium| +|134|[Candy](https://leetcode.com/problems/candy)|[C++](134.%20Candy/solution.h) [Python](134.%20Candy/solution.py)|[Note](134.%20Candy)|Hard| +|135|[Single Number](https://leetcode.com/problems/single-number)|[C++](135.%20Single%20Number/solution.h) [Python](135.%20Single%20Number/solution.py)|[Note](135.%20Single%20Number)|Easy| +|136|[Single Number II](https://leetcode.com/problems/single-number-ii)|[C++](136.%20Single%20Number%20II/solution.h) [Python](136.%20Single%20Number%20II/solution.py)|[Note](136.%20Single%20Number%20II)|Medium| +|137|[Copy List with Random Pointer](https://leetcode.com/problems/copy-list-with-random-pointer)|[C++](137.%20Copy%20List%20with%20Random%20Pointer/solution.h) [Python](137.%20Copy%20List%20with%20Random%20Pointer/solution.py)|[Note](137.%20Copy%20List%20with%20Random%20Pointer)|Medium| +|138|[Word Break](https://leetcode.com/problems/word-break)|[C++](138.%20Word%20Break/solution.h) [Python](138.%20Word%20Break/solution.py)|[Note](138.%20Word%20Break)|Medium| +|139|[Word Break II](https://leetcode.com/problems/word-break-ii)|[C++](139.%20Word%20Break%20II/solution.h) [Python](139.%20Word%20Break%20II/solution.py)|[Note](139.%20Word%20Break%20II)|Hard| +|140|[Linked List Cycle](https://leetcode.com/problems/linked-list-cycle)|[C++](140.%20Linked%20List%20Cycle/solution.h) [Python](140.%20Linked%20List%20Cycle/solution.py)|[Note](140.%20Linked%20List%20Cycle)|Easy| +|141|[Linked List Cycle II](https://leetcode.com/problems/linked-list-cycle-ii)|[C++](141.%20Linked%20List%20Cycle%20II/solution.h) [Python](141.%20Linked%20List%20Cycle%20II/solution.py)|[Note](141.%20Linked%20List%20Cycle%20II)|Medium| +|142|[Reorder List](https://leetcode.com/problems/reorder-list)|[C++](142.%20Reorder%20List/solution.h) [Python](142.%20Reorder%20List/solution.py)|[Note](142.%20Reorder%20List)|Medium| +|143|[Binary Tree Preorder Traversal](https://leetcode.com/problems/binary-tree-preorder-traversal)|[C++](143.%20Binary%20Tree%20Preorder%20Traversal/solution.h) [Python](143.%20Binary%20Tree%20Preorder%20Traversal/solution.py)|[Note](143.%20Binary%20Tree%20Preorder%20Traversal)|Medium| +|144|[Binary Tree Postorder Traversal](https://leetcode.com/problems/binary-tree-postorder-traversal)|[C++](144.%20Binary%20Tree%20Postorder%20Traversal/solution.h) [Python](144.%20Binary%20Tree%20Postorder%20Traversal/solution.py)|[Note](144.%20Binary%20Tree%20Postorder%20Traversal)|Hard| +|145|[LRU Cache](https://leetcode.com/problems/lru-cache)|[C++](145.%20LRU%20Cache/solution.h) [Python](145.%20LRU%20Cache/solution.py)|[Note](145.%20LRU%20Cache)|Hard| +|146|[Insertion Sort List](https://leetcode.com/problems/insertion-sort-list)|[C++](146.%20Insertion%20Sort%20List/solution.h) [Python](146.%20Insertion%20Sort%20List/solution.py)|[Note](146.%20Insertion%20Sort%20List)|Medium| +|147|[Sort List](https://leetcode.com/problems/sort-list)|[C++](147.%20Sort%20List/solution.h) [Python](147.%20Sort%20List/solution.py)|[Note](147.%20Sort%20List)|Medium| +|148|[Max Points on a Line](https://leetcode.com/problems/max-points-on-a-line)|[C++](148.%20Max%20Points%20on%20a%20Line/solution.h) [Python](148.%20Max%20Points%20on%20a%20Line/solution.py)|[Note](148.%20Max%20Points%20on%20a%20Line)|Hard| +|149|[Evaluate Reverse Polish Notation](https://leetcode.com/problems/evaluate-reverse-polish-notation)|[C++](149.%20Evaluate%20Reverse%20Polish%20Notation/solution.h) [Python](149.%20Evaluate%20Reverse%20Polish%20Notation/solution.py)|[Note](149.%20Evaluate%20Reverse%20Polish%20Notation)|Medium| +|150|[Reverse Words in a String](https://leetcode.com/problems/reverse-words-in-a-string)|[C++](150.%20Reverse%20Words%20in%20a%20String/solution.h) [Python](150.%20Reverse%20Words%20in%20a%20String/solution.py)|[Note](150.%20Reverse%20Words%20in%20a%20String)|Medium| +|151|[Maximum Product Subarray](https://leetcode.com/problems/maximum-product-subarray)|[C++](151.%20Maximum%20Product%20Subarray/solution.h) [Python](151.%20Maximum%20Product%20Subarray/solution.py)|[Note](151.%20Maximum%20Product%20Subarray)|Medium| +|152|[Find Minimum in Rotated Sorted Array](https://leetcode.com/problems/find-minimum-in-rotated-sorted-array)|[C++](152.%20Find%20Minimum%20in%20Rotated%20Sorted%20Array/solution.h) [Python](152.%20Find%20Minimum%20in%20Rotated%20Sorted%20Array/solution.py)|[Note](152.%20Find%20Minimum%20in%20Rotated%20Sorted%20Array)|Medium| +|153|[Find Minimum in Rotated Sorted Array II](https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii)|[C++](153.%20Find%20Minimum%20in%20Rotated%20Sorted%20Array%20II/solution.h) [Python](153.%20Find%20Minimum%20in%20Rotated%20Sorted%20Array%20II/solution.py)|[Note](153.%20Find%20Minimum%20in%20Rotated%20Sorted%20Array%20II)|Hard| +|154|[Min Stack](https://leetcode.com/problems/min-stack)|[C++](154.%20Min%20Stack/solution.h) [Python](154.%20Min%20Stack/solution.py)|[Note](154.%20Min%20Stack)|Easy| +|155|[Binary Tree Upside Down](https://leetcode.com/problems/binary-tree-upside-down)|[C++](155.%20Binary%20Tree%20Upside%20Down/solution.h) [Python](155.%20Binary%20Tree%20Upside%20Down/solution.py)|[Note](155.%20Binary%20Tree%20Upside%20Down)|None| +|156|[Read N Characters Given Read4](https://leetcode.com/problems/read-n-characters-given-read4)|[C++](156.%20Read%20N%20Characters%20Given%20Read4/solution.h) [Python](156.%20Read%20N%20Characters%20Given%20Read4/solution.py)|[Note](156.%20Read%20N%20Characters%20Given%20Read4)|None| +|157|[Read N Characters Given Read4 II - Call multiple times](https://leetcode.com/problems/read-n-characters-given-read4-ii-call-multiple-times)|[C++](157.%20Read%20N%20Characters%20Given%20Read4%20II%20-%20Call%20multiple%20times/solution.h) [Python](157.%20Read%20N%20Characters%20Given%20Read4%20II%20-%20Call%20multiple%20times/solution.py)|[Note](157.%20Read%20N%20Characters%20Given%20Read4%20II%20-%20Call%20multiple%20times)|None| +|158|[Longest Substring with At Most Two Distinct Characters](https://leetcode.com/problems/longest-substring-with-at-most-two-distinct-characters)|[C++](158.%20Longest%20Substring%20with%20At%20Most%20Two%20Distinct%20Characters/solution.h) [Python](158.%20Longest%20Substring%20with%20At%20Most%20Two%20Distinct%20Characters/solution.py)|[Note](158.%20Longest%20Substring%20with%20At%20Most%20Two%20Distinct%20Characters)|None| +|159|[Intersection of Two Linked Lists](https://leetcode.com/problems/intersection-of-two-linked-lists)|[C++](159.%20Intersection%20of%20Two%20Linked%20Lists/solution.h) [Python](159.%20Intersection%20of%20Two%20Linked%20Lists/solution.py)|[Note](159.%20Intersection%20of%20Two%20Linked%20Lists)|Easy| +|160|[One Edit Distance](https://leetcode.com/problems/one-edit-distance)|[C++](160.%20One%20Edit%20Distance/solution.h) [Python](160.%20One%20Edit%20Distance/solution.py)|[Note](160.%20One%20Edit%20Distance)|None| +|161|[Find Peak Element](https://leetcode.com/problems/find-peak-element)|[C++](161.%20Find%20Peak%20Element/solution.h) [Python](161.%20Find%20Peak%20Element/solution.py)|[Note](161.%20Find%20Peak%20Element)|Medium| +|162|[Missing Ranges](https://leetcode.com/problems/missing-ranges)|[C++](162.%20Missing%20Ranges/solution.h) [Python](162.%20Missing%20Ranges/solution.py)|[Note](162.%20Missing%20Ranges)|None| +|163|[Maximum Gap](https://leetcode.com/problems/maximum-gap)|[C++](163.%20Maximum%20Gap/solution.h) [Python](163.%20Maximum%20Gap/solution.py)|[Note](163.%20Maximum%20Gap)|Hard| +|164|[Compare Version Numbers](https://leetcode.com/problems/compare-version-numbers)|[C++](164.%20Compare%20Version%20Numbers/solution.h) [Python](164.%20Compare%20Version%20Numbers/solution.py)|[Note](164.%20Compare%20Version%20Numbers)|Medium| +|165|[Fraction to Recurring Decimal](https://leetcode.com/problems/fraction-to-recurring-decimal)|[C++](165.%20Fraction%20to%20Recurring%20Decimal/solution.h) [Python](165.%20Fraction%20to%20Recurring%20Decimal/solution.py)|[Note](165.%20Fraction%20to%20Recurring%20Decimal)|Medium| +|166|[Two Sum II - Input array is sorted](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted)|[C++](166.%20Two%20Sum%20II%20-%20Input%20array%20is%20sorted/solution.h) [Python](166.%20Two%20Sum%20II%20-%20Input%20array%20is%20sorted/solution.py)|[Note](166.%20Two%20Sum%20II%20-%20Input%20array%20is%20sorted)|Easy| +|167|[Excel Sheet Column Title](https://leetcode.com/problems/excel-sheet-column-title)|[C++](167.%20Excel%20Sheet%20Column%20Title/solution.h) [Python](167.%20Excel%20Sheet%20Column%20Title/solution.py)|[Note](167.%20Excel%20Sheet%20Column%20Title)|Easy| +|168|[Majority Element](https://leetcode.com/problems/majority-element)|[C++](168.%20Majority%20Element/solution.h) [Python](168.%20Majority%20Element/solution.py)|[Note](168.%20Majority%20Element)|Easy| +|169|[Two Sum III - Data structure design](https://leetcode.com/problems/two-sum-iii-data-structure-design)|[C++](169.%20Two%20Sum%20III%20-%20Data%20structure%20design/solution.h) [Python](169.%20Two%20Sum%20III%20-%20Data%20structure%20design/solution.py)|[Note](169.%20Two%20Sum%20III%20-%20Data%20structure%20design)|None| +|170|[Excel Sheet Column Number](https://leetcode.com/problems/excel-sheet-column-number)|[C++](170.%20Excel%20Sheet%20Column%20Number/solution.h) [Python](170.%20Excel%20Sheet%20Column%20Number/solution.py)|[Note](170.%20Excel%20Sheet%20Column%20Number)|Easy| +|171|[Factorial Trailing Zeroes](https://leetcode.com/problems/factorial-trailing-zeroes)|[C++](171.%20Factorial%20Trailing%20Zeroes/solution.h) [Python](171.%20Factorial%20Trailing%20Zeroes/solution.py)|[Note](171.%20Factorial%20Trailing%20Zeroes)|Easy| +|172|[Binary Search Tree Iterator](https://leetcode.com/problems/binary-search-tree-iterator)|[C++](172.%20Binary%20Search%20Tree%20Iterator/solution.h) [Python](172.%20Binary%20Search%20Tree%20Iterator/solution.py)|[Note](172.%20Binary%20Search%20Tree%20Iterator)|Medium| +|173|[Dungeon Game](https://leetcode.com/problems/dungeon-game)|[C++](173.%20Dungeon%20Game/solution.h) [Python](173.%20Dungeon%20Game/solution.py)|[Note](173.%20Dungeon%20Game)|Hard| +|174|[Combine Two Tables](https://leetcode.com/problems/combine-two-tables)|[C++](174.%20Combine%20Two%20Tables/solution.h) [Python](174.%20Combine%20Two%20Tables/solution.py)|[Note](174.%20Combine%20Two%20Tables)|Easy| +|175|[Second Highest Salary](https://leetcode.com/problems/second-highest-salary)|[C++](175.%20Second%20Highest%20Salary/solution.h) [Python](175.%20Second%20Highest%20Salary/solution.py)|[Note](175.%20Second%20Highest%20Salary)|Easy| +|176|[Nth Highest Salary](https://leetcode.com/problems/nth-highest-salary)|[C++](176.%20Nth%20Highest%20Salary/solution.h) [Python](176.%20Nth%20Highest%20Salary/solution.py)|[Note](176.%20Nth%20Highest%20Salary)|Medium| +|177|[Rank Scores](https://leetcode.com/problems/rank-scores)|[C++](177.%20Rank%20Scores/solution.h) [Python](177.%20Rank%20Scores/solution.py)|[Note](177.%20Rank%20Scores)|Medium| +|178|[Largest Number](https://leetcode.com/problems/largest-number)|[C++](178.%20Largest%20Number/solution.h) [Python](178.%20Largest%20Number/solution.py)|[Note](178.%20Largest%20Number)|Medium| +|179|[Consecutive Numbers](https://leetcode.com/problems/consecutive-numbers)|[C++](179.%20Consecutive%20Numbers/solution.h) [Python](179.%20Consecutive%20Numbers/solution.py)|[Note](179.%20Consecutive%20Numbers)|Medium| +|180|[Employees Earning More Than Their Managers](https://leetcode.com/problems/employees-earning-more-than-their-managers)|[C++](180.%20Employees%20Earning%20More%20Than%20Their%20Managers/solution.h) [Python](180.%20Employees%20Earning%20More%20Than%20Their%20Managers/solution.py)|[Note](180.%20Employees%20Earning%20More%20Than%20Their%20Managers)|Easy| +|181|[Duplicate Emails](https://leetcode.com/problems/duplicate-emails)|[C++](181.%20Duplicate%20Emails/solution.h) [Python](181.%20Duplicate%20Emails/solution.py)|[Note](181.%20Duplicate%20Emails)|Easy| +|182|[Customers Who Never Order](https://leetcode.com/problems/customers-who-never-order)|[C++](182.%20Customers%20Who%20Never%20Order/solution.h) [Python](182.%20Customers%20Who%20Never%20Order/solution.py)|[Note](182.%20Customers%20Who%20Never%20Order)|Easy| +|183|[Department Highest Salary](https://leetcode.com/problems/department-highest-salary)|[C++](183.%20Department%20Highest%20Salary/solution.h) [Python](183.%20Department%20Highest%20Salary/solution.py)|[Note](183.%20Department%20Highest%20Salary)|Medium| +|184|[Department Top Three Salaries](https://leetcode.com/problems/department-top-three-salaries)|[C++](184.%20Department%20Top%20Three%20Salaries/solution.h) [Python](184.%20Department%20Top%20Three%20Salaries/solution.py)|[Note](184.%20Department%20Top%20Three%20Salaries)|Hard| +|185|[Reverse Words in a String II](https://leetcode.com/problems/reverse-words-in-a-string-ii)|[C++](185.%20Reverse%20Words%20in%20a%20String%20II/solution.h) [Python](185.%20Reverse%20Words%20in%20a%20String%20II/solution.py)|[Note](185.%20Reverse%20Words%20in%20a%20String%20II)|None| +|186|[Repeated DNA Sequences](https://leetcode.com/problems/repeated-dna-sequences)|[C++](186.%20Repeated%20DNA%20Sequences/solution.h) [Python](186.%20Repeated%20DNA%20Sequences/solution.py)|[Note](186.%20Repeated%20DNA%20Sequences)|Medium| +|187|[Best Time to Buy and Sell Stock IV](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv)|[C++](187.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock%20IV/solution.h) [Python](187.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock%20IV/solution.py)|[Note](187.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock%20IV)|Hard| +|188|[Rotate Array](https://leetcode.com/problems/rotate-array)|[C++](188.%20Rotate%20Array/solution.h) [Python](188.%20Rotate%20Array/solution.py)|[Note](188.%20Rotate%20Array)|Easy| +|189|[Reverse Bits](https://leetcode.com/problems/reverse-bits)|[C++](189.%20Reverse%20Bits/solution.h) [Python](189.%20Reverse%20Bits/solution.py)|[Note](189.%20Reverse%20Bits)|Easy| +|190|[Number of 1 Bits](https://leetcode.com/problems/number-of-1-bits)|[C++](190.%20Number%20of%201%20Bits/solution.h) [Python](190.%20Number%20of%201%20Bits/solution.py)|[Note](190.%20Number%20of%201%20Bits)|Easy| +|191|[Word Frequency](https://leetcode.com/problems/word-frequency)|[C++](191.%20Word%20Frequency/solution.h) [Python](191.%20Word%20Frequency/solution.py)|[Note](191.%20Word%20Frequency)|Medium| +|192|[Valid Phone Numbers](https://leetcode.com/problems/valid-phone-numbers)|[C++](192.%20Valid%20Phone%20Numbers/solution.h) [Python](192.%20Valid%20Phone%20Numbers/solution.py)|[Note](192.%20Valid%20Phone%20Numbers)|Easy| +|193|[Transpose File](https://leetcode.com/problems/transpose-file)|[C++](193.%20Transpose%20File/solution.h) [Python](193.%20Transpose%20File/solution.py)|[Note](193.%20Transpose%20File)|Medium| +|194|[Tenth Line](https://leetcode.com/problems/tenth-line)|[C++](194.%20Tenth%20Line/solution.h) [Python](194.%20Tenth%20Line/solution.py)|[Note](194.%20Tenth%20Line)|Easy| +|195|[Delete Duplicate Emails](https://leetcode.com/problems/delete-duplicate-emails)|[C++](195.%20Delete%20Duplicate%20Emails/solution.h) [Python](195.%20Delete%20Duplicate%20Emails/solution.py)|[Note](195.%20Delete%20Duplicate%20Emails)|Easy| +|196|[Rising Temperature](https://leetcode.com/problems/rising-temperature)|[C++](196.%20Rising%20Temperature/solution.h) [Python](196.%20Rising%20Temperature/solution.py)|[Note](196.%20Rising%20Temperature)|Easy| +|197|[House Robber](https://leetcode.com/problems/house-robber)|[C++](197.%20House%20Robber/solution.h) [Python](197.%20House%20Robber/solution.py)|[Note](197.%20House%20Robber)|Easy| +|198|[Binary Tree Right Side View](https://leetcode.com/problems/binary-tree-right-side-view)|[C++](198.%20Binary%20Tree%20Right%20Side%20View/solution.h) [Python](198.%20Binary%20Tree%20Right%20Side%20View/solution.py)|[Note](198.%20Binary%20Tree%20Right%20Side%20View)|Medium| +|199|[Number of Islands](https://leetcode.com/problems/number-of-islands)|[C++](199.%20Number%20of%20Islands/solution.h) [Python](199.%20Number%20of%20Islands/solution.py)|[Note](199.%20Number%20of%20Islands)|Medium| +|200|[Bitwise AND of Numbers Range](https://leetcode.com/problems/bitwise-and-of-numbers-range)|[C++](200.%20Bitwise%20AND%20of%20Numbers%20Range/solution.h) [Python](200.%20Bitwise%20AND%20of%20Numbers%20Range/solution.py)|[Note](200.%20Bitwise%20AND%20of%20Numbers%20Range)|Medium| +|201|[Happy Number](https://leetcode.com/problems/happy-number)|[C++](201.%20Happy%20Number/solution.h) [Python](201.%20Happy%20Number/solution.py)|[Note](201.%20Happy%20Number)|Easy| +|202|[Remove Linked List Elements](https://leetcode.com/problems/remove-linked-list-elements)|[C++](202.%20Remove%20Linked%20List%20Elements/solution.h) [Python](202.%20Remove%20Linked%20List%20Elements/solution.py)|[Note](202.%20Remove%20Linked%20List%20Elements)|Easy| +|203|[Count Primes](https://leetcode.com/problems/count-primes)|[C++](203.%20Count%20Primes/solution.h) [Python](203.%20Count%20Primes/solution.py)|[Note](203.%20Count%20Primes)|Easy| +|204|[Isomorphic Strings](https://leetcode.com/problems/isomorphic-strings)|[C++](204.%20Isomorphic%20Strings/solution.h) [Python](204.%20Isomorphic%20Strings/solution.py)|[Note](204.%20Isomorphic%20Strings)|Easy| +|205|[Reverse Linked List](https://leetcode.com/problems/reverse-linked-list)|[C++](205.%20Reverse%20Linked%20List/solution.h) [Python](205.%20Reverse%20Linked%20List/solution.py)|[Note](205.%20Reverse%20Linked%20List)|Easy| +|206|[Course Schedule](https://leetcode.com/problems/course-schedule)|[C++](206.%20Course%20Schedule/solution.h) [Python](206.%20Course%20Schedule/solution.py)|[Note](206.%20Course%20Schedule)|Medium| +|207|[Implement Trie (Prefix Tree)](https://leetcode.com/problems/implement-trie-prefix-tree)|[C++](207.%20Implement%20Trie%20(Prefix%20Tree)/solution.h) [Python](207.%20Implement%20Trie%20(Prefix%20Tree)/solution.py)|[Note](207.%20Implement%20Trie%20(Prefix%20Tree))|Medium| +|208|[Minimum Size Subarray Sum](https://leetcode.com/problems/minimum-size-subarray-sum)|[C++](208.%20Minimum%20Size%20Subarray%20Sum/solution.h) [Python](208.%20Minimum%20Size%20Subarray%20Sum/solution.py)|[Note](208.%20Minimum%20Size%20Subarray%20Sum)|Medium| +|209|[Course Schedule II](https://leetcode.com/problems/course-schedule-ii)|[C++](209.%20Course%20Schedule%20II/solution.h) [Python](209.%20Course%20Schedule%20II/solution.py)|[Note](209.%20Course%20Schedule%20II)|Medium| +|210|[Add and Search Word - Data structure design](https://leetcode.com/problems/add-and-search-word-data-structure-design)|[C++](210.%20Add%20and%20Search%20Word%20-%20Data%20structure%20design/solution.h) [Python](210.%20Add%20and%20Search%20Word%20-%20Data%20structure%20design/solution.py)|[Note](210.%20Add%20and%20Search%20Word%20-%20Data%20structure%20design)|Medium| +|211|[Word Search II](https://leetcode.com/problems/word-search-ii)|[C++](211.%20Word%20Search%20II/solution.h) [Python](211.%20Word%20Search%20II/solution.py)|[Note](211.%20Word%20Search%20II)|Hard| +|212|[House Robber II](https://leetcode.com/problems/house-robber-ii)|[C++](212.%20House%20Robber%20II/solution.h) [Python](212.%20House%20Robber%20II/solution.py)|[Note](212.%20House%20Robber%20II)|Medium| +|213|[Shortest Palindrome](https://leetcode.com/problems/shortest-palindrome)|[C++](213.%20Shortest%20Palindrome/solution.h) [Python](213.%20Shortest%20Palindrome/solution.py)|[Note](213.%20Shortest%20Palindrome)|Hard| +|214|[Kth Largest Element in an Array](https://leetcode.com/problems/kth-largest-element-in-an-array)|[C++](214.%20Kth%20Largest%20Element%20in%20an%20Array/solution.h) [Python](214.%20Kth%20Largest%20Element%20in%20an%20Array/solution.py)|[Note](214.%20Kth%20Largest%20Element%20in%20an%20Array)|Medium| +|215|[Combination Sum III](https://leetcode.com/problems/combination-sum-iii)|[C++](215.%20Combination%20Sum%20III/solution.h) [Python](215.%20Combination%20Sum%20III/solution.py)|[Note](215.%20Combination%20Sum%20III)|Medium| +|216|[Contains Duplicate](https://leetcode.com/problems/contains-duplicate)|[C++](216.%20Contains%20Duplicate/solution.h) [Python](216.%20Contains%20Duplicate/solution.py)|[Note](216.%20Contains%20Duplicate)|Easy| +|217|[The Skyline Problem](https://leetcode.com/problems/the-skyline-problem)|[C++](217.%20The%20Skyline%20Problem/solution.h) [Python](217.%20The%20Skyline%20Problem/solution.py)|[Note](217.%20The%20Skyline%20Problem)|Hard| +|218|[Contains Duplicate II](https://leetcode.com/problems/contains-duplicate-ii)|[C++](218.%20Contains%20Duplicate%20II/solution.h) [Python](218.%20Contains%20Duplicate%20II/solution.py)|[Note](218.%20Contains%20Duplicate%20II)|Easy| +|219|[Contains Duplicate III](https://leetcode.com/problems/contains-duplicate-iii)|[C++](219.%20Contains%20Duplicate%20III/solution.h) [Python](219.%20Contains%20Duplicate%20III/solution.py)|[Note](219.%20Contains%20Duplicate%20III)|Medium| +|220|[Maximal Square](https://leetcode.com/problems/maximal-square)|[C++](220.%20Maximal%20Square/solution.h) [Python](220.%20Maximal%20Square/solution.py)|[Note](220.%20Maximal%20Square)|Medium| +|221|[Count Complete Tree Nodes](https://leetcode.com/problems/count-complete-tree-nodes)|[C++](221.%20Count%20Complete%20Tree%20Nodes/solution.h) [Python](221.%20Count%20Complete%20Tree%20Nodes/solution.py)|[Note](221.%20Count%20Complete%20Tree%20Nodes)|Medium| +|222|[Rectangle Area](https://leetcode.com/problems/rectangle-area)|[C++](222.%20Rectangle%20Area/solution.h) [Python](222.%20Rectangle%20Area/solution.py)|[Note](222.%20Rectangle%20Area)|Medium| +|223|[Basic Calculator](https://leetcode.com/problems/basic-calculator)|[C++](223.%20Basic%20Calculator/solution.h) [Python](223.%20Basic%20Calculator/solution.py)|[Note](223.%20Basic%20Calculator)|Hard| +|224|[Implement Stack using Queues](https://leetcode.com/problems/implement-stack-using-queues)|[C++](224.%20Implement%20Stack%20using%20Queues/solution.h) [Python](224.%20Implement%20Stack%20using%20Queues/solution.py)|[Note](224.%20Implement%20Stack%20using%20Queues)|Easy| +|225|[Invert Binary Tree](https://leetcode.com/problems/invert-binary-tree)|[C++](225.%20Invert%20Binary%20Tree/solution.h) [Python](225.%20Invert%20Binary%20Tree/solution.py)|[Note](225.%20Invert%20Binary%20Tree)|Easy| +|226|[Basic Calculator II](https://leetcode.com/problems/basic-calculator-ii)|[C++](226.%20Basic%20Calculator%20II/solution.h) [Python](226.%20Basic%20Calculator%20II/solution.py)|[Note](226.%20Basic%20Calculator%20II)|Medium| +|227|[Summary Ranges](https://leetcode.com/problems/summary-ranges)|[C++](227.%20Summary%20Ranges/solution.h) [Python](227.%20Summary%20Ranges/solution.py)|[Note](227.%20Summary%20Ranges)|Medium| +|228|[Majority Element II](https://leetcode.com/problems/majority-element-ii)|[C++](228.%20Majority%20Element%20II/solution.h) [Python](228.%20Majority%20Element%20II/solution.py)|[Note](228.%20Majority%20Element%20II)|Medium| +|229|[Kth Smallest Element in a BST](https://leetcode.com/problems/kth-smallest-element-in-a-bst)|[C++](229.%20Kth%20Smallest%20Element%20in%20a%20BST/solution.h) [Python](229.%20Kth%20Smallest%20Element%20in%20a%20BST/solution.py)|[Note](229.%20Kth%20Smallest%20Element%20in%20a%20BST)|Medium| +|230|[Power of Two](https://leetcode.com/problems/power-of-two)|[C++](230.%20Power%20of%20Two/solution.h) [Python](230.%20Power%20of%20Two/solution.py)|[Note](230.%20Power%20of%20Two)|Easy| +|231|[Implement Queue using Stacks](https://leetcode.com/problems/implement-queue-using-stacks)|[C++](231.%20Implement%20Queue%20using%20Stacks/solution.h) [Python](231.%20Implement%20Queue%20using%20Stacks/solution.py)|[Note](231.%20Implement%20Queue%20using%20Stacks)|Easy| +|232|[Number of Digit One](https://leetcode.com/problems/number-of-digit-one)|[C++](232.%20Number%20of%20Digit%20One/solution.h) [Python](232.%20Number%20of%20Digit%20One/solution.py)|[Note](232.%20Number%20of%20Digit%20One)|Hard| +|233|[Palindrome Linked List](https://leetcode.com/problems/palindrome-linked-list)|[C++](233.%20Palindrome%20Linked%20List/solution.h) [Python](233.%20Palindrome%20Linked%20List/solution.py)|[Note](233.%20Palindrome%20Linked%20List)|Easy| +|234|[Lowest Common Ancestor of a Binary Search Tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree)|[C++](234.%20Lowest%20Common%20Ancestor%20of%20a%20Binary%20Search%20Tree/solution.h) [Python](234.%20Lowest%20Common%20Ancestor%20of%20a%20Binary%20Search%20Tree/solution.py)|[Note](234.%20Lowest%20Common%20Ancestor%20of%20a%20Binary%20Search%20Tree)|Easy| +|235|[Lowest Common Ancestor of a Binary Tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree)|[C++](235.%20Lowest%20Common%20Ancestor%20of%20a%20Binary%20Tree/solution.h) [Python](235.%20Lowest%20Common%20Ancestor%20of%20a%20Binary%20Tree/solution.py)|[Note](235.%20Lowest%20Common%20Ancestor%20of%20a%20Binary%20Tree)|Medium| +|236|[Delete Node in a Linked List](https://leetcode.com/problems/delete-node-in-a-linked-list)|[C++](236.%20Delete%20Node%20in%20a%20Linked%20List/solution.h) [Python](236.%20Delete%20Node%20in%20a%20Linked%20List/solution.py)|[Note](236.%20Delete%20Node%20in%20a%20Linked%20List)|Easy| +|237|[Product of Array Except Self](https://leetcode.com/problems/product-of-array-except-self)|[C++](237.%20Product%20of%20Array%20Except%20Self/solution.h) [Python](237.%20Product%20of%20Array%20Except%20Self/solution.py)|[Note](237.%20Product%20of%20Array%20Except%20Self)|Medium| +|238|[Sliding Window Maximum](https://leetcode.com/problems/sliding-window-maximum)|[C++](238.%20Sliding%20Window%20Maximum/solution.h) [Python](238.%20Sliding%20Window%20Maximum/solution.py)|[Note](238.%20Sliding%20Window%20Maximum)|Hard| +|239|[Search a 2D Matrix II](https://leetcode.com/problems/search-a-2d-matrix-ii)|[C++](239.%20Search%20a%202D%20Matrix%20II/solution.h) [Python](239.%20Search%20a%202D%20Matrix%20II/solution.py)|[Note](239.%20Search%20a%202D%20Matrix%20II)|Medium| +|240|[Different Ways to Add Parentheses](https://leetcode.com/problems/different-ways-to-add-parentheses)|[C++](240.%20Different%20Ways%20to%20Add%20Parentheses/solution.h) [Python](240.%20Different%20Ways%20to%20Add%20Parentheses/solution.py)|[Note](240.%20Different%20Ways%20to%20Add%20Parentheses)|Medium| +|241|[Valid Anagram](https://leetcode.com/problems/valid-anagram)|[C++](241.%20Valid%20Anagram/solution.h) [Python](241.%20Valid%20Anagram/solution.py)|[Note](241.%20Valid%20Anagram)|Easy| +|242|[Shortest Word Distance](https://leetcode.com/problems/shortest-word-distance)|[C++](242.%20Shortest%20Word%20Distance/solution.h) [Python](242.%20Shortest%20Word%20Distance/solution.py)|[Note](242.%20Shortest%20Word%20Distance)|None| +|243|[Shortest Word Distance II](https://leetcode.com/problems/shortest-word-distance-ii)|[C++](243.%20Shortest%20Word%20Distance%20II/solution.h) [Python](243.%20Shortest%20Word%20Distance%20II/solution.py)|[Note](243.%20Shortest%20Word%20Distance%20II)|None| +|244|[Shortest Word Distance III](https://leetcode.com/problems/shortest-word-distance-iii)|[C++](244.%20Shortest%20Word%20Distance%20III/solution.h) [Python](244.%20Shortest%20Word%20Distance%20III/solution.py)|[Note](244.%20Shortest%20Word%20Distance%20III)|None| +|245|[Strobogrammatic Number](https://leetcode.com/problems/strobogrammatic-number)|[C++](245.%20Strobogrammatic%20Number/solution.h) [Python](245.%20Strobogrammatic%20Number/solution.py)|[Note](245.%20Strobogrammatic%20Number)|None| +|246|[Strobogrammatic Number II](https://leetcode.com/problems/strobogrammatic-number-ii)|[C++](246.%20Strobogrammatic%20Number%20II/solution.h) [Python](246.%20Strobogrammatic%20Number%20II/solution.py)|[Note](246.%20Strobogrammatic%20Number%20II)|None| +|247|[Strobogrammatic Number III](https://leetcode.com/problems/strobogrammatic-number-iii)|[C++](247.%20Strobogrammatic%20Number%20III/solution.h) [Python](247.%20Strobogrammatic%20Number%20III/solution.py)|[Note](247.%20Strobogrammatic%20Number%20III)|None| +|248|[Group Shifted Strings](https://leetcode.com/problems/group-shifted-strings)|[C++](248.%20Group%20Shifted%20Strings/solution.h) [Python](248.%20Group%20Shifted%20Strings/solution.py)|[Note](248.%20Group%20Shifted%20Strings)|None| +|249|[Count Univalue Subtrees](https://leetcode.com/problems/count-univalue-subtrees)|[C++](249.%20Count%20Univalue%20Subtrees/solution.h) [Python](249.%20Count%20Univalue%20Subtrees/solution.py)|[Note](249.%20Count%20Univalue%20Subtrees)|None| +|250|[Flatten 2D Vector](https://leetcode.com/problems/flatten-2d-vector)|[C++](250.%20Flatten%202D%20Vector/solution.h) [Python](250.%20Flatten%202D%20Vector/solution.py)|[Note](250.%20Flatten%202D%20Vector)|None| +|251|[Meeting Rooms](https://leetcode.com/problems/meeting-rooms)|[C++](251.%20Meeting%20Rooms/solution.h) [Python](251.%20Meeting%20Rooms/solution.py)|[Note](251.%20Meeting%20Rooms)|None| +|252|[Meeting Rooms II](https://leetcode.com/problems/meeting-rooms-ii)|[C++](252.%20Meeting%20Rooms%20II/solution.h) [Python](252.%20Meeting%20Rooms%20II/solution.py)|[Note](252.%20Meeting%20Rooms%20II)|None| +|253|[Factor Combinations](https://leetcode.com/problems/factor-combinations)|[C++](253.%20Factor%20Combinations/solution.h) [Python](253.%20Factor%20Combinations/solution.py)|[Note](253.%20Factor%20Combinations)|None| +|254|[Verify Preorder Sequence in Binary Search Tree](https://leetcode.com/problems/verify-preorder-sequence-in-binary-search-tree)|[C++](254.%20Verify%20Preorder%20Sequence%20in%20Binary%20Search%20Tree/solution.h) [Python](254.%20Verify%20Preorder%20Sequence%20in%20Binary%20Search%20Tree/solution.py)|[Note](254.%20Verify%20Preorder%20Sequence%20in%20Binary%20Search%20Tree)|None| +|255|[Paint House](https://leetcode.com/problems/paint-house)|[C++](255.%20Paint%20House/solution.h) [Python](255.%20Paint%20House/solution.py)|[Note](255.%20Paint%20House)|None| +|256|[Binary Tree Paths](https://leetcode.com/problems/binary-tree-paths)|[C++](256.%20Binary%20Tree%20Paths/solution.h) [Python](256.%20Binary%20Tree%20Paths/solution.py)|[Note](256.%20Binary%20Tree%20Paths)|Easy| +|257|[Add Digits](https://leetcode.com/problems/add-digits)|[C++](257.%20Add%20Digits/solution.h) [Python](257.%20Add%20Digits/solution.py)|[Note](257.%20Add%20Digits)|Easy| +|258|[3Sum Smaller](https://leetcode.com/problems/3sum-smaller)|[C++](258.%203Sum%20Smaller/solution.h) [Python](258.%203Sum%20Smaller/solution.py)|[Note](258.%203Sum%20Smaller)|None| +|259|[Single Number III](https://leetcode.com/problems/single-number-iii)|[C++](259.%20Single%20Number%20III/solution.h) [Python](259.%20Single%20Number%20III/solution.py)|[Note](259.%20Single%20Number%20III)|Medium| +|260|[Graph Valid Tree](https://leetcode.com/problems/graph-valid-tree)|[C++](260.%20Graph%20Valid%20Tree/solution.h) [Python](260.%20Graph%20Valid%20Tree/solution.py)|[Note](260.%20Graph%20Valid%20Tree)|None| +|261|[Trips and Users](https://leetcode.com/problems/trips-and-users)|[C++](261.%20Trips%20and%20Users/solution.h) [Python](261.%20Trips%20and%20Users/solution.py)|[Note](261.%20Trips%20and%20Users)|Hard| +|262|[Ugly Number](https://leetcode.com/problems/ugly-number)|[C++](262.%20Ugly%20Number/solution.h) [Python](262.%20Ugly%20Number/solution.py)|[Note](262.%20Ugly%20Number)|Easy| +|263|[Ugly Number II](https://leetcode.com/problems/ugly-number-ii)|[C++](263.%20Ugly%20Number%20II/solution.h) [Python](263.%20Ugly%20Number%20II/solution.py)|[Note](263.%20Ugly%20Number%20II)|Medium| +|264|[Paint House II](https://leetcode.com/problems/paint-house-ii)|[C++](264.%20Paint%20House%20II/solution.h) [Python](264.%20Paint%20House%20II/solution.py)|[Note](264.%20Paint%20House%20II)|None| +|265|[Palindrome Permutation](https://leetcode.com/problems/palindrome-permutation)|[C++](265.%20Palindrome%20Permutation/solution.h) [Python](265.%20Palindrome%20Permutation/solution.py)|[Note](265.%20Palindrome%20Permutation)|None| +|266|[Palindrome Permutation II](https://leetcode.com/problems/palindrome-permutation-ii)|[C++](266.%20Palindrome%20Permutation%20II/solution.h) [Python](266.%20Palindrome%20Permutation%20II/solution.py)|[Note](266.%20Palindrome%20Permutation%20II)|None| +|267|[Missing Number](https://leetcode.com/problems/missing-number)|[C++](267.%20Missing%20Number/solution.h) [Python](267.%20Missing%20Number/solution.py)|[Note](267.%20Missing%20Number)|Easy| +|268|[Alien Dictionary](https://leetcode.com/problems/alien-dictionary)|[C++](268.%20Alien%20Dictionary/solution.h) [Python](268.%20Alien%20Dictionary/solution.py)|[Note](268.%20Alien%20Dictionary)|None| +|269|[Closest Binary Search Tree Value](https://leetcode.com/problems/closest-binary-search-tree-value)|[C++](269.%20Closest%20Binary%20Search%20Tree%20Value/solution.h) [Python](269.%20Closest%20Binary%20Search%20Tree%20Value/solution.py)|[Note](269.%20Closest%20Binary%20Search%20Tree%20Value)|None| +|270|[Encode and Decode Strings](https://leetcode.com/problems/encode-and-decode-strings)|[C++](270.%20Encode%20and%20Decode%20Strings/solution.h) [Python](270.%20Encode%20and%20Decode%20Strings/solution.py)|[Note](270.%20Encode%20and%20Decode%20Strings)|None| +|271|[Closest Binary Search Tree Value II](https://leetcode.com/problems/closest-binary-search-tree-value-ii)|[C++](271.%20Closest%20Binary%20Search%20Tree%20Value%20II/solution.h) [Python](271.%20Closest%20Binary%20Search%20Tree%20Value%20II/solution.py)|[Note](271.%20Closest%20Binary%20Search%20Tree%20Value%20II)|None| +|272|[Integer to English Words](https://leetcode.com/problems/integer-to-english-words)|[C++](272.%20Integer%20to%20English%20Words/solution.h) [Python](272.%20Integer%20to%20English%20Words/solution.py)|[Note](272.%20Integer%20to%20English%20Words)|Hard| +|273|[H-Index](https://leetcode.com/problems/h-index)|[C++](273.%20H-Index/solution.h) [Python](273.%20H-Index/solution.py)|[Note](273.%20H-Index)|Medium| +|274|[H-Index II](https://leetcode.com/problems/h-index-ii)|[C++](274.%20H-Index%20II/solution.h) [Python](274.%20H-Index%20II/solution.py)|[Note](274.%20H-Index%20II)|Medium| +|275|[Paint Fence](https://leetcode.com/problems/paint-fence)|[C++](275.%20Paint%20Fence/solution.h) [Python](275.%20Paint%20Fence/solution.py)|[Note](275.%20Paint%20Fence)|None| +|276|[Find the Celebrity](https://leetcode.com/problems/find-the-celebrity)|[C++](276.%20Find%20the%20Celebrity/solution.h) [Python](276.%20Find%20the%20Celebrity/solution.py)|[Note](276.%20Find%20the%20Celebrity)|None| +|277|[First Bad Version](https://leetcode.com/problems/first-bad-version)|[C++](277.%20First%20Bad%20Version/solution.h) [Python](277.%20First%20Bad%20Version/solution.py)|[Note](277.%20First%20Bad%20Version)|Easy| +|278|[Perfect Squares](https://leetcode.com/problems/perfect-squares)|[C++](278.%20Perfect%20Squares/solution.h) [Python](278.%20Perfect%20Squares/solution.py)|[Note](278.%20Perfect%20Squares)|Medium| +|279|[Wiggle Sort](https://leetcode.com/problems/wiggle-sort)|[C++](279.%20Wiggle%20Sort/solution.h) [Python](279.%20Wiggle%20Sort/solution.py)|[Note](279.%20Wiggle%20Sort)|None| +|280|[Zigzag Iterator](https://leetcode.com/problems/zigzag-iterator)|[C++](280.%20Zigzag%20Iterator/solution.h) [Python](280.%20Zigzag%20Iterator/solution.py)|[Note](280.%20Zigzag%20Iterator)|None| +|281|[Expression Add Operators](https://leetcode.com/problems/expression-add-operators)|[C++](281.%20Expression%20Add%20Operators/solution.h) [Python](281.%20Expression%20Add%20Operators/solution.py)|[Note](281.%20Expression%20Add%20Operators)|Hard| +|282|[Move Zeroes](https://leetcode.com/problems/move-zeroes)|[C++](282.%20Move%20Zeroes/solution.h) [Python](282.%20Move%20Zeroes/solution.py)|[Note](282.%20Move%20Zeroes)|Easy| +|283|[Peeking Iterator](https://leetcode.com/problems/peeking-iterator)|[C++](283.%20Peeking%20Iterator/solution.h) [Python](283.%20Peeking%20Iterator/solution.py)|[Note](283.%20Peeking%20Iterator)|Medium| +|284|[Inorder Successor in BST](https://leetcode.com/problems/inorder-successor-in-bst)|[C++](284.%20Inorder%20Successor%20in%20BST/solution.h) [Python](284.%20Inorder%20Successor%20in%20BST/solution.py)|[Note](284.%20Inorder%20Successor%20in%20BST)|None| +|285|[Walls and Gates](https://leetcode.com/problems/walls-and-gates)|[C++](285.%20Walls%20and%20Gates/solution.h) [Python](285.%20Walls%20and%20Gates/solution.py)|[Note](285.%20Walls%20and%20Gates)|None| +|286|[Find the Duplicate Number](https://leetcode.com/problems/find-the-duplicate-number)|[C++](286.%20Find%20the%20Duplicate%20Number/solution.h) [Python](286.%20Find%20the%20Duplicate%20Number/solution.py)|[Note](286.%20Find%20the%20Duplicate%20Number)|Medium| +|287|[Unique Word Abbreviation](https://leetcode.com/problems/unique-word-abbreviation)|[C++](287.%20Unique%20Word%20Abbreviation/solution.h) [Python](287.%20Unique%20Word%20Abbreviation/solution.py)|[Note](287.%20Unique%20Word%20Abbreviation)|None| +|288|[Game of Life](https://leetcode.com/problems/game-of-life)|[C++](288.%20Game%20of%20Life/solution.h) [Python](288.%20Game%20of%20Life/solution.py)|[Note](288.%20Game%20of%20Life)|Medium| +|289|[Word Pattern](https://leetcode.com/problems/word-pattern)|[C++](289.%20Word%20Pattern/solution.h) [Python](289.%20Word%20Pattern/solution.py)|[Note](289.%20Word%20Pattern)|Easy| +|290|[Word Pattern II](https://leetcode.com/problems/word-pattern-ii)|[C++](290.%20Word%20Pattern%20II/solution.h) [Python](290.%20Word%20Pattern%20II/solution.py)|[Note](290.%20Word%20Pattern%20II)|None| +|291|[Nim Game](https://leetcode.com/problems/nim-game)|[C++](291.%20Nim%20Game/solution.h) [Python](291.%20Nim%20Game/solution.py)|[Note](291.%20Nim%20Game)|Easy| +|292|[Flip Game](https://leetcode.com/problems/flip-game)|[C++](292.%20Flip%20Game/solution.h) [Python](292.%20Flip%20Game/solution.py)|[Note](292.%20Flip%20Game)|None| +|293|[Flip Game II](https://leetcode.com/problems/flip-game-ii)|[C++](293.%20Flip%20Game%20II/solution.h) [Python](293.%20Flip%20Game%20II/solution.py)|[Note](293.%20Flip%20Game%20II)|None| +|294|[Find Median from Data Stream](https://leetcode.com/problems/find-median-from-data-stream)|[C++](294.%20Find%20Median%20from%20Data%20Stream/solution.h) [Python](294.%20Find%20Median%20from%20Data%20Stream/solution.py)|[Note](294.%20Find%20Median%20from%20Data%20Stream)|Hard| +|295|[Best Meeting Point](https://leetcode.com/problems/best-meeting-point)|[C++](295.%20Best%20Meeting%20Point/solution.h) [Python](295.%20Best%20Meeting%20Point/solution.py)|[Note](295.%20Best%20Meeting%20Point)|None| +|296|[Serialize and Deserialize Binary Tree](https://leetcode.com/problems/serialize-and-deserialize-binary-tree)|[C++](296.%20Serialize%20and%20Deserialize%20Binary%20Tree/solution.h) [Python](296.%20Serialize%20and%20Deserialize%20Binary%20Tree/solution.py)|[Note](296.%20Serialize%20and%20Deserialize%20Binary%20Tree)|Hard| +|297|[Binary Tree Longest Consecutive Sequence](https://leetcode.com/problems/binary-tree-longest-consecutive-sequence)|[C++](297.%20Binary%20Tree%20Longest%20Consecutive%20Sequence/solution.h) [Python](297.%20Binary%20Tree%20Longest%20Consecutive%20Sequence/solution.py)|[Note](297.%20Binary%20Tree%20Longest%20Consecutive%20Sequence)|None| +|298|[Bulls and Cows](https://leetcode.com/problems/bulls-and-cows)|[C++](298.%20Bulls%20and%20Cows/solution.h) [Python](298.%20Bulls%20and%20Cows/solution.py)|[Note](298.%20Bulls%20and%20Cows)|Medium| +|299|[Longest Increasing Subsequence](https://leetcode.com/problems/longest-increasing-subsequence)|[C++](299.%20Longest%20Increasing%20Subsequence/solution.h) [Python](299.%20Longest%20Increasing%20Subsequence/solution.py)|[Note](299.%20Longest%20Increasing%20Subsequence)|Medium| +|300|[Remove Invalid Parentheses](https://leetcode.com/problems/remove-invalid-parentheses)|[C++](300.%20Remove%20Invalid%20Parentheses/solution.h) [Python](300.%20Remove%20Invalid%20Parentheses/solution.py)|[Note](300.%20Remove%20Invalid%20Parentheses)|Hard| +|301|[Smallest Rectangle Enclosing Black Pixels](https://leetcode.com/problems/smallest-rectangle-enclosing-black-pixels)|[C++](301.%20Smallest%20Rectangle%20Enclosing%20Black%20Pixels/solution.h) [Python](301.%20Smallest%20Rectangle%20Enclosing%20Black%20Pixels/solution.py)|[Note](301.%20Smallest%20Rectangle%20Enclosing%20Black%20Pixels)|None| +|302|[Range Sum Query - Immutable](https://leetcode.com/problems/range-sum-query-immutable)|[C++](302.%20Range%20Sum%20Query%20-%20Immutable/solution.h) [Python](302.%20Range%20Sum%20Query%20-%20Immutable/solution.py)|[Note](302.%20Range%20Sum%20Query%20-%20Immutable)|Easy| +|303|[Range Sum Query 2D - Immutable](https://leetcode.com/problems/range-sum-query-2d-immutable)|[C++](303.%20Range%20Sum%20Query%202D%20-%20Immutable/solution.h) [Python](303.%20Range%20Sum%20Query%202D%20-%20Immutable/solution.py)|[Note](303.%20Range%20Sum%20Query%202D%20-%20Immutable)|Medium| +|304|[Number of Islands II](https://leetcode.com/problems/number-of-islands-ii)|[C++](304.%20Number%20of%20Islands%20II/solution.h) [Python](304.%20Number%20of%20Islands%20II/solution.py)|[Note](304.%20Number%20of%20Islands%20II)|None| +|305|[Additive Number](https://leetcode.com/problems/additive-number)|[C++](305.%20Additive%20Number/solution.h) [Python](305.%20Additive%20Number/solution.py)|[Note](305.%20Additive%20Number)|Medium| +|306|[Range Sum Query - Mutable](https://leetcode.com/problems/range-sum-query-mutable)|[C++](306.%20Range%20Sum%20Query%20-%20Mutable/solution.h) [Python](306.%20Range%20Sum%20Query%20-%20Mutable/solution.py)|[Note](306.%20Range%20Sum%20Query%20-%20Mutable)|Medium| +|307|[Range Sum Query 2D - Mutable](https://leetcode.com/problems/range-sum-query-2d-mutable)|[C++](307.%20Range%20Sum%20Query%202D%20-%20Mutable/solution.h) [Python](307.%20Range%20Sum%20Query%202D%20-%20Mutable/solution.py)|[Note](307.%20Range%20Sum%20Query%202D%20-%20Mutable)|None| +|308|[Best Time to Buy and Sell Stock with Cooldown](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown)|[C++](308.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock%20with%20Cooldown/solution.h) [Python](308.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock%20with%20Cooldown/solution.py)|[Note](308.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock%20with%20Cooldown)|Medium| +|309|[Minimum Height Trees](https://leetcode.com/problems/minimum-height-trees)|[C++](309.%20Minimum%20Height%20Trees/solution.h) [Python](309.%20Minimum%20Height%20Trees/solution.py)|[Note](309.%20Minimum%20Height%20Trees)|Medium| +|310|[Sparse Matrix Multiplication](https://leetcode.com/problems/sparse-matrix-multiplication)|[C++](310.%20Sparse%20Matrix%20Multiplication/solution.h) [Python](310.%20Sparse%20Matrix%20Multiplication/solution.py)|[Note](310.%20Sparse%20Matrix%20Multiplication)|None| +|311|[Burst Balloons](https://leetcode.com/problems/burst-balloons)|[C++](311.%20Burst%20Balloons/solution.h) [Python](311.%20Burst%20Balloons/solution.py)|[Note](311.%20Burst%20Balloons)|Hard| +|312|[Super Ugly Number](https://leetcode.com/problems/super-ugly-number)|[C++](312.%20Super%20Ugly%20Number/solution.h) [Python](312.%20Super%20Ugly%20Number/solution.py)|[Note](312.%20Super%20Ugly%20Number)|Medium| +|313|[Binary Tree Vertical Order Traversal](https://leetcode.com/problems/binary-tree-vertical-order-traversal)|[C++](313.%20Binary%20Tree%20Vertical%20Order%20Traversal/solution.h) [Python](313.%20Binary%20Tree%20Vertical%20Order%20Traversal/solution.py)|[Note](313.%20Binary%20Tree%20Vertical%20Order%20Traversal)|None| +|314|[Count of Smaller Numbers After Self](https://leetcode.com/problems/count-of-smaller-numbers-after-self)|[C++](314.%20Count%20of%20Smaller%20Numbers%20After%20Self/solution.h) [Python](314.%20Count%20of%20Smaller%20Numbers%20After%20Self/solution.py)|[Note](314.%20Count%20of%20Smaller%20Numbers%20After%20Self)|Hard| +|315|[Remove Duplicate Letters](https://leetcode.com/problems/remove-duplicate-letters)|[C++](315.%20Remove%20Duplicate%20Letters/solution.h) [Python](315.%20Remove%20Duplicate%20Letters/solution.py)|[Note](315.%20Remove%20Duplicate%20Letters)|Hard| +|316|[Shortest Distance from All Buildings](https://leetcode.com/problems/shortest-distance-from-all-buildings)|[C++](316.%20Shortest%20Distance%20from%20All%20Buildings/solution.h) [Python](316.%20Shortest%20Distance%20from%20All%20Buildings/solution.py)|[Note](316.%20Shortest%20Distance%20from%20All%20Buildings)|None| +|317|[Maximum Product of Word Lengths](https://leetcode.com/problems/maximum-product-of-word-lengths)|[C++](317.%20Maximum%20Product%20of%20Word%20Lengths/solution.h) [Python](317.%20Maximum%20Product%20of%20Word%20Lengths/solution.py)|[Note](317.%20Maximum%20Product%20of%20Word%20Lengths)|Medium| +|318|[Bulb Switcher](https://leetcode.com/problems/bulb-switcher)|[C++](318.%20Bulb%20Switcher/solution.h) [Python](318.%20Bulb%20Switcher/solution.py)|[Note](318.%20Bulb%20Switcher)|Medium| +|319|[Generalized Abbreviation](https://leetcode.com/problems/generalized-abbreviation)|[C++](319.%20Generalized%20Abbreviation/solution.h) [Python](319.%20Generalized%20Abbreviation/solution.py)|[Note](319.%20Generalized%20Abbreviation)|None| +|320|[Create Maximum Number](https://leetcode.com/problems/create-maximum-number)|[C++](320.%20Create%20Maximum%20Number/solution.h) [Python](320.%20Create%20Maximum%20Number/solution.py)|[Note](320.%20Create%20Maximum%20Number)|Hard| +|321|[Coin Change](https://leetcode.com/problems/coin-change)|[C++](321.%20Coin%20Change/solution.h) [Python](321.%20Coin%20Change/solution.py)|[Note](321.%20Coin%20Change)|Medium| +|322|[Number of Connected Components in an Undirected Graph](https://leetcode.com/problems/number-of-connected-components-in-an-undirected-graph)|[C++](322.%20Number%20of%20Connected%20Components%20in%20an%20Undirected%20Graph/solution.h) [Python](322.%20Number%20of%20Connected%20Components%20in%20an%20Undirected%20Graph/solution.py)|[Note](322.%20Number%20of%20Connected%20Components%20in%20an%20Undirected%20Graph)|None| +|323|[Wiggle Sort II](https://leetcode.com/problems/wiggle-sort-ii)|[C++](323.%20Wiggle%20Sort%20II/solution.h) [Python](323.%20Wiggle%20Sort%20II/solution.py)|[Note](323.%20Wiggle%20Sort%20II)|Medium| +|324|[Maximum Size Subarray Sum Equals k](https://leetcode.com/problems/maximum-size-subarray-sum-equals-k)|[C++](324.%20Maximum%20Size%20Subarray%20Sum%20Equals%20k/solution.h) [Python](324.%20Maximum%20Size%20Subarray%20Sum%20Equals%20k/solution.py)|[Note](324.%20Maximum%20Size%20Subarray%20Sum%20Equals%20k)|None| +|325|[Power of Three](https://leetcode.com/problems/power-of-three)|[C++](325.%20Power%20of%20Three/solution.h) [Python](325.%20Power%20of%20Three/solution.py)|[Note](325.%20Power%20of%20Three)|Easy| +|326|[Count of Range Sum](https://leetcode.com/problems/count-of-range-sum)|[C++](326.%20Count%20of%20Range%20Sum/solution.h) [Python](326.%20Count%20of%20Range%20Sum/solution.py)|[Note](326.%20Count%20of%20Range%20Sum)|Hard| +|327|[Odd Even Linked List](https://leetcode.com/problems/odd-even-linked-list)|[C++](327.%20Odd%20Even%20Linked%20List/solution.h) [Python](327.%20Odd%20Even%20Linked%20List/solution.py)|[Note](327.%20Odd%20Even%20Linked%20List)|Medium| +|328|[Longest Increasing Path in a Matrix](https://leetcode.com/problems/longest-increasing-path-in-a-matrix)|[C++](328.%20Longest%20Increasing%20Path%20in%20a%20Matrix/solution.h) [Python](328.%20Longest%20Increasing%20Path%20in%20a%20Matrix/solution.py)|[Note](328.%20Longest%20Increasing%20Path%20in%20a%20Matrix)|Hard| +|329|[Patching Array](https://leetcode.com/problems/patching-array)|[C++](329.%20Patching%20Array/solution.h) [Python](329.%20Patching%20Array/solution.py)|[Note](329.%20Patching%20Array)|Hard| +|330|[Verify Preorder Serialization of a Binary Tree](https://leetcode.com/problems/verify-preorder-serialization-of-a-binary-tree)|[C++](330.%20Verify%20Preorder%20Serialization%20of%20a%20Binary%20Tree/solution.h) [Python](330.%20Verify%20Preorder%20Serialization%20of%20a%20Binary%20Tree/solution.py)|[Note](330.%20Verify%20Preorder%20Serialization%20of%20a%20Binary%20Tree)|Medium| +|331|[Reconstruct Itinerary](https://leetcode.com/problems/reconstruct-itinerary)|[C++](331.%20Reconstruct%20Itinerary/solution.h) [Python](331.%20Reconstruct%20Itinerary/solution.py)|[Note](331.%20Reconstruct%20Itinerary)|Medium| +|332|[Largest BST Subtree](https://leetcode.com/problems/largest-bst-subtree)|[C++](332.%20Largest%20BST%20Subtree/solution.h) [Python](332.%20Largest%20BST%20Subtree/solution.py)|[Note](332.%20Largest%20BST%20Subtree)|None| +|333|[Increasing Triplet Subsequence](https://leetcode.com/problems/increasing-triplet-subsequence)|[C++](333.%20Increasing%20Triplet%20Subsequence/solution.h) [Python](333.%20Increasing%20Triplet%20Subsequence/solution.py)|[Note](333.%20Increasing%20Triplet%20Subsequence)|Medium| +|334|[Self Crossing](https://leetcode.com/problems/self-crossing)|[C++](334.%20Self%20Crossing/solution.h) [Python](334.%20Self%20Crossing/solution.py)|[Note](334.%20Self%20Crossing)|Hard| +|335|[Palindrome Pairs](https://leetcode.com/problems/palindrome-pairs)|[C++](335.%20Palindrome%20Pairs/solution.h) [Python](335.%20Palindrome%20Pairs/solution.py)|[Note](335.%20Palindrome%20Pairs)|Hard| +|336|[House Robber III](https://leetcode.com/problems/house-robber-iii)|[C++](336.%20House%20Robber%20III/solution.h) [Python](336.%20House%20Robber%20III/solution.py)|[Note](336.%20House%20Robber%20III)|Medium| +|337|[Counting Bits](https://leetcode.com/problems/counting-bits)|[C++](337.%20Counting%20Bits/solution.h) [Python](337.%20Counting%20Bits/solution.py)|[Note](337.%20Counting%20Bits)|Medium| +|338|[Nested List Weight Sum](https://leetcode.com/problems/nested-list-weight-sum)|[C++](338.%20Nested%20List%20Weight%20Sum/solution.h) [Python](338.%20Nested%20List%20Weight%20Sum/solution.py)|[Note](338.%20Nested%20List%20Weight%20Sum)|None| +|339|[Longest Substring with At Most K Distinct Characters](https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters)|[C++](339.%20Longest%20Substring%20with%20At%20Most%20K%20Distinct%20Characters/solution.h) [Python](339.%20Longest%20Substring%20with%20At%20Most%20K%20Distinct%20Characters/solution.py)|[Note](339.%20Longest%20Substring%20with%20At%20Most%20K%20Distinct%20Characters)|None| +|340|[Flatten Nested List Iterator](https://leetcode.com/problems/flatten-nested-list-iterator)|[C++](340.%20Flatten%20Nested%20List%20Iterator/solution.h) [Python](340.%20Flatten%20Nested%20List%20Iterator/solution.py)|[Note](340.%20Flatten%20Nested%20List%20Iterator)|Medium| +|341|[Power of Four](https://leetcode.com/problems/power-of-four)|[C++](341.%20Power%20of%20Four/solution.h) [Python](341.%20Power%20of%20Four/solution.py)|[Note](341.%20Power%20of%20Four)|Easy| +|342|[Integer Break](https://leetcode.com/problems/integer-break)|[C++](342.%20Integer%20Break/solution.h) [Python](342.%20Integer%20Break/solution.py)|[Note](342.%20Integer%20Break)|Medium| +|343|[Reverse String](https://leetcode.com/problems/reverse-string)|[C++](343.%20Reverse%20String/solution.h) [Python](343.%20Reverse%20String/solution.py)|[Note](343.%20Reverse%20String)|Easy| +|344|[Reverse Vowels of a String](https://leetcode.com/problems/reverse-vowels-of-a-string)|[C++](344.%20Reverse%20Vowels%20of%20a%20String/solution.h) [Python](344.%20Reverse%20Vowels%20of%20a%20String/solution.py)|[Note](344.%20Reverse%20Vowels%20of%20a%20String)|Easy| +|345|[Moving Average from Data Stream](https://leetcode.com/problems/moving-average-from-data-stream)|[C++](345.%20Moving%20Average%20from%20Data%20Stream/solution.h) [Python](345.%20Moving%20Average%20from%20Data%20Stream/solution.py)|[Note](345.%20Moving%20Average%20from%20Data%20Stream)|None| +|346|[Top K Frequent Elements](https://leetcode.com/problems/top-k-frequent-elements)|[C++](346.%20Top%20K%20Frequent%20Elements/solution.h) [Python](346.%20Top%20K%20Frequent%20Elements/solution.py)|[Note](346.%20Top%20K%20Frequent%20Elements)|Medium| +|347|[Design Tic-Tac-Toe](https://leetcode.com/problems/design-tic-tac-toe)|[C++](347.%20Design%20Tic-Tac-Toe/solution.h) [Python](347.%20Design%20Tic-Tac-Toe/solution.py)|[Note](347.%20Design%20Tic-Tac-Toe)|None| +|348|[Intersection of Two Arrays](https://leetcode.com/problems/intersection-of-two-arrays)|[C++](348.%20Intersection%20of%20Two%20Arrays/solution.h) [Python](348.%20Intersection%20of%20Two%20Arrays/solution.py)|[Note](348.%20Intersection%20of%20Two%20Arrays)|Easy| +|349|[Intersection of Two Arrays II](https://leetcode.com/problems/intersection-of-two-arrays-ii)|[C++](349.%20Intersection%20of%20Two%20Arrays%20II/solution.h) [Python](349.%20Intersection%20of%20Two%20Arrays%20II/solution.py)|[Note](349.%20Intersection%20of%20Two%20Arrays%20II)|Easy| +|350|[Android Unlock Patterns](https://leetcode.com/problems/android-unlock-patterns)|[C++](350.%20Android%20Unlock%20Patterns/solution.h) [Python](350.%20Android%20Unlock%20Patterns/solution.py)|[Note](350.%20Android%20Unlock%20Patterns)|None| +|351|[Data Stream as Disjoint Intervals](https://leetcode.com/problems/data-stream-as-disjoint-intervals)|[C++](351.%20Data%20Stream%20as%20Disjoint%20Intervals/solution.h) [Python](351.%20Data%20Stream%20as%20Disjoint%20Intervals/solution.py)|[Note](351.%20Data%20Stream%20as%20Disjoint%20Intervals)|Hard| +|352|[Design Snake Game](https://leetcode.com/problems/design-snake-game)|[C++](352.%20Design%20Snake%20Game/solution.h) [Python](352.%20Design%20Snake%20Game/solution.py)|[Note](352.%20Design%20Snake%20Game)|None| +|353|[Russian Doll Envelopes](https://leetcode.com/problems/russian-doll-envelopes)|[C++](353.%20Russian%20Doll%20Envelopes/solution.h) [Python](353.%20Russian%20Doll%20Envelopes/solution.py)|[Note](353.%20Russian%20Doll%20Envelopes)|Hard| +|354|[Design Twitter](https://leetcode.com/problems/design-twitter)|[C++](354.%20Design%20Twitter/solution.h) [Python](354.%20Design%20Twitter/solution.py)|[Note](354.%20Design%20Twitter)|Medium| +|355|[Line Reflection](https://leetcode.com/problems/line-reflection)|[C++](355.%20Line%20Reflection/solution.h) [Python](355.%20Line%20Reflection/solution.py)|[Note](355.%20Line%20Reflection)|None| +|356|[Count Numbers with Unique Digits](https://leetcode.com/problems/count-numbers-with-unique-digits)|[C++](356.%20Count%20Numbers%20with%20Unique%20Digits/solution.h) [Python](356.%20Count%20Numbers%20with%20Unique%20Digits/solution.py)|[Note](356.%20Count%20Numbers%20with%20Unique%20Digits)|Medium| +|357|[Rearrange String k Distance Apart](https://leetcode.com/problems/rearrange-string-k-distance-apart)|[C++](357.%20Rearrange%20String%20k%20Distance%20Apart/solution.h) [Python](357.%20Rearrange%20String%20k%20Distance%20Apart/solution.py)|[Note](357.%20Rearrange%20String%20k%20Distance%20Apart)|None| +|358|[Logger Rate Limiter](https://leetcode.com/problems/logger-rate-limiter)|[C++](358.%20Logger%20Rate%20Limiter/solution.h) [Python](358.%20Logger%20Rate%20Limiter/solution.py)|[Note](358.%20Logger%20Rate%20Limiter)|None| +|359|[Sort Transformed Array](https://leetcode.com/problems/sort-transformed-array)|[C++](359.%20Sort%20Transformed%20Array/solution.h) [Python](359.%20Sort%20Transformed%20Array/solution.py)|[Note](359.%20Sort%20Transformed%20Array)|None| +|360|[Bomb Enemy](https://leetcode.com/problems/bomb-enemy)|[C++](360.%20Bomb%20Enemy/solution.h) [Python](360.%20Bomb%20Enemy/solution.py)|[Note](360.%20Bomb%20Enemy)|None| +|361|[Design Hit Counter](https://leetcode.com/problems/design-hit-counter)|[C++](361.%20Design%20Hit%20Counter/solution.h) [Python](361.%20Design%20Hit%20Counter/solution.py)|[Note](361.%20Design%20Hit%20Counter)|None| +|362|[Max Sum of Rectangle No Larger Than K](https://leetcode.com/problems/max-sum-of-rectangle-no-larger-than-k)|[C++](362.%20Max%20Sum%20of%20Rectangle%20No%20Larger%20Than%20K/solution.h) [Python](362.%20Max%20Sum%20of%20Rectangle%20No%20Larger%20Than%20K/solution.py)|[Note](362.%20Max%20Sum%20of%20Rectangle%20No%20Larger%20Than%20K)|Hard| +|363|[Nested List Weight Sum II](https://leetcode.com/problems/nested-list-weight-sum-ii)|[C++](363.%20Nested%20List%20Weight%20Sum%20II/solution.h) [Python](363.%20Nested%20List%20Weight%20Sum%20II/solution.py)|[Note](363.%20Nested%20List%20Weight%20Sum%20II)|None| +|364|[Water and Jug Problem](https://leetcode.com/problems/water-and-jug-problem)|[C++](364.%20Water%20and%20Jug%20Problem/solution.h) [Python](364.%20Water%20and%20Jug%20Problem/solution.py)|[Note](364.%20Water%20and%20Jug%20Problem)|Medium| +|365|[Find Leaves of Binary Tree](https://leetcode.com/problems/find-leaves-of-binary-tree)|[C++](365.%20Find%20Leaves%20of%20Binary%20Tree/solution.h) [Python](365.%20Find%20Leaves%20of%20Binary%20Tree/solution.py)|[Note](365.%20Find%20Leaves%20of%20Binary%20Tree)|None| +|366|[Valid Perfect Square](https://leetcode.com/problems/valid-perfect-square)|[C++](366.%20Valid%20Perfect%20Square/solution.h) [Python](366.%20Valid%20Perfect%20Square/solution.py)|[Note](366.%20Valid%20Perfect%20Square)|Easy| +|367|[Largest Divisible Subset](https://leetcode.com/problems/largest-divisible-subset)|[C++](367.%20Largest%20Divisible%20Subset/solution.h) [Python](367.%20Largest%20Divisible%20Subset/solution.py)|[Note](367.%20Largest%20Divisible%20Subset)|Medium| +|368|[Plus One Linked List](https://leetcode.com/problems/plus-one-linked-list)|[C++](368.%20Plus%20One%20Linked%20List/solution.h) [Python](368.%20Plus%20One%20Linked%20List/solution.py)|[Note](368.%20Plus%20One%20Linked%20List)|None| +|369|[Range Addition](https://leetcode.com/problems/range-addition)|[C++](369.%20Range%20Addition/solution.h) [Python](369.%20Range%20Addition/solution.py)|[Note](369.%20Range%20Addition)|None| +|370|[Sum of Two Integers](https://leetcode.com/problems/sum-of-two-integers)|[C++](370.%20Sum%20of%20Two%20Integers/solution.h) [Python](370.%20Sum%20of%20Two%20Integers/solution.py)|[Note](370.%20Sum%20of%20Two%20Integers)|Easy| +|371|[Super Pow](https://leetcode.com/problems/super-pow)|[C++](371.%20Super%20Pow/solution.h) [Python](371.%20Super%20Pow/solution.py)|[Note](371.%20Super%20Pow)|Medium| +|372|[Find K Pairs with Smallest Sums](https://leetcode.com/problems/find-k-pairs-with-smallest-sums)|[C++](372.%20Find%20K%20Pairs%20with%20Smallest%20Sums/solution.h) [Python](372.%20Find%20K%20Pairs%20with%20Smallest%20Sums/solution.py)|[Note](372.%20Find%20K%20Pairs%20with%20Smallest%20Sums)|Medium| +|373|[Guess Number Higher or Lower](https://leetcode.com/problems/guess-number-higher-or-lower)|[C++](373.%20Guess%20Number%20Higher%20or%20Lower/solution.h) [Python](373.%20Guess%20Number%20Higher%20or%20Lower/solution.py)|[Note](373.%20Guess%20Number%20Higher%20or%20Lower)|Easy| +|374|[Guess Number Higher or Lower II](https://leetcode.com/problems/guess-number-higher-or-lower-ii)|[C++](374.%20Guess%20Number%20Higher%20or%20Lower%20II/solution.h) [Python](374.%20Guess%20Number%20Higher%20or%20Lower%20II/solution.py)|[Note](374.%20Guess%20Number%20Higher%20or%20Lower%20II)|Medium| +|375|[Wiggle Subsequence](https://leetcode.com/problems/wiggle-subsequence)|[C++](375.%20Wiggle%20Subsequence/solution.h) [Python](375.%20Wiggle%20Subsequence/solution.py)|[Note](375.%20Wiggle%20Subsequence)|Medium| +|376|[Combination Sum IV](https://leetcode.com/problems/combination-sum-iv)|[C++](376.%20Combination%20Sum%20IV/solution.h) [Python](376.%20Combination%20Sum%20IV/solution.py)|[Note](376.%20Combination%20Sum%20IV)|Medium| +|377|[Kth Smallest Element in a Sorted Matrix](https://leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix)|[C++](377.%20Kth%20Smallest%20Element%20in%20a%20Sorted%20Matrix/solution.h) [Python](377.%20Kth%20Smallest%20Element%20in%20a%20Sorted%20Matrix/solution.py)|[Note](377.%20Kth%20Smallest%20Element%20in%20a%20Sorted%20Matrix)|Medium| +|378|[Design Phone Directory](https://leetcode.com/problems/design-phone-directory)|[C++](378.%20Design%20Phone%20Directory/solution.h) [Python](378.%20Design%20Phone%20Directory/solution.py)|[Note](378.%20Design%20Phone%20Directory)|None| +|379|[Insert Delete GetRandom O(1)](https://leetcode.com/problems/insert-delete-getrandom-o1)|[C++](379.%20Insert%20Delete%20GetRandom%20O(1)/solution.h) [Python](379.%20Insert%20Delete%20GetRandom%20O(1)/solution.py)|[Note](379.%20Insert%20Delete%20GetRandom%20O(1))|Medium| +|380|[Insert Delete GetRandom O(1) - Duplicates allowed](https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed)|[C++](380.%20Insert%20Delete%20GetRandom%20O(1)%20-%20Duplicates%20allowed/solution.h) [Python](380.%20Insert%20Delete%20GetRandom%20O(1)%20-%20Duplicates%20allowed/solution.py)|[Note](380.%20Insert%20Delete%20GetRandom%20O(1)%20-%20Duplicates%20allowed)|Hard| +|381|[Linked List Random Node](https://leetcode.com/problems/linked-list-random-node)|[C++](381.%20Linked%20List%20Random%20Node/solution.h) [Python](381.%20Linked%20List%20Random%20Node/solution.py)|[Note](381.%20Linked%20List%20Random%20Node)|Medium| +|382|[Ransom Note](https://leetcode.com/problems/ransom-note)|[C++](382.%20Ransom%20Note/solution.h) [Python](382.%20Ransom%20Note/solution.py)|[Note](382.%20Ransom%20Note)|Easy| +|383|[Shuffle an Array](https://leetcode.com/problems/shuffle-an-array)|[C++](383.%20Shuffle%20an%20Array/solution.h) [Python](383.%20Shuffle%20an%20Array/solution.py)|[Note](383.%20Shuffle%20an%20Array)|Medium| +|384|[Mini Parser](https://leetcode.com/problems/mini-parser)|[C++](384.%20Mini%20Parser/solution.h) [Python](384.%20Mini%20Parser/solution.py)|[Note](384.%20Mini%20Parser)|Medium| +|385|[Lexicographical Numbers](https://leetcode.com/problems/lexicographical-numbers)|[C++](385.%20Lexicographical%20Numbers/solution.h) [Python](385.%20Lexicographical%20Numbers/solution.py)|[Note](385.%20Lexicographical%20Numbers)|Medium| +|386|[First Unique Character in a String](https://leetcode.com/problems/first-unique-character-in-a-string)|[C++](386.%20First%20Unique%20Character%20in%20a%20String/solution.h) [Python](386.%20First%20Unique%20Character%20in%20a%20String/solution.py)|[Note](386.%20First%20Unique%20Character%20in%20a%20String)|Easy| +|387|[Longest Absolute File Path](https://leetcode.com/problems/longest-absolute-file-path)|[C++](387.%20Longest%20Absolute%20File%20Path/solution.h) [Python](387.%20Longest%20Absolute%20File%20Path/solution.py)|[Note](387.%20Longest%20Absolute%20File%20Path)|Medium| +|388|[Find the Difference](https://leetcode.com/problems/find-the-difference)|[C++](388.%20Find%20the%20Difference/solution.h) [Python](388.%20Find%20the%20Difference/solution.py)|[Note](388.%20Find%20the%20Difference)|Easy| +|389|[Elimination Game](https://leetcode.com/problems/elimination-game)|[C++](389.%20Elimination%20Game/solution.h) [Python](389.%20Elimination%20Game/solution.py)|[Note](389.%20Elimination%20Game)|Medium| +|390|[Perfect Rectangle](https://leetcode.com/problems/perfect-rectangle)|[C++](390.%20Perfect%20Rectangle/solution.h) [Python](390.%20Perfect%20Rectangle/solution.py)|[Note](390.%20Perfect%20Rectangle)|Hard| +|391|[Is Subsequence](https://leetcode.com/problems/is-subsequence)|[C++](391.%20Is%20Subsequence/solution.h) [Python](391.%20Is%20Subsequence/solution.py)|[Note](391.%20Is%20Subsequence)|Medium| +|392|[UTF-8 Validation](https://leetcode.com/problems/utf-8-validation)|[C++](392.%20UTF-8%20Validation/solution.h) [Python](392.%20UTF-8%20Validation/solution.py)|[Note](392.%20UTF-8%20Validation)|Medium| +|393|[Decode String](https://leetcode.com/problems/decode-string)|[C++](393.%20Decode%20String/solution.h) [Python](393.%20Decode%20String/solution.py)|[Note](393.%20Decode%20String)|Medium| +|394|[Longest Substring with At Least K Repeating Characters](https://leetcode.com/problems/longest-substring-with-at-least-k-repeating-characters)|[C++](394.%20Longest%20Substring%20with%20At%20Least%20K%20Repeating%20Characters/solution.h) [Python](394.%20Longest%20Substring%20with%20At%20Least%20K%20Repeating%20Characters/solution.py)|[Note](394.%20Longest%20Substring%20with%20At%20Least%20K%20Repeating%20Characters)|Medium| +|395|[Rotate Function](https://leetcode.com/problems/rotate-function)|[C++](395.%20Rotate%20Function/solution.h) [Python](395.%20Rotate%20Function/solution.py)|[Note](395.%20Rotate%20Function)|Medium| +|396|[Integer Replacement](https://leetcode.com/problems/integer-replacement)|[C++](396.%20Integer%20Replacement/solution.h) [Python](396.%20Integer%20Replacement/solution.py)|[Note](396.%20Integer%20Replacement)|Medium| +|397|[Random Pick Index](https://leetcode.com/problems/random-pick-index)|[C++](397.%20Random%20Pick%20Index/solution.h) [Python](397.%20Random%20Pick%20Index/solution.py)|[Note](397.%20Random%20Pick%20Index)|Medium| +|398|[Evaluate Division](https://leetcode.com/problems/evaluate-division)|[C++](398.%20Evaluate%20Division/solution.h) [Python](398.%20Evaluate%20Division/solution.py)|[Note](398.%20Evaluate%20Division)|Medium| +|399|[Nth Digit](https://leetcode.com/problems/nth-digit)|[C++](399.%20Nth%20Digit/solution.h) [Python](399.%20Nth%20Digit/solution.py)|[Note](399.%20Nth%20Digit)|Easy| +|400|[Binary Watch](https://leetcode.com/problems/binary-watch)|[C++](400.%20Binary%20Watch/solution.h) [Python](400.%20Binary%20Watch/solution.py)|[Note](400.%20Binary%20Watch)|Easy| +|401|[Remove K Digits](https://leetcode.com/problems/remove-k-digits)|[C++](401.%20Remove%20K%20Digits/solution.h) [Python](401.%20Remove%20K%20Digits/solution.py)|[Note](401.%20Remove%20K%20Digits)|Medium| +|402|[Frog Jump](https://leetcode.com/problems/frog-jump)|[C++](402.%20Frog%20Jump/solution.h) [Python](402.%20Frog%20Jump/solution.py)|[Note](402.%20Frog%20Jump)|Hard| +|403|[Sum of Left Leaves](https://leetcode.com/problems/sum-of-left-leaves)|[C++](403.%20Sum%20of%20Left%20Leaves/solution.h) [Python](403.%20Sum%20of%20Left%20Leaves/solution.py)|[Note](403.%20Sum%20of%20Left%20Leaves)|Easy| +|404|[Convert a Number to Hexadecimal](https://leetcode.com/problems/convert-a-number-to-hexadecimal)|[C++](404.%20Convert%20a%20Number%20to%20Hexadecimal/solution.h) [Python](404.%20Convert%20a%20Number%20to%20Hexadecimal/solution.py)|[Note](404.%20Convert%20a%20Number%20to%20Hexadecimal)|Easy| +|405|[Queue Reconstruction by Height](https://leetcode.com/problems/queue-reconstruction-by-height)|[C++](405.%20Queue%20Reconstruction%20by%20Height/solution.h) [Python](405.%20Queue%20Reconstruction%20by%20Height/solution.py)|[Note](405.%20Queue%20Reconstruction%20by%20Height)|Medium| +|406|[Trapping Rain Water II](https://leetcode.com/problems/trapping-rain-water-ii)|[C++](406.%20Trapping%20Rain%20Water%20II/solution.h) [Python](406.%20Trapping%20Rain%20Water%20II/solution.py)|[Note](406.%20Trapping%20Rain%20Water%20II)|Hard| +|407|[Valid Word Abbreviation](https://leetcode.com/problems/valid-word-abbreviation)|[C++](407.%20Valid%20Word%20Abbreviation/solution.h) [Python](407.%20Valid%20Word%20Abbreviation/solution.py)|[Note](407.%20Valid%20Word%20Abbreviation)|None| +|408|[Longest Palindrome](https://leetcode.com/problems/longest-palindrome)|[C++](408.%20Longest%20Palindrome/solution.h) [Python](408.%20Longest%20Palindrome/solution.py)|[Note](408.%20Longest%20Palindrome)|Easy| +|409|[Split Array Largest Sum](https://leetcode.com/problems/split-array-largest-sum)|[C++](409.%20Split%20Array%20Largest%20Sum/solution.h) [Python](409.%20Split%20Array%20Largest%20Sum/solution.py)|[Note](409.%20Split%20Array%20Largest%20Sum)|Hard| +|410|[Minimum Unique Word Abbreviation](https://leetcode.com/problems/minimum-unique-word-abbreviation)|[C++](410.%20Minimum%20Unique%20Word%20Abbreviation/solution.h) [Python](410.%20Minimum%20Unique%20Word%20Abbreviation/solution.py)|[Note](410.%20Minimum%20Unique%20Word%20Abbreviation)|None| +|411|[Fizz Buzz](https://leetcode.com/problems/fizz-buzz)|[C++](411.%20Fizz%20Buzz/solution.h) [Python](411.%20Fizz%20Buzz/solution.py)|[Note](411.%20Fizz%20Buzz)|Easy| +|412|[Arithmetic Slices](https://leetcode.com/problems/arithmetic-slices)|[C++](412.%20Arithmetic%20Slices/solution.h) [Python](412.%20Arithmetic%20Slices/solution.py)|[Note](412.%20Arithmetic%20Slices)|Medium| +|413|[Third Maximum Number](https://leetcode.com/problems/third-maximum-number)|[C++](413.%20Third%20Maximum%20Number/solution.h) [Python](413.%20Third%20Maximum%20Number/solution.py)|[Note](413.%20Third%20Maximum%20Number)|Easy| +|414|[Add Strings](https://leetcode.com/problems/add-strings)|[C++](414.%20Add%20Strings/solution.h) [Python](414.%20Add%20Strings/solution.py)|[Note](414.%20Add%20Strings)|Easy| +|415|[Partition Equal Subset Sum](https://leetcode.com/problems/partition-equal-subset-sum)|[C++](415.%20Partition%20Equal%20Subset%20Sum/solution.h) [Python](415.%20Partition%20Equal%20Subset%20Sum/solution.py)|[Note](415.%20Partition%20Equal%20Subset%20Sum)|Medium| +|416|[Pacific Atlantic Water Flow](https://leetcode.com/problems/pacific-atlantic-water-flow)|[C++](416.%20Pacific%20Atlantic%20Water%20Flow/solution.h) [Python](416.%20Pacific%20Atlantic%20Water%20Flow/solution.py)|[Note](416.%20Pacific%20Atlantic%20Water%20Flow)|Medium| +|417|[Sentence Screen Fitting](https://leetcode.com/problems/sentence-screen-fitting)|[C++](417.%20Sentence%20Screen%20Fitting/solution.h) [Python](417.%20Sentence%20Screen%20Fitting/solution.py)|[Note](417.%20Sentence%20Screen%20Fitting)|None| +|418|[Battleships in a Board](https://leetcode.com/problems/battleships-in-a-board)|[C++](418.%20Battleships%20in%20a%20Board/solution.h) [Python](418.%20Battleships%20in%20a%20Board/solution.py)|[Note](418.%20Battleships%20in%20a%20Board)|Medium| +|419|[Strong Password Checker](https://leetcode.com/problems/strong-password-checker)|[C++](419.%20Strong%20Password%20Checker/solution.h) [Python](419.%20Strong%20Password%20Checker/solution.py)|[Note](419.%20Strong%20Password%20Checker)|Hard| +|420|[Maximum XOR of Two Numbers in an Array](https://leetcode.com/problems/maximum-xor-of-two-numbers-in-an-array)|[C++](420.%20Maximum%20XOR%20of%20Two%20Numbers%20in%20an%20Array/solution.h) [Python](420.%20Maximum%20XOR%20of%20Two%20Numbers%20in%20an%20Array/solution.py)|[Note](420.%20Maximum%20XOR%20of%20Two%20Numbers%20in%20an%20Array)|Medium| +|421|[Valid Word Square](https://leetcode.com/problems/valid-word-square)|[C++](421.%20Valid%20Word%20Square/solution.h) [Python](421.%20Valid%20Word%20Square/solution.py)|[Note](421.%20Valid%20Word%20Square)|None| +|422|[Reconstruct Original Digits from English](https://leetcode.com/problems/reconstruct-original-digits-from-english)|[C++](422.%20Reconstruct%20Original%20Digits%20from%20English/solution.h) [Python](422.%20Reconstruct%20Original%20Digits%20from%20English/solution.py)|[Note](422.%20Reconstruct%20Original%20Digits%20from%20English)|Medium| +|423|[Longest Repeating Character Replacement](https://leetcode.com/problems/longest-repeating-character-replacement)|[C++](423.%20Longest%20Repeating%20Character%20Replacement/solution.h) [Python](423.%20Longest%20Repeating%20Character%20Replacement/solution.py)|[Note](423.%20Longest%20Repeating%20Character%20Replacement)|Medium| +|424|[Word Squares](https://leetcode.com/problems/word-squares)|[C++](424.%20Word%20Squares/solution.h) [Python](424.%20Word%20Squares/solution.py)|[Note](424.%20Word%20Squares)|None| +|425|[All O'one Data Structure](https://leetcode.com/problems/all-oone-data-structure)|[C++](425.%20All%20O`one%20Data%20Structure/solution.h) [Python](425.%20All%20O`one%20Data%20Structure/solution.py)|[Note](425.%20All%20O`one%20Data%20Structure)|Hard| +|426|[Minimum Genetic Mutation](https://leetcode.com/problems/minimum-genetic-mutation)|[C++](426.%20Minimum%20Genetic%20Mutation/solution.h) [Python](426.%20Minimum%20Genetic%20Mutation/solution.py)|[Note](426.%20Minimum%20Genetic%20Mutation)|Medium| +|427|[Number of Segments in a String](https://leetcode.com/problems/number-of-segments-in-a-string)|[C++](427.%20Number%20of%20Segments%20in%20a%20String/solution.h) [Python](427.%20Number%20of%20Segments%20in%20a%20String/solution.py)|[Note](427.%20Number%20of%20Segments%20in%20a%20String)|Easy| +|428|[Non-overlapping Intervals](https://leetcode.com/problems/non-overlapping-intervals)|[C++](428.%20Non-overlapping%20Intervals/solution.h) [Python](428.%20Non-overlapping%20Intervals/solution.py)|[Note](428.%20Non-overlapping%20Intervals)|Medium| +|429|[Find Right Interval](https://leetcode.com/problems/find-right-interval)|[C++](429.%20Find%20Right%20Interval/solution.h) [Python](429.%20Find%20Right%20Interval/solution.py)|[Note](429.%20Find%20Right%20Interval)|Medium| +|430|[Path Sum III](https://leetcode.com/problems/path-sum-iii)|[C++](430.%20Path%20Sum%20III/solution.h) [Python](430.%20Path%20Sum%20III/solution.py)|[Note](430.%20Path%20Sum%20III)|Easy| +|431|[Find All Anagrams in a String](https://leetcode.com/problems/find-all-anagrams-in-a-string)|[C++](431.%20Find%20All%20Anagrams%20in%20a%20String/solution.h) [Python](431.%20Find%20All%20Anagrams%20in%20a%20String/solution.py)|[Note](431.%20Find%20All%20Anagrams%20in%20a%20String)|Easy| +|432|[Ternary Expression Parser](https://leetcode.com/problems/ternary-expression-parser)|[C++](432.%20Ternary%20Expression%20Parser/solution.h) [Python](432.%20Ternary%20Expression%20Parser/solution.py)|[Note](432.%20Ternary%20Expression%20Parser)|None| +|433|[K-th Smallest in Lexicographical Order](https://leetcode.com/problems/k-th-smallest-in-lexicographical-order)|[C++](433.%20K-th%20Smallest%20in%20Lexicographical%20Order/solution.h) [Python](433.%20K-th%20Smallest%20in%20Lexicographical%20Order/solution.py)|[Note](433.%20K-th%20Smallest%20in%20Lexicographical%20Order)|Hard| +|434|[Arranging Coins](https://leetcode.com/problems/arranging-coins)|[C++](434.%20Arranging%20Coins/solution.h) [Python](434.%20Arranging%20Coins/solution.py)|[Note](434.%20Arranging%20Coins)|Easy| +|435|[Find All Duplicates in an Array](https://leetcode.com/problems/find-all-duplicates-in-an-array)|[C++](435.%20Find%20All%20Duplicates%20in%20an%20Array/solution.h) [Python](435.%20Find%20All%20Duplicates%20in%20an%20Array/solution.py)|[Note](435.%20Find%20All%20Duplicates%20in%20an%20Array)|Medium| +|436|[String Compression](https://leetcode.com/problems/string-compression)|[C++](436.%20String%20Compression/solution.h) [Python](436.%20String%20Compression/solution.py)|[Note](436.%20String%20Compression)|Easy| +|437|[Sequence Reconstruction](https://leetcode.com/problems/sequence-reconstruction)|[C++](437.%20Sequence%20Reconstruction/solution.h) [Python](437.%20Sequence%20Reconstruction/solution.py)|[Note](437.%20Sequence%20Reconstruction)|None| +|438|[Add Two Numbers II](https://leetcode.com/problems/add-two-numbers-ii)|[C++](438.%20Add%20Two%20Numbers%20II/solution.h) [Python](438.%20Add%20Two%20Numbers%20II/solution.py)|[Note](438.%20Add%20Two%20Numbers%20II)|Medium| +|439|[Arithmetic Slices II - Subsequence](https://leetcode.com/problems/arithmetic-slices-ii-subsequence)|[C++](439.%20Arithmetic%20Slices%20II%20-%20Subsequence/solution.h) [Python](439.%20Arithmetic%20Slices%20II%20-%20Subsequence/solution.py)|[Note](439.%20Arithmetic%20Slices%20II%20-%20Subsequence)|Hard| +|440|[Number of Boomerangs](https://leetcode.com/problems/number-of-boomerangs)|[C++](440.%20Number%20of%20Boomerangs/solution.h) [Python](440.%20Number%20of%20Boomerangs/solution.py)|[Note](440.%20Number%20of%20Boomerangs)|Easy| +|441|[Find All Numbers Disappeared in an Array](https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array)|[C++](441.%20Find%20All%20Numbers%20Disappeared%20in%20an%20Array/solution.h) [Python](441.%20Find%20All%20Numbers%20Disappeared%20in%20an%20Array/solution.py)|[Note](441.%20Find%20All%20Numbers%20Disappeared%20in%20an%20Array)|Easy| +|442|[Serialize and Deserialize BST](https://leetcode.com/problems/serialize-and-deserialize-bst)|[C++](442.%20Serialize%20and%20Deserialize%20BST/solution.h) [Python](442.%20Serialize%20and%20Deserialize%20BST/solution.py)|[Note](442.%20Serialize%20and%20Deserialize%20BST)|Medium| +|443|[Delete Node in a BST](https://leetcode.com/problems/delete-node-in-a-bst)|[C++](443.%20Delete%20Node%20in%20a%20BST/solution.h) [Python](443.%20Delete%20Node%20in%20a%20BST/solution.py)|[Note](443.%20Delete%20Node%20in%20a%20BST)|Medium| +|444|[Sort Characters By Frequency](https://leetcode.com/problems/sort-characters-by-frequency)|[C++](444.%20Sort%20Characters%20By%20Frequency/solution.h) [Python](444.%20Sort%20Characters%20By%20Frequency/solution.py)|[Note](444.%20Sort%20Characters%20By%20Frequency)|Medium| +|445|[Minimum Number of Arrows to Burst Balloons](https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons)|[C++](445.%20Minimum%20Number%20of%20Arrows%20to%20Burst%20Balloons/solution.h) [Python](445.%20Minimum%20Number%20of%20Arrows%20to%20Burst%20Balloons/solution.py)|[Note](445.%20Minimum%20Number%20of%20Arrows%20to%20Burst%20Balloons)|Medium| +|446|[Minimum Moves to Equal Array Elements](https://leetcode.com/problems/minimum-moves-to-equal-array-elements)|[C++](446.%20Minimum%20Moves%20to%20Equal%20Array%20Elements/solution.h) [Python](446.%20Minimum%20Moves%20to%20Equal%20Array%20Elements/solution.py)|[Note](446.%20Minimum%20Moves%20to%20Equal%20Array%20Elements)|Easy| +|447|[4Sum II](https://leetcode.com/problems/4sum-ii)|[C++](447.%204Sum%20II/solution.h) [Python](447.%204Sum%20II/solution.py)|[Note](447.%204Sum%20II)|Medium| +|448|[Assign Cookies](https://leetcode.com/problems/assign-cookies)|[C++](448.%20Assign%20Cookies/solution.h) [Python](448.%20Assign%20Cookies/solution.py)|[Note](448.%20Assign%20Cookies)|Easy| +|449|[132 Pattern](https://leetcode.com/problems/132-pattern)|[C++](449.%20132%20Pattern/solution.h) [Python](449.%20132%20Pattern/solution.py)|[Note](449.%20132%20Pattern)|Medium| +|450|[Circular Array Loop](https://leetcode.com/problems/circular-array-loop)|[C++](450.%20Circular%20Array%20Loop/solution.h) [Python](450.%20Circular%20Array%20Loop/solution.py)|[Note](450.%20Circular%20Array%20Loop)|Medium| +|451|[Poor Pigs](https://leetcode.com/problems/poor-pigs)|[C++](451.%20Poor%20Pigs/solution.h) [Python](451.%20Poor%20Pigs/solution.py)|[Note](451.%20Poor%20Pigs)|Easy| +|452|[Repeated Substring Pattern](https://leetcode.com/problems/repeated-substring-pattern)|[C++](452.%20Repeated%20Substring%20Pattern/solution.h) [Python](452.%20Repeated%20Substring%20Pattern/solution.py)|[Note](452.%20Repeated%20Substring%20Pattern)|Easy| +|453|[LFU Cache](https://leetcode.com/problems/lfu-cache)|[C++](453.%20LFU%20Cache/solution.h) [Python](453.%20LFU%20Cache/solution.py)|[Note](453.%20LFU%20Cache)|Hard| +|454|[Hamming Distance](https://leetcode.com/problems/hamming-distance)|[C++](454.%20Hamming%20Distance/solution.h) [Python](454.%20Hamming%20Distance/solution.py)|[Note](454.%20Hamming%20Distance)|Easy| +|455|[Minimum Moves to Equal Array Elements II](https://leetcode.com/problems/minimum-moves-to-equal-array-elements-ii)|[C++](455.%20Minimum%20Moves%20to%20Equal%20Array%20Elements%20II/solution.h) [Python](455.%20Minimum%20Moves%20to%20Equal%20Array%20Elements%20II/solution.py)|[Note](455.%20Minimum%20Moves%20to%20Equal%20Array%20Elements%20II)|Medium| +|456|[Island Perimeter](https://leetcode.com/problems/island-perimeter)|[C++](456.%20Island%20Perimeter/solution.h) [Python](456.%20Island%20Perimeter/solution.py)|[Note](456.%20Island%20Perimeter)|Easy| +|457|[Can I Win](https://leetcode.com/problems/can-i-win)|[C++](457.%20Can%20I%20Win/solution.h) [Python](457.%20Can%20I%20Win/solution.py)|[Note](457.%20Can%20I%20Win)|Medium| +|458|[Optimal Account Balancing](https://leetcode.com/problems/optimal-account-balancing)|[C++](458.%20Optimal%20Account%20Balancing/solution.h) [Python](458.%20Optimal%20Account%20Balancing/solution.py)|[Note](458.%20Optimal%20Account%20Balancing)|None| +|459|[Count The Repetitions](https://leetcode.com/problems/count-the-repetitions)|[C++](459.%20Count%20The%20Repetitions/solution.h) [Python](459.%20Count%20The%20Repetitions/solution.py)|[Note](459.%20Count%20The%20Repetitions)|Hard| +|460|[Unique Substrings in Wraparound String](https://leetcode.com/problems/unique-substrings-in-wraparound-string)|[C++](460.%20Unique%20Substrings%20in%20Wraparound%20String/solution.h) [Python](460.%20Unique%20Substrings%20in%20Wraparound%20String/solution.py)|[Note](460.%20Unique%20Substrings%20in%20Wraparound%20String)|Medium| +|461|[Validate IP Address](https://leetcode.com/problems/validate-ip-address)|[C++](461.%20Validate%20IP%20Address/solution.h) [Python](461.%20Validate%20IP%20Address/solution.py)|[Note](461.%20Validate%20IP%20Address)|Medium| +|462|[Convex Polygon](https://leetcode.com/problems/convex-polygon)|[C++](462.%20Convex%20Polygon/solution.h) [Python](462.%20Convex%20Polygon/solution.py)|[Note](462.%20Convex%20Polygon)|None| +|463|[Encode String with Shortest Length](https://leetcode.com/problems/encode-string-with-shortest-length)|[C++](463.%20Encode%20String%20with%20Shortest%20Length/solution.h) [Python](463.%20Encode%20String%20with%20Shortest%20Length/solution.py)|[Note](463.%20Encode%20String%20with%20Shortest%20Length)|None| +|464|[Concatenated Words](https://leetcode.com/problems/concatenated-words)|[C++](464.%20Concatenated%20Words/solution.h) [Python](464.%20Concatenated%20Words/solution.py)|[Note](464.%20Concatenated%20Words)|Hard| +|465|[Matchsticks to Square](https://leetcode.com/problems/matchsticks-to-square)|[C++](465.%20Matchsticks%20to%20Square/solution.h) [Python](465.%20Matchsticks%20to%20Square/solution.py)|[Note](465.%20Matchsticks%20to%20Square)|Medium| +|466|[Ones and Zeroes](https://leetcode.com/problems/ones-and-zeroes)|[C++](466.%20Ones%20and%20Zeroes/solution.h) [Python](466.%20Ones%20and%20Zeroes/solution.py)|[Note](466.%20Ones%20and%20Zeroes)|Medium| +|467|[Heaters](https://leetcode.com/problems/heaters)|[C++](467.%20Heaters/solution.h) [Python](467.%20Heaters/solution.py)|[Note](467.%20Heaters)|Easy| +|468|[Number Complement](https://leetcode.com/problems/number-complement)|[C++](468.%20Number%20Complement/solution.h) [Python](468.%20Number%20Complement/solution.py)|[Note](468.%20Number%20Complement)|Easy| +|469|[Total Hamming Distance](https://leetcode.com/problems/total-hamming-distance)|[C++](469.%20Total%20Hamming%20Distance/solution.h) [Python](469.%20Total%20Hamming%20Distance/solution.py)|[Note](469.%20Total%20Hamming%20Distance)|Medium| +|470|[Largest Palindrome Product](https://leetcode.com/problems/largest-palindrome-product)|[C++](470.%20Largest%20Palindrome%20Product/solution.h) [Python](470.%20Largest%20Palindrome%20Product/solution.py)|[Note](470.%20Largest%20Palindrome%20Product)|Easy| +|471|[Sliding Window Median](https://leetcode.com/problems/sliding-window-median)|[C++](471.%20Sliding%20Window%20Median/solution.h) [Python](471.%20Sliding%20Window%20Median/solution.py)|[Note](471.%20Sliding%20Window%20Median)|Hard| +|472|[Magical String](https://leetcode.com/problems/magical-string)|[C++](472.%20Magical%20String/solution.h) [Python](472.%20Magical%20String/solution.py)|[Note](472.%20Magical%20String)|Medium| +|473|[License Key Formatting](https://leetcode.com/problems/license-key-formatting)|[C++](473.%20License%20Key%20Formatting/solution.h) [Python](473.%20License%20Key%20Formatting/solution.py)|[Note](473.%20License%20Key%20Formatting)|Easy| +|474|[Smallest Good Base](https://leetcode.com/problems/smallest-good-base)|[C++](474.%20Smallest%20Good%20Base/solution.h) [Python](474.%20Smallest%20Good%20Base/solution.py)|[Note](474.%20Smallest%20Good%20Base)|Hard| +|475|[Find Permutation](https://leetcode.com/problems/find-permutation)|[C++](475.%20Find%20Permutation/solution.h) [Python](475.%20Find%20Permutation/solution.py)|[Note](475.%20Find%20Permutation)|None| +|476|[Max Consecutive Ones](https://leetcode.com/problems/max-consecutive-ones)|[C++](476.%20Max%20Consecutive%20Ones/solution.h) [Python](476.%20Max%20Consecutive%20Ones/solution.py)|[Note](476.%20Max%20Consecutive%20Ones)|Easy| +|477|[Predict the Winner](https://leetcode.com/problems/predict-the-winner)|[C++](477.%20Predict%20the%20Winner/solution.h) [Python](477.%20Predict%20the%20Winner/solution.py)|[Note](477.%20Predict%20the%20Winner)|Medium| +|478|[Max Consecutive Ones II](https://leetcode.com/problems/max-consecutive-ones-ii)|[C++](478.%20Max%20Consecutive%20Ones%20II/solution.h) [Python](478.%20Max%20Consecutive%20Ones%20II/solution.py)|[Note](478.%20Max%20Consecutive%20Ones%20II)|None| +|479|[Zuma Game](https://leetcode.com/problems/zuma-game)|[C++](479.%20Zuma%20Game/solution.h) [Python](479.%20Zuma%20Game/solution.py)|[Note](479.%20Zuma%20Game)|Hard| +|480|[The Maze](https://leetcode.com/problems/the-maze)|[C++](480.%20The%20Maze/solution.h) [Python](480.%20The%20Maze/solution.py)|[Note](480.%20The%20Maze)|None| +|481|[Increasing Subsequences](https://leetcode.com/problems/increasing-subsequences)|[C++](481.%20Increasing%20Subsequences/solution.h) [Python](481.%20Increasing%20Subsequences/solution.py)|[Note](481.%20Increasing%20Subsequences)|Medium| +|482|[Construct the Rectangle](https://leetcode.com/problems/construct-the-rectangle)|[C++](482.%20Construct%20the%20Rectangle/solution.h) [Python](482.%20Construct%20the%20Rectangle/solution.py)|[Note](482.%20Construct%20the%20Rectangle)|Easy| +|483|[Reverse Pairs](https://leetcode.com/problems/reverse-pairs)|[C++](483.%20Reverse%20Pairs/solution.h) [Python](483.%20Reverse%20Pairs/solution.py)|[Note](483.%20Reverse%20Pairs)|Hard| +|484|[Target Sum](https://leetcode.com/problems/target-sum)|[C++](484.%20Target%20Sum/solution.h) [Python](484.%20Target%20Sum/solution.py)|[Note](484.%20Target%20Sum)|Medium| +|485|[Teemo Attacking](https://leetcode.com/problems/teemo-attacking)|[C++](485.%20Teemo%20Attacking/solution.h) [Python](485.%20Teemo%20Attacking/solution.py)|[Note](485.%20Teemo%20Attacking)|Medium| +|486|[Next Greater Element I](https://leetcode.com/problems/next-greater-element-i)|[C++](486.%20Next%20Greater%20Element%20I/solution.h) [Python](486.%20Next%20Greater%20Element%20I/solution.py)|[Note](486.%20Next%20Greater%20Element%20I)|Easy| +|487|[Diagonal Traverse](https://leetcode.com/problems/diagonal-traverse)|[C++](487.%20Diagonal%20Traverse/solution.h) [Python](487.%20Diagonal%20Traverse/solution.py)|[Note](487.%20Diagonal%20Traverse)|Medium| +|488|[The Maze III](https://leetcode.com/problems/the-maze-iii)|[C++](488.%20The%20Maze%20III/solution.h) [Python](488.%20The%20Maze%20III/solution.py)|[Note](488.%20The%20Maze%20III)|None| +|489|[Keyboard Row](https://leetcode.com/problems/keyboard-row)|[C++](489.%20Keyboard%20Row/solution.h) [Python](489.%20Keyboard%20Row/solution.py)|[Note](489.%20Keyboard%20Row)|Easy| +|490|[Find Mode in Binary Search Tree](https://leetcode.com/problems/find-mode-in-binary-search-tree)|[C++](490.%20Find%20Mode%20in%20Binary%20Search%20Tree/solution.h) [Python](490.%20Find%20Mode%20in%20Binary%20Search%20Tree/solution.py)|[Note](490.%20Find%20Mode%20in%20Binary%20Search%20Tree)|Easy| +|491|[IPO](https://leetcode.com/problems/ipo)|[C++](491.%20IPO/solution.h) [Python](491.%20IPO/solution.py)|[Note](491.%20IPO)|Hard| +|492|[Next Greater Element II](https://leetcode.com/problems/next-greater-element-ii)|[C++](492.%20Next%20Greater%20Element%20II/solution.h) [Python](492.%20Next%20Greater%20Element%20II/solution.py)|[Note](492.%20Next%20Greater%20Element%20II)|Medium| +|493|[Base 7](https://leetcode.com/problems/base-7)|[C++](493.%20Base%207/solution.h) [Python](493.%20Base%207/solution.py)|[Note](493.%20Base%207)|Easy| +|494|[The Maze II](https://leetcode.com/problems/the-maze-ii)|[C++](494.%20The%20Maze%20II/solution.h) [Python](494.%20The%20Maze%20II/solution.py)|[Note](494.%20The%20Maze%20II)|None| +|495|[Relative Ranks](https://leetcode.com/problems/relative-ranks)|[C++](495.%20Relative%20Ranks/solution.h) [Python](495.%20Relative%20Ranks/solution.py)|[Note](495.%20Relative%20Ranks)|Easy| +|496|[Perfect Number](https://leetcode.com/problems/perfect-number)|[C++](496.%20Perfect%20Number/solution.h) [Python](496.%20Perfect%20Number/solution.py)|[Note](496.%20Perfect%20Number)|Easy| +|497|[Most Frequent Subtree Sum](https://leetcode.com/problems/most-frequent-subtree-sum)|[C++](497.%20Most%20Frequent%20Subtree%20Sum/solution.h) [Python](497.%20Most%20Frequent%20Subtree%20Sum/solution.py)|[Note](497.%20Most%20Frequent%20Subtree%20Sum)|Medium| +|498|[Find Bottom Left Tree Value](https://leetcode.com/problems/find-bottom-left-tree-value)|[C++](498.%20Find%20Bottom%20Left%20Tree%20Value/solution.h) [Python](498.%20Find%20Bottom%20Left%20Tree%20Value/solution.py)|[Note](498.%20Find%20Bottom%20Left%20Tree%20Value)|Medium| +|499|[Freedom Trail](https://leetcode.com/problems/freedom-trail)|[C++](499.%20Freedom%20Trail/solution.h) [Python](499.%20Freedom%20Trail/solution.py)|[Note](499.%20Freedom%20Trail)|Hard| +|500|[Find Largest Value in Each Tree Row](https://leetcode.com/problems/find-largest-value-in-each-tree-row)|[C++](500.%20Find%20Largest%20Value%20in%20Each%20Tree%20Row/solution.h) [Python](500.%20Find%20Largest%20Value%20in%20Each%20Tree%20Row/solution.py)|[Note](500.%20Find%20Largest%20Value%20in%20Each%20Tree%20Row)|Medium| +|501|[Longest Palindromic Subsequence](https://leetcode.com/problems/longest-palindromic-subsequence)|[C++](501.%20Longest%20Palindromic%20Subsequence/solution.h) [Python](501.%20Longest%20Palindromic%20Subsequence/solution.py)|[Note](501.%20Longest%20Palindromic%20Subsequence)|Medium| +|502|[Super Washing Machines](https://leetcode.com/problems/super-washing-machines)|[C++](502.%20Super%20Washing%20Machines/solution.h) [Python](502.%20Super%20Washing%20Machines/solution.py)|[Note](502.%20Super%20Washing%20Machines)|Hard| +|503|[Coin Change 2](https://leetcode.com/problems/coin-change-2)|[C++](503.%20Coin%20Change%202/solution.h) [Python](503.%20Coin%20Change%202/solution.py)|[Note](503.%20Coin%20Change%202)|Medium| +|504|[Detect Capital](https://leetcode.com/problems/detect-capital)|[C++](504.%20Detect%20Capital/solution.h) [Python](504.%20Detect%20Capital/solution.py)|[Note](504.%20Detect%20Capital)|Easy| +|505|[Longest Uncommon Subsequence I ](https://leetcode.com/problems/longest-uncommon-subsequence-i)|[C++](505.%20Longest%20Uncommon%20Subsequence%20I%20/solution.h) [Python](505.%20Longest%20Uncommon%20Subsequence%20I%20/solution.py)|[Note](505.%20Longest%20Uncommon%20Subsequence%20I%20)|Easy| +|506|[Longest Uncommon Subsequence II](https://leetcode.com/problems/longest-uncommon-subsequence-ii)|[C++](506.%20Longest%20Uncommon%20Subsequence%20II/solution.h) [Python](506.%20Longest%20Uncommon%20Subsequence%20II/solution.py)|[Note](506.%20Longest%20Uncommon%20Subsequence%20II)|Medium| +|507|[Continuous Subarray Sum](https://leetcode.com/problems/continuous-subarray-sum)|[C++](507.%20Continuous%20Subarray%20Sum/solution.h) [Python](507.%20Continuous%20Subarray%20Sum/solution.py)|[Note](507.%20Continuous%20Subarray%20Sum)|Medium| +|508|[Longest Word in Dictionary through Deleting](https://leetcode.com/problems/longest-word-in-dictionary-through-deleting)|[C++](508.%20Longest%20Word%20in%20Dictionary%20through%20Deleting/solution.h) [Python](508.%20Longest%20Word%20in%20Dictionary%20through%20Deleting/solution.py)|[Note](508.%20Longest%20Word%20in%20Dictionary%20through%20Deleting)|Medium| +|509|[Contiguous Array](https://leetcode.com/problems/contiguous-array)|[C++](509.%20Contiguous%20Array/solution.h) [Python](509.%20Contiguous%20Array/solution.py)|[Note](509.%20Contiguous%20Array)|Medium| +|510|[Beautiful Arrangement](https://leetcode.com/problems/beautiful-arrangement)|[C++](510.%20Beautiful%20Arrangement/solution.h) [Python](510.%20Beautiful%20Arrangement/solution.py)|[Note](510.%20Beautiful%20Arrangement)|Medium| +|511|[Word Abbreviation](https://leetcode.com/problems/word-abbreviation)|[C++](511.%20Word%20Abbreviation/solution.h) [Python](511.%20Word%20Abbreviation/solution.py)|[Note](511.%20Word%20Abbreviation)|None| +|512|[Minesweeper](https://leetcode.com/problems/minesweeper)|[C++](512.%20Minesweeper/solution.h) [Python](512.%20Minesweeper/solution.py)|[Note](512.%20Minesweeper)|Medium| +|513|[Minimum Absolute Difference in BST](https://leetcode.com/problems/minimum-absolute-difference-in-bst)|[C++](513.%20Minimum%20Absolute%20Difference%20in%20BST/solution.h) [Python](513.%20Minimum%20Absolute%20Difference%20in%20BST/solution.py)|[Note](513.%20Minimum%20Absolute%20Difference%20in%20BST)|Easy| +|514|[Lonely Pixel I](https://leetcode.com/problems/lonely-pixel-i)|[C++](514.%20Lonely%20Pixel%20I/solution.h) [Python](514.%20Lonely%20Pixel%20I/solution.py)|[Note](514.%20Lonely%20Pixel%20I)|None| +|515|[K-diff Pairs in an Array](https://leetcode.com/problems/k-diff-pairs-in-an-array)|[C++](515.%20K-diff%20Pairs%20in%20an%20Array/solution.h) [Python](515.%20K-diff%20Pairs%20in%20an%20Array/solution.py)|[Note](515.%20K-diff%20Pairs%20in%20an%20Array)|Easy| +|516|[Lonely Pixel II](https://leetcode.com/problems/lonely-pixel-ii)|[C++](516.%20Lonely%20Pixel%20II/solution.h) [Python](516.%20Lonely%20Pixel%20II/solution.py)|[Note](516.%20Lonely%20Pixel%20II)|None| +|517|[Design TinyURL](https://leetcode.com/problems/design-tinyurl)|[C++](517.%20Design%20TinyURL/solution.h) [Python](517.%20Design%20TinyURL/solution.py)|[Note](517.%20Design%20TinyURL)|Medium| +|518|[Encode and Decode TinyURL](https://leetcode.com/problems/encode-and-decode-tinyurl)|[C++](518.%20Encode%20and%20Decode%20TinyURL/solution.h) [Python](518.%20Encode%20and%20Decode%20TinyURL/solution.py)|[Note](518.%20Encode%20and%20Decode%20TinyURL)|Medium| +|519|[Construct Binary Tree from String](https://leetcode.com/problems/construct-binary-tree-from-string)|[C++](519.%20Construct%20Binary%20Tree%20from%20String/solution.h) [Python](519.%20Construct%20Binary%20Tree%20from%20String/solution.py)|[Note](519.%20Construct%20Binary%20Tree%20from%20String)|None| +|520|[Complex Number Multiplication](https://leetcode.com/problems/complex-number-multiplication)|[C++](520.%20Complex%20Number%20Multiplication/solution.h) [Python](520.%20Complex%20Number%20Multiplication/solution.py)|[Note](520.%20Complex%20Number%20Multiplication)|Medium| +|521|[Convert BST to Greater Tree](https://leetcode.com/problems/convert-bst-to-greater-tree)|[C++](521.%20Convert%20BST%20to%20Greater%20Tree/solution.h) [Python](521.%20Convert%20BST%20to%20Greater%20Tree/solution.py)|[Note](521.%20Convert%20BST%20to%20Greater%20Tree)|Easy| +|522|[Minimum Time Difference](https://leetcode.com/problems/minimum-time-difference)|[C++](522.%20Minimum%20Time%20Difference/solution.h) [Python](522.%20Minimum%20Time%20Difference/solution.py)|[Note](522.%20Minimum%20Time%20Difference)|Medium| +|523|[Single Element in a Sorted Array](https://leetcode.com/problems/single-element-in-a-sorted-array)|[C++](523.%20Single%20Element%20in%20a%20Sorted%20Array/solution.h) [Python](523.%20Single%20Element%20in%20a%20Sorted%20Array/solution.py)|[Note](523.%20Single%20Element%20in%20a%20Sorted%20Array)|Medium| +|524|[Reverse String II](https://leetcode.com/problems/reverse-string-ii)|[C++](524.%20Reverse%20String%20II/solution.h) [Python](524.%20Reverse%20String%20II/solution.py)|[Note](524.%20Reverse%20String%20II)|Easy| +|525|[01 Matrix](https://leetcode.com/problems/01-matrix)|[C++](525.%2001%20Matrix/solution.h) [Python](525.%2001%20Matrix/solution.py)|[Note](525.%2001%20Matrix)|Medium| +|526|[Diameter of Binary Tree](https://leetcode.com/problems/diameter-of-binary-tree)|[C++](526.%20Diameter%20of%20Binary%20Tree/solution.h) [Python](526.%20Diameter%20of%20Binary%20Tree/solution.py)|[Note](526.%20Diameter%20of%20Binary%20Tree)|Easy| +|527|[Output Contest Matches](https://leetcode.com/problems/output-contest-matches)|[C++](527.%20Output%20Contest%20Matches/solution.h) [Python](527.%20Output%20Contest%20Matches/solution.py)|[Note](527.%20Output%20Contest%20Matches)|None| +|528|[Boundary of Binary Tree](https://leetcode.com/problems/boundary-of-binary-tree)|[C++](528.%20Boundary%20of%20Binary%20Tree/solution.h) [Python](528.%20Boundary%20of%20Binary%20Tree/solution.py)|[Note](528.%20Boundary%20of%20Binary%20Tree)|None| +|529|[Remove Boxes](https://leetcode.com/problems/remove-boxes)|[C++](529.%20Remove%20Boxes/solution.h) [Python](529.%20Remove%20Boxes/solution.py)|[Note](529.%20Remove%20Boxes)|Hard| +|530|[Friend Circles](https://leetcode.com/problems/friend-circles)|[C++](530.%20Friend%20Circles/solution.h) [Python](530.%20Friend%20Circles/solution.py)|[Note](530.%20Friend%20Circles)|Medium| +|531|[Split Array with Equal Sum](https://leetcode.com/problems/split-array-with-equal-sum)|[C++](531.%20Split%20Array%20with%20Equal%20Sum/solution.h) [Python](531.%20Split%20Array%20with%20Equal%20Sum/solution.py)|[Note](531.%20Split%20Array%20with%20Equal%20Sum)|None| +|532|[Binary Tree Longest Consecutive Sequence II](https://leetcode.com/problems/binary-tree-longest-consecutive-sequence-ii)|[C++](532.%20Binary%20Tree%20Longest%20Consecutive%20Sequence%20II/solution.h) [Python](532.%20Binary%20Tree%20Longest%20Consecutive%20Sequence%20II/solution.py)|[Note](532.%20Binary%20Tree%20Longest%20Consecutive%20Sequence%20II)|None| +|533|[Student Attendance Record I](https://leetcode.com/problems/student-attendance-record-i)|[C++](533.%20Student%20Attendance%20Record%20I/solution.h) [Python](533.%20Student%20Attendance%20Record%20I/solution.py)|[Note](533.%20Student%20Attendance%20Record%20I)|Easy| +|534|[Student Attendance Record II](https://leetcode.com/problems/student-attendance-record-ii)|[C++](534.%20Student%20Attendance%20Record%20II/solution.h) [Python](534.%20Student%20Attendance%20Record%20II/solution.py)|[Note](534.%20Student%20Attendance%20Record%20II)|Hard| +|535|[Optimal Division](https://leetcode.com/problems/optimal-division)|[C++](535.%20Optimal%20Division/solution.h) [Python](535.%20Optimal%20Division/solution.py)|[Note](535.%20Optimal%20Division)|Medium| +|536|[Brick Wall](https://leetcode.com/problems/brick-wall)|[C++](536.%20Brick%20Wall/solution.h) [Python](536.%20Brick%20Wall/solution.py)|[Note](536.%20Brick%20Wall)|Medium| +|537|[Split Concatenated Strings](https://leetcode.com/problems/split-concatenated-strings)|[C++](537.%20Split%20Concatenated%20Strings/solution.h) [Python](537.%20Split%20Concatenated%20Strings/solution.py)|[Note](537.%20Split%20Concatenated%20Strings)|None| +|538|[Next Greater Element III](https://leetcode.com/problems/next-greater-element-iii)|[C++](538.%20Next%20Greater%20Element%20III/solution.h) [Python](538.%20Next%20Greater%20Element%20III/solution.py)|[Note](538.%20Next%20Greater%20Element%20III)|Medium| +|539|[Reverse Words in a String III](https://leetcode.com/problems/reverse-words-in-a-string-iii)|[C++](539.%20Reverse%20Words%20in%20a%20String%20III/solution.h) [Python](539.%20Reverse%20Words%20in%20a%20String%20III/solution.py)|[Note](539.%20Reverse%20Words%20in%20a%20String%20III)|Easy| +|540|[Subarray Sum Equals K](https://leetcode.com/problems/subarray-sum-equals-k)|[C++](540.%20Subarray%20Sum%20Equals%20K/solution.h) [Python](540.%20Subarray%20Sum%20Equals%20K/solution.py)|[Note](540.%20Subarray%20Sum%20Equals%20K)|Medium| +|541|[Array Partition I](https://leetcode.com/problems/array-partition-i)|[C++](541.%20Array%20Partition%20I/solution.h) [Python](541.%20Array%20Partition%20I/solution.py)|[Note](541.%20Array%20Partition%20I)|Easy| +|542|[Longest Line of Consecutive One in Matrix](https://leetcode.com/problems/longest-line-of-consecutive-one-in-matrix)|[C++](542.%20Longest%20Line%20of%20Consecutive%20One%20in%20Matrix/solution.h) [Python](542.%20Longest%20Line%20of%20Consecutive%20One%20in%20Matrix/solution.py)|[Note](542.%20Longest%20Line%20of%20Consecutive%20One%20in%20Matrix)|None| +|543|[Binary Tree Tilt](https://leetcode.com/problems/binary-tree-tilt)|[C++](543.%20Binary%20Tree%20Tilt/solution.h) [Python](543.%20Binary%20Tree%20Tilt/solution.py)|[Note](543.%20Binary%20Tree%20Tilt)|Easy| +|544|[Find the Closest Palindrome](https://leetcode.com/problems/find-the-closest-palindrome)|[C++](544.%20Find%20the%20Closest%20Palindrome/solution.h) [Python](544.%20Find%20the%20Closest%20Palindrome/solution.py)|[Note](544.%20Find%20the%20Closest%20Palindrome)|Hard| +|545|[Array Nesting](https://leetcode.com/problems/array-nesting)|[C++](545.%20Array%20Nesting/solution.h) [Python](545.%20Array%20Nesting/solution.py)|[Note](545.%20Array%20Nesting)|Medium| +|546|[Reshape the Matrix](https://leetcode.com/problems/reshape-the-matrix)|[C++](546.%20Reshape%20the%20Matrix/solution.h) [Python](546.%20Reshape%20the%20Matrix/solution.py)|[Note](546.%20Reshape%20the%20Matrix)|Easy| +|547|[Permutation in String](https://leetcode.com/problems/permutation-in-string)|[C++](547.%20Permutation%20in%20String/solution.h) [Python](547.%20Permutation%20in%20String/solution.py)|[Note](547.%20Permutation%20in%20String)|Medium| +|548|[Maximum Vacation Days](https://leetcode.com/problems/maximum-vacation-days)|[C++](548.%20Maximum%20Vacation%20Days/solution.h) [Python](548.%20Maximum%20Vacation%20Days/solution.py)|[Note](548.%20Maximum%20Vacation%20Days)|None| +|549|[Median Employee Salary](https://leetcode.com/problems/median-employee-salary)|[C++](549.%20Median%20Employee%20Salary/solution.h) [Python](549.%20Median%20Employee%20Salary/solution.py)|[Note](549.%20Median%20Employee%20Salary)|None| +|550|[Managers with at Least 5 Direct Reports](https://leetcode.com/problems/managers-with-at-least-5-direct-reports)|[C++](550.%20Managers%20with%20at%20Least%205%20Direct%20Reports/solution.h) [Python](550.%20Managers%20with%20at%20Least%205%20Direct%20Reports/solution.py)|[Note](550.%20Managers%20with%20at%20Least%205%20Direct%20Reports)|None| +|551|[Find Median Given Frequency of Numbers](https://leetcode.com/problems/find-median-given-frequency-of-numbers)|[C++](551.%20Find%20Median%20Given%20Frequency%20of%20Numbers/solution.h) [Python](551.%20Find%20Median%20Given%20Frequency%20of%20Numbers/solution.py)|[Note](551.%20Find%20Median%20Given%20Frequency%20of%20Numbers)|None| +|552|[Subtree of Another Tree](https://leetcode.com/problems/subtree-of-another-tree)|[C++](552.%20Subtree%20of%20Another%20Tree/solution.h) [Python](552.%20Subtree%20of%20Another%20Tree/solution.py)|[Note](552.%20Subtree%20of%20Another%20Tree)|Easy| +|553|[Squirrel Simulation](https://leetcode.com/problems/squirrel-simulation)|[C++](553.%20Squirrel%20Simulation/solution.h) [Python](553.%20Squirrel%20Simulation/solution.py)|[Note](553.%20Squirrel%20Simulation)|None| +|554|[Winning Candidate](https://leetcode.com/problems/winning-candidate)|[C++](554.%20Winning%20Candidate/solution.h) [Python](554.%20Winning%20Candidate/solution.py)|[Note](554.%20Winning%20Candidate)|None| +|555|[Distribute Candies](https://leetcode.com/problems/distribute-candies)|[C++](555.%20Distribute%20Candies/solution.h) [Python](555.%20Distribute%20Candies/solution.py)|[Note](555.%20Distribute%20Candies)|Easy| +|556|[Out of Boundary Paths](https://leetcode.com/problems/out-of-boundary-paths)|[C++](556.%20Out%20of%20Boundary%20Paths/solution.h) [Python](556.%20Out%20of%20Boundary%20Paths/solution.py)|[Note](556.%20Out%20of%20Boundary%20Paths)|Medium| +|557|[Employee Bonus](https://leetcode.com/problems/employee-bonus)|[C++](557.%20Employee%20Bonus/solution.h) [Python](557.%20Employee%20Bonus/solution.py)|[Note](557.%20Employee%20Bonus)|None| +|558|[Get Highest Answer Rate Question](https://leetcode.com/problems/get-highest-answer-rate-question)|[C++](558.%20Get%20Highest%20Answer%20Rate%20Question/solution.h) [Python](558.%20Get%20Highest%20Answer%20Rate%20Question/solution.py)|[Note](558.%20Get%20Highest%20Answer%20Rate%20Question)|None| +|559|[Find Cumulative Salary of an Employee](https://leetcode.com/problems/find-cumulative-salary-of-an-employee)|[C++](559.%20Find%20Cumulative%20Salary%20of%20an%20Employee/solution.h) [Python](559.%20Find%20Cumulative%20Salary%20of%20an%20Employee/solution.py)|[Note](559.%20Find%20Cumulative%20Salary%20of%20an%20Employee)|None| +|560|[Count Student Number in Departments](https://leetcode.com/problems/count-student-number-in-departments)|[C++](560.%20Count%20Student%20Number%20in%20Departments/solution.h) [Python](560.%20Count%20Student%20Number%20in%20Departments/solution.py)|[Note](560.%20Count%20Student%20Number%20in%20Departments)|None| +|561|[Shortest Unsorted Continuous Subarray](https://leetcode.com/problems/shortest-unsorted-continuous-subarray)|[C++](561.%20Shortest%20Unsorted%20Continuous%20Subarray/solution.h) [Python](561.%20Shortest%20Unsorted%20Continuous%20Subarray/solution.py)|[Note](561.%20Shortest%20Unsorted%20Continuous%20Subarray)|Easy| +|562|[Kill Process](https://leetcode.com/problems/kill-process)|[C++](562.%20Kill%20Process/solution.h) [Python](562.%20Kill%20Process/solution.py)|[Note](562.%20Kill%20Process)|None| +|563|[Delete Operation for Two Strings](https://leetcode.com/problems/delete-operation-for-two-strings)|[C++](563.%20Delete%20Operation%20for%20Two%20Strings/solution.h) [Python](563.%20Delete%20Operation%20for%20Two%20Strings/solution.py)|[Note](563.%20Delete%20Operation%20for%20Two%20Strings)|Medium| +|564|[Find Customer Referee](https://leetcode.com/problems/find-customer-referee)|[C++](564.%20Find%20Customer%20Referee/solution.h) [Python](564.%20Find%20Customer%20Referee/solution.py)|[Note](564.%20Find%20Customer%20Referee)|None| +|565|[Investments in 2016](https://leetcode.com/problems/investments-in-2016)|[C++](565.%20Investments%20in%202016/solution.h) [Python](565.%20Investments%20in%202016/solution.py)|[Note](565.%20Investments%20in%202016)|None| +|566|[Customer Placing the Largest Number of Orders](https://leetcode.com/problems/customer-placing-the-largest-number-of-orders)|[C++](566.%20Customer%20Placing%20the%20Largest%20Number%20of%20Orders/solution.h) [Python](566.%20Customer%20Placing%20the%20Largest%20Number%20of%20Orders/solution.py)|[Note](566.%20Customer%20Placing%20the%20Largest%20Number%20of%20Orders)|None| +|567|[Erect the Fence](https://leetcode.com/problems/erect-the-fence)|[C++](567.%20Erect%20the%20Fence/solution.h) [Python](567.%20Erect%20the%20Fence/solution.py)|[Note](567.%20Erect%20the%20Fence)|Hard| +|568|[Design In-Memory File System](https://leetcode.com/problems/design-in-memory-file-system)|[C++](568.%20Design%20In-Memory%20File%20System/solution.h) [Python](568.%20Design%20In-Memory%20File%20System/solution.py)|[Note](568.%20Design%20In-Memory%20File%20System)|None| +|569|[Tag Validator](https://leetcode.com/problems/tag-validator)|[C++](569.%20Tag%20Validator/solution.h) [Python](569.%20Tag%20Validator/solution.py)|[Note](569.%20Tag%20Validator)|Hard| +|570|[Fraction Addition and Subtraction](https://leetcode.com/problems/fraction-addition-and-subtraction)|[C++](570.%20Fraction%20Addition%20and%20Subtraction/solution.h) [Python](570.%20Fraction%20Addition%20and%20Subtraction/solution.py)|[Note](570.%20Fraction%20Addition%20and%20Subtraction)|Medium| +|571|[Valid Square](https://leetcode.com/problems/valid-square)|[C++](571.%20Valid%20Square/solution.h) [Python](571.%20Valid%20Square/solution.py)|[Note](571.%20Valid%20Square)|Medium| +|572|[Longest Harmonious Subsequence](https://leetcode.com/problems/longest-harmonious-subsequence)|[C++](572.%20Longest%20Harmonious%20Subsequence/solution.h) [Python](572.%20Longest%20Harmonious%20Subsequence/solution.py)|[Note](572.%20Longest%20Harmonious%20Subsequence)|Easy| +|573|[Big Countries](https://leetcode.com/problems/big-countries)|[C++](573.%20Big%20Countries/solution.h) [Python](573.%20Big%20Countries/solution.py)|[Note](573.%20Big%20Countries)|Easy| +|574|[Classes More Than 5 Students](https://leetcode.com/problems/classes-more-than-5-students)|[C++](574.%20Classes%20More%20Than%205%20Students/solution.h) [Python](574.%20Classes%20More%20Than%205%20Students/solution.py)|[Note](574.%20Classes%20More%20Than%205%20Students)|Easy| +|575|[Friend Requests I: Overall Acceptance Rate](https://leetcode.com/problems/friend-requests-i-overall-acceptance-rate)|[C++](575.%20Friend%20Requests%20I:%20Overall%20Acceptance%20Rate/solution.h) [Python](575.%20Friend%20Requests%20I:%20Overall%20Acceptance%20Rate/solution.py)|[Note](575.%20Friend%20Requests%20I:%20Overall%20Acceptance%20Rate)|None| +|576|[Range Addition II](https://leetcode.com/problems/range-addition-ii)|[C++](576.%20Range%20Addition%20II/solution.h) [Python](576.%20Range%20Addition%20II/solution.py)|[Note](576.%20Range%20Addition%20II)|Easy| +|577|[Minimum Index Sum of Two Lists](https://leetcode.com/problems/minimum-index-sum-of-two-lists)|[C++](577.%20Minimum%20Index%20Sum%20of%20Two%20Lists/solution.h) [Python](577.%20Minimum%20Index%20Sum%20of%20Two%20Lists/solution.py)|[Note](577.%20Minimum%20Index%20Sum%20of%20Two%20Lists)|Easy| +|578|[Non-negative Integers without Consecutive Ones](https://leetcode.com/problems/non-negative-integers-without-consecutive-ones)|[C++](578.%20Non-negative%20Integers%20without%20Consecutive%20Ones/solution.h) [Python](578.%20Non-negative%20Integers%20without%20Consecutive%20Ones/solution.py)|[Note](578.%20Non-negative%20Integers%20without%20Consecutive%20Ones)|Hard| +|579|[Human Traffic of Stadium](https://leetcode.com/problems/human-traffic-of-stadium)|[C++](579.%20Human%20Traffic%20of%20Stadium/solution.h) [Python](579.%20Human%20Traffic%20of%20Stadium/solution.py)|[Note](579.%20Human%20Traffic%20of%20Stadium)|Hard| +|580|[Friend Requests II: Who Has the Most Friends](https://leetcode.com/problems/friend-requests-ii-who-has-the-most-friends)|[C++](580.%20Friend%20Requests%20II:%20Who%20Has%20the%20Most%20Friends/solution.h) [Python](580.%20Friend%20Requests%20II:%20Who%20Has%20the%20Most%20Friends/solution.py)|[Note](580.%20Friend%20Requests%20II:%20Who%20Has%20the%20Most%20Friends)|None| +|581|[Consecutive Available Seats](https://leetcode.com/problems/consecutive-available-seats)|[C++](581.%20Consecutive%20Available%20Seats/solution.h) [Python](581.%20Consecutive%20Available%20Seats/solution.py)|[Note](581.%20Consecutive%20Available%20Seats)|None| +|582|[Design Compressed String Iterator](https://leetcode.com/problems/design-compressed-string-iterator)|[C++](582.%20Design%20Compressed%20String%20Iterator/solution.h) [Python](582.%20Design%20Compressed%20String%20Iterator/solution.py)|[Note](582.%20Design%20Compressed%20String%20Iterator)|None| +|583|[Can Place Flowers](https://leetcode.com/problems/can-place-flowers)|[C++](583.%20Can%20Place%20Flowers/solution.h) [Python](583.%20Can%20Place%20Flowers/solution.py)|[Note](583.%20Can%20Place%20Flowers)|Easy| +|584|[Construct String from Binary Tree](https://leetcode.com/problems/construct-string-from-binary-tree)|[C++](584.%20Construct%20String%20from%20Binary%20Tree/solution.h) [Python](584.%20Construct%20String%20from%20Binary%20Tree/solution.py)|[Note](584.%20Construct%20String%20from%20Binary%20Tree)|Easy| +|585|[Sales Person](https://leetcode.com/problems/sales-person)|[C++](585.%20Sales%20Person/solution.h) [Python](585.%20Sales%20Person/solution.py)|[Note](585.%20Sales%20Person)|None| +|586|[Tree Node](https://leetcode.com/problems/tree-node)|[C++](586.%20Tree%20Node/solution.h) [Python](586.%20Tree%20Node/solution.py)|[Note](586.%20Tree%20Node)|None| +|587|[Find Duplicate File in System](https://leetcode.com/problems/find-duplicate-file-in-system)|[C++](587.%20Find%20Duplicate%20File%20in%20System/solution.h) [Python](587.%20Find%20Duplicate%20File%20in%20System/solution.py)|[Note](587.%20Find%20Duplicate%20File%20in%20System)|Medium| +|588|[Triangle Judgement](https://leetcode.com/problems/triangle-judgement)|[C++](588.%20Triangle%20Judgement/solution.h) [Python](588.%20Triangle%20Judgement/solution.py)|[Note](588.%20Triangle%20Judgement)|None| +|589|[Valid Triangle Number](https://leetcode.com/problems/valid-triangle-number)|[C++](589.%20Valid%20Triangle%20Number/solution.h) [Python](589.%20Valid%20Triangle%20Number/solution.py)|[Note](589.%20Valid%20Triangle%20Number)|Medium| +|590|[Shortest Distance in a Plane](https://leetcode.com/problems/shortest-distance-in-a-plane)|[C++](590.%20Shortest%20Distance%20in%20a%20Plane/solution.h) [Python](590.%20Shortest%20Distance%20in%20a%20Plane/solution.py)|[Note](590.%20Shortest%20Distance%20in%20a%20Plane)|None| +|591|[Shortest Distance in a Line](https://leetcode.com/problems/shortest-distance-in-a-line)|[C++](591.%20Shortest%20Distance%20in%20a%20Line/solution.h) [Python](591.%20Shortest%20Distance%20in%20a%20Line/solution.py)|[Note](591.%20Shortest%20Distance%20in%20a%20Line)|None| +|592|[Second Degree Follower](https://leetcode.com/problems/second-degree-follower)|[C++](592.%20Second%20Degree%20Follower/solution.h) [Python](592.%20Second%20Degree%20Follower/solution.py)|[Note](592.%20Second%20Degree%20Follower)|None| +|593|[Average Salary: Departments VS Company](https://leetcode.com/problems/average-salary-departments-vs-company)|[C++](593.%20Average%20Salary:%20Departments%20VS%20Company/solution.h) [Python](593.%20Average%20Salary:%20Departments%20VS%20Company/solution.py)|[Note](593.%20Average%20Salary:%20Departments%20VS%20Company)|None| +|594|[Add Bold Tag in String](https://leetcode.com/problems/add-bold-tag-in-string)|[C++](594.%20Add%20Bold%20Tag%20in%20String/solution.h) [Python](594.%20Add%20Bold%20Tag%20in%20String/solution.py)|[Note](594.%20Add%20Bold%20Tag%20in%20String)|None| +|595|[Merge Two Binary Trees](https://leetcode.com/problems/merge-two-binary-trees)|[C++](595.%20Merge%20Two%20Binary%20Trees/solution.h) [Python](595.%20Merge%20Two%20Binary%20Trees/solution.py)|[Note](595.%20Merge%20Two%20Binary%20Trees)|Easy| +|596|[Students Report By Geography](https://leetcode.com/problems/students-report-by-geography)|[C++](596.%20Students%20Report%20By%20Geography/solution.h) [Python](596.%20Students%20Report%20By%20Geography/solution.py)|[Note](596.%20Students%20Report%20By%20Geography)|None| +|597|[Biggest Single Number](https://leetcode.com/problems/biggest-single-number)|[C++](597.%20Biggest%20Single%20Number/solution.h) [Python](597.%20Biggest%20Single%20Number/solution.py)|[Note](597.%20Biggest%20Single%20Number)|None| +|598|[Not Boring Movies](https://leetcode.com/problems/not-boring-movies)|[C++](598.%20Not%20Boring%20Movies/solution.h) [Python](598.%20Not%20Boring%20Movies/solution.py)|[Note](598.%20Not%20Boring%20Movies)|Easy| +|599|[Task Scheduler](https://leetcode.com/problems/task-scheduler)|[C++](599.%20Task%20Scheduler/solution.h) [Python](599.%20Task%20Scheduler/solution.py)|[Note](599.%20Task%20Scheduler)|Medium| +|600|[Add One Row to Tree](https://leetcode.com/problems/add-one-row-to-tree)|[C++](600.%20Add%20One%20Row%20to%20Tree/solution.h) [Python](600.%20Add%20One%20Row%20to%20Tree/solution.py)|[Note](600.%20Add%20One%20Row%20to%20Tree)|Medium| +|601|[Maximum Distance in Arrays](https://leetcode.com/problems/maximum-distance-in-arrays)|[C++](601.%20Maximum%20Distance%20in%20Arrays/solution.h) [Python](601.%20Maximum%20Distance%20in%20Arrays/solution.py)|[Note](601.%20Maximum%20Distance%20in%20Arrays)|None| +|602|[Minimum Factorization](https://leetcode.com/problems/minimum-factorization)|[C++](602.%20Minimum%20Factorization/solution.h) [Python](602.%20Minimum%20Factorization/solution.py)|[Note](602.%20Minimum%20Factorization)|None| +|603|[Exchange Seats](https://leetcode.com/problems/exchange-seats)|[C++](603.%20Exchange%20Seats/solution.h) [Python](603.%20Exchange%20Seats/solution.py)|[Note](603.%20Exchange%20Seats)|Medium| +|604|[Swap Salary](https://leetcode.com/problems/swap-salary)|[C++](604.%20Swap%20Salary/solution.h) [Python](604.%20Swap%20Salary/solution.py)|[Note](604.%20Swap%20Salary)|Easy| +|605|[Maximum Product of Three Numbers](https://leetcode.com/problems/maximum-product-of-three-numbers)|[C++](605.%20Maximum%20Product%20of%20Three%20Numbers/solution.h) [Python](605.%20Maximum%20Product%20of%20Three%20Numbers/solution.py)|[Note](605.%20Maximum%20Product%20of%20Three%20Numbers)|Easy| +|606|[K Inverse Pairs Array](https://leetcode.com/problems/k-inverse-pairs-array)|[C++](606.%20K%20Inverse%20Pairs%20Array/solution.h) [Python](606.%20K%20Inverse%20Pairs%20Array/solution.py)|[Note](606.%20K%20Inverse%20Pairs%20Array)|Hard| +|607|[Course Schedule III](https://leetcode.com/problems/course-schedule-iii)|[C++](607.%20Course%20Schedule%20III/solution.h) [Python](607.%20Course%20Schedule%20III/solution.py)|[Note](607.%20Course%20Schedule%20III)|Hard| +|608|[Design Excel Sum Formula](https://leetcode.com/problems/design-excel-sum-formula)|[C++](608.%20Design%20Excel%20Sum%20Formula/solution.h) [Python](608.%20Design%20Excel%20Sum%20Formula/solution.py)|[Note](608.%20Design%20Excel%20Sum%20Formula)|None| +|609|[Smallest Range](https://leetcode.com/problems/smallest-range)|[C++](609.%20Smallest%20Range/solution.h) [Python](609.%20Smallest%20Range/solution.py)|[Note](609.%20Smallest%20Range)|Hard| +|610|[Sum of Square Numbers](https://leetcode.com/problems/sum-of-square-numbers)|[C++](610.%20Sum%20of%20Square%20Numbers/solution.h) [Python](610.%20Sum%20of%20Square%20Numbers/solution.py)|[Note](610.%20Sum%20of%20Square%20Numbers)|Easy| +|611|[Find the Derangement of An Array](https://leetcode.com/problems/find-the-derangement-of-an-array)|[C++](611.%20Find%20the%20Derangement%20of%20An%20Array/solution.h) [Python](611.%20Find%20the%20Derangement%20of%20An%20Array/solution.py)|[Note](611.%20Find%20the%20Derangement%20of%20An%20Array)|None| +|612|[Design Log Storage System](https://leetcode.com/problems/design-log-storage-system)|[C++](612.%20Design%20Log%20Storage%20System/solution.h) [Python](612.%20Design%20Log%20Storage%20System/solution.py)|[Note](612.%20Design%20Log%20Storage%20System)|None| +|613|[Exclusive Time of Functions](https://leetcode.com/problems/exclusive-time-of-functions)|[C++](613.%20Exclusive%20Time%20of%20Functions/solution.h) [Python](613.%20Exclusive%20Time%20of%20Functions/solution.py)|[Note](613.%20Exclusive%20Time%20of%20Functions)|Medium| +|614|[Average of Levels in Binary Tree](https://leetcode.com/problems/average-of-levels-in-binary-tree)|[C++](614.%20Average%20of%20Levels%20in%20Binary%20Tree/solution.h) [Python](614.%20Average%20of%20Levels%20in%20Binary%20Tree/solution.py)|[Note](614.%20Average%20of%20Levels%20in%20Binary%20Tree)|Easy| +|615|[Shopping Offers](https://leetcode.com/problems/shopping-offers)|[C++](615.%20Shopping%20Offers/solution.h) [Python](615.%20Shopping%20Offers/solution.py)|[Note](615.%20Shopping%20Offers)|Medium| +|616|[Decode Ways II](https://leetcode.com/problems/decode-ways-ii)|[C++](616.%20Decode%20Ways%20II/solution.h) [Python](616.%20Decode%20Ways%20II/solution.py)|[Note](616.%20Decode%20Ways%20II)|Hard| +|617|[Solve the Equation](https://leetcode.com/problems/solve-the-equation)|[C++](617.%20Solve%20the%20Equation/solution.h) [Python](617.%20Solve%20the%20Equation/solution.py)|[Note](617.%20Solve%20the%20Equation)|Medium| +|618|[Design Search Autocomplete System](https://leetcode.com/problems/design-search-autocomplete-system)|[C++](618.%20Design%20Search%20Autocomplete%20System/solution.h) [Python](618.%20Design%20Search%20Autocomplete%20System/solution.py)|[Note](618.%20Design%20Search%20Autocomplete%20System)|None| +|619|[Maximum Average Subarray I](https://leetcode.com/problems/maximum-average-subarray-i)|[C++](619.%20Maximum%20Average%20Subarray%20I/solution.h) [Python](619.%20Maximum%20Average%20Subarray%20I/solution.py)|[Note](619.%20Maximum%20Average%20Subarray%20I)|Easy| +|620|[Maximum Average Subarray II](https://leetcode.com/problems/maximum-average-subarray-ii)|[C++](620.%20Maximum%20Average%20Subarray%20II/solution.h) [Python](620.%20Maximum%20Average%20Subarray%20II/solution.py)|[Note](620.%20Maximum%20Average%20Subarray%20II)|None| +|621|[Set Mismatch](https://leetcode.com/problems/set-mismatch)|[C++](621.%20Set%20Mismatch/solution.h) [Python](621.%20Set%20Mismatch/solution.py)|[Note](621.%20Set%20Mismatch)|Easy| +|622|[Maximum Length of Pair Chain](https://leetcode.com/problems/maximum-length-of-pair-chain)|[C++](622.%20Maximum%20Length%20of%20Pair%20Chain/solution.h) [Python](622.%20Maximum%20Length%20of%20Pair%20Chain/solution.py)|[Note](622.%20Maximum%20Length%20of%20Pair%20Chain)|Medium| +|623|[Palindromic Substrings](https://leetcode.com/problems/palindromic-substrings)|[C++](623.%20Palindromic%20Substrings/solution.h) [Python](623.%20Palindromic%20Substrings/solution.py)|[Note](623.%20Palindromic%20Substrings)|Medium| +|624|[Replace Words](https://leetcode.com/problems/replace-words)|[C++](624.%20Replace%20Words/solution.h) [Python](624.%20Replace%20Words/solution.py)|[Note](624.%20Replace%20Words)|Medium| +|625|[Dota2 Senate](https://leetcode.com/problems/dota2-senate)|[C++](625.%20Dota2%20Senate/solution.h) [Python](625.%20Dota2%20Senate/solution.py)|[Note](625.%20Dota2%20Senate)|Medium| +|626|[2 Keys Keyboard](https://leetcode.com/problems/2-keys-keyboard)|[C++](626.%202%20Keys%20Keyboard/solution.h) [Python](626.%202%20Keys%20Keyboard/solution.py)|[Note](626.%202%20Keys%20Keyboard)|Medium| +|627|[4 Keys Keyboard](https://leetcode.com/problems/4-keys-keyboard)|[C++](627.%204%20Keys%20Keyboard/solution.h) [Python](627.%204%20Keys%20Keyboard/solution.py)|[Note](627.%204%20Keys%20Keyboard)|None| +|628|[Find Duplicate Subtrees](https://leetcode.com/problems/find-duplicate-subtrees)|[C++](628.%20Find%20Duplicate%20Subtrees/solution.h) [Python](628.%20Find%20Duplicate%20Subtrees/solution.py)|[Note](628.%20Find%20Duplicate%20Subtrees)|Medium| +|629|[Two Sum IV - Input is a BST](https://leetcode.com/problems/two-sum-iv-input-is-a-bst)|[C++](629.%20Two%20Sum%20IV%20-%20Input%20is%20a%20BST/solution.h) [Python](629.%20Two%20Sum%20IV%20-%20Input%20is%20a%20BST/solution.py)|[Note](629.%20Two%20Sum%20IV%20-%20Input%20is%20a%20BST)|Easy| +|630|[Maximum Binary Tree](https://leetcode.com/problems/maximum-binary-tree)|[C++](630.%20Maximum%20Binary%20Tree/solution.h) [Python](630.%20Maximum%20Binary%20Tree/solution.py)|[Note](630.%20Maximum%20Binary%20Tree)|Medium| +|631|[Print Binary Tree](https://leetcode.com/problems/print-binary-tree)|[C++](631.%20Print%20Binary%20Tree/solution.h) [Python](631.%20Print%20Binary%20Tree/solution.py)|[Note](631.%20Print%20Binary%20Tree)|Medium| +|632|[Coin Path](https://leetcode.com/problems/coin-path)|[C++](632.%20Coin%20Path/solution.h) [Python](632.%20Coin%20Path/solution.py)|[Note](632.%20Coin%20Path)|None| +|633|[Judge Route Circle](https://leetcode.com/problems/judge-route-circle)|[C++](633.%20Judge%20Route%20Circle/solution.h) [Python](633.%20Judge%20Route%20Circle/solution.py)|[Note](633.%20Judge%20Route%20Circle)|Easy| +|634|[Find K Closest Elements](https://leetcode.com/problems/find-k-closest-elements)|[C++](634.%20Find%20K%20Closest%20Elements/solution.h) [Python](634.%20Find%20K%20Closest%20Elements/solution.py)|[Note](634.%20Find%20K%20Closest%20Elements)|Medium| +|635|[Split Array into Consecutive Subsequences](https://leetcode.com/problems/split-array-into-consecutive-subsequences)|[C++](635.%20Split%20Array%20into%20Consecutive%20Subsequences/solution.h) [Python](635.%20Split%20Array%20into%20Consecutive%20Subsequences/solution.py)|[Note](635.%20Split%20Array%20into%20Consecutive%20Subsequences)|Medium| +|636|[Remove 9](https://leetcode.com/problems/remove-9)|[C++](636.%20Remove%209/solution.h) [Python](636.%20Remove%209/solution.py)|[Note](636.%20Remove%209)|None| +|637|[Image Smoother](https://leetcode.com/problems/image-smoother)|[C++](637.%20Image%20Smoother/solution.h) [Python](637.%20Image%20Smoother/solution.py)|[Note](637.%20Image%20Smoother)|Easy| +|638|[Maximum Width of Binary Tree](https://leetcode.com/problems/maximum-width-of-binary-tree)|[C++](638.%20Maximum%20Width%20of%20Binary%20Tree/solution.h) [Python](638.%20Maximum%20Width%20of%20Binary%20Tree/solution.py)|[Note](638.%20Maximum%20Width%20of%20Binary%20Tree)|Medium| +|639|[Equal Tree Partition](https://leetcode.com/problems/equal-tree-partition)|[C++](639.%20Equal%20Tree%20Partition/solution.h) [Python](639.%20Equal%20Tree%20Partition/solution.py)|[Note](639.%20Equal%20Tree%20Partition)|None| +|640|[Strange Printer](https://leetcode.com/problems/strange-printer)|[C++](640.%20Strange%20Printer/solution.h) [Python](640.%20Strange%20Printer/solution.py)|[Note](640.%20Strange%20Printer)|Hard| +|641|[Non-decreasing Array](https://leetcode.com/problems/non-decreasing-array)|[C++](641.%20Non-decreasing%20Array/solution.h) [Python](641.%20Non-decreasing%20Array/solution.py)|[Note](641.%20Non-decreasing%20Array)|Easy| +|642|[Path Sum IV](https://leetcode.com/problems/path-sum-iv)|[C++](642.%20Path%20Sum%20IV/solution.h) [Python](642.%20Path%20Sum%20IV/solution.py)|[Note](642.%20Path%20Sum%20IV)|None| +|643|[Beautiful Arrangement II](https://leetcode.com/problems/beautiful-arrangement-ii)|[C++](643.%20Beautiful%20Arrangement%20II/solution.h) [Python](643.%20Beautiful%20Arrangement%20II/solution.py)|[Note](643.%20Beautiful%20Arrangement%20II)|Medium| +|644|[Kth Smallest Number in Multiplication Table](https://leetcode.com/problems/kth-smallest-number-in-multiplication-table)|[C++](644.%20Kth%20Smallest%20Number%20in%20Multiplication%20Table/solution.h) [Python](644.%20Kth%20Smallest%20Number%20in%20Multiplication%20Table/solution.py)|[Note](644.%20Kth%20Smallest%20Number%20in%20Multiplication%20Table)|Hard| +|645|[Trim a Binary Search Tree](https://leetcode.com/problems/trim-a-binary-search-tree)|[C++](645.%20Trim%20a%20Binary%20Search%20Tree/solution.h) [Python](645.%20Trim%20a%20Binary%20Search%20Tree/solution.py)|[Note](645.%20Trim%20a%20Binary%20Search%20Tree)|Easy| +|646|[Maximum Swap](https://leetcode.com/problems/maximum-swap)|[C++](646.%20Maximum%20Swap/solution.h) [Python](646.%20Maximum%20Swap/solution.py)|[Note](646.%20Maximum%20Swap)|Medium| +|647|[Second Minimum Node In a Binary Tree](https://leetcode.com/problems/second-minimum-node-in-a-binary-tree)|[C++](647.%20Second%20Minimum%20Node%20In%20a%20Binary%20Tree/solution.h) [Python](647.%20Second%20Minimum%20Node%20In%20a%20Binary%20Tree/solution.py)|[Note](647.%20Second%20Minimum%20Node%20In%20a%20Binary%20Tree)|Easy| +|648|[Bulb Switcher II](https://leetcode.com/problems/bulb-switcher-ii)|[C++](648.%20Bulb%20Switcher%20II/solution.h) [Python](648.%20Bulb%20Switcher%20II/solution.py)|[Note](648.%20Bulb%20Switcher%20II)|Medium| +|649|[Number of Longest Increasing Subsequence](https://leetcode.com/problems/number-of-longest-increasing-subsequence)|[C++](649.%20Number%20of%20Longest%20Increasing%20Subsequence/solution.h) [Python](649.%20Number%20of%20Longest%20Increasing%20Subsequence/solution.py)|[Note](649.%20Number%20of%20Longest%20Increasing%20Subsequence)|Medium| +|650|[Longest Continuous Increasing Subsequence](https://leetcode.com/problems/longest-continuous-increasing-subsequence)|[C++](650.%20Longest%20Continuous%20Increasing%20Subsequence/solution.h) [Python](650.%20Longest%20Continuous%20Increasing%20Subsequence/solution.py)|[Note](650.%20Longest%20Continuous%20Increasing%20Subsequence)|Easy| +|651|[Cut Off Trees for Golf Event](https://leetcode.com/problems/cut-off-trees-for-golf-event)|[C++](651.%20Cut%20Off%20Trees%20for%20Golf%20Event/solution.h) [Python](651.%20Cut%20Off%20Trees%20for%20Golf%20Event/solution.py)|[Note](651.%20Cut%20Off%20Trees%20for%20Golf%20Event)|Hard| +|652|[Implement Magic Dictionary](https://leetcode.com/problems/implement-magic-dictionary)|[C++](652.%20Implement%20Magic%20Dictionary/solution.h) [Python](652.%20Implement%20Magic%20Dictionary/solution.py)|[Note](652.%20Implement%20Magic%20Dictionary)|Medium| +|653|[Map Sum Pairs](https://leetcode.com/problems/map-sum-pairs)|[C++](653.%20Map%20Sum%20Pairs/solution.h) [Python](653.%20Map%20Sum%20Pairs/solution.py)|[Note](653.%20Map%20Sum%20Pairs)|Medium| +|654|[Valid Parenthesis String](https://leetcode.com/problems/valid-parenthesis-string)|[C++](654.%20Valid%20Parenthesis%20String/solution.h) [Python](654.%20Valid%20Parenthesis%20String/solution.py)|[Note](654.%20Valid%20Parenthesis%20String)|Medium| +|655|[24 Game](https://leetcode.com/problems/24-game)|[C++](655.%2024%20Game/solution.h) [Python](655.%2024%20Game/solution.py)|[Note](655.%2024%20Game)|Hard| +|656|[Valid Palindrome II](https://leetcode.com/problems/valid-palindrome-ii)|[C++](656.%20Valid%20Palindrome%20II/solution.h) [Python](656.%20Valid%20Palindrome%20II/solution.py)|[Note](656.%20Valid%20Palindrome%20II)|Easy| +|657|[Next Closest Time](https://leetcode.com/problems/next-closest-time)|[C++](657.%20Next%20Closest%20Time/solution.h) [Python](657.%20Next%20Closest%20Time/solution.py)|[Note](657.%20Next%20Closest%20Time)|None| +|658|[Baseball Game](https://leetcode.com/problems/baseball-game)|[C++](658.%20Baseball%20Game/solution.h) [Python](658.%20Baseball%20Game/solution.py)|[Note](658.%20Baseball%20Game)|Easy| +|659|[K Empty Slots](https://leetcode.com/problems/k-empty-slots)|[C++](659.%20K%20Empty%20Slots/solution.h) [Python](659.%20K%20Empty%20Slots/solution.py)|[Note](659.%20K%20Empty%20Slots)|None| +|660|[Redundant Connection](https://leetcode.com/problems/redundant-connection)|[C++](660.%20Redundant%20Connection/solution.h) [Python](660.%20Redundant%20Connection/solution.py)|[Note](660.%20Redundant%20Connection)|Medium| +|661|[Redundant Connection II](https://leetcode.com/problems/redundant-connection-ii)|[C++](661.%20Redundant%20Connection%20II/solution.h) [Python](661.%20Redundant%20Connection%20II/solution.py)|[Note](661.%20Redundant%20Connection%20II)|Hard| +|662|[Repeated String Match](https://leetcode.com/problems/repeated-string-match)|[C++](662.%20Repeated%20String%20Match/solution.h) [Python](662.%20Repeated%20String%20Match/solution.py)|[Note](662.%20Repeated%20String%20Match)|Easy| +|663|[Longest Univalue Path](https://leetcode.com/problems/longest-univalue-path)|[C++](663.%20Longest%20Univalue%20Path/solution.h) [Python](663.%20Longest%20Univalue%20Path/solution.py)|[Note](663.%20Longest%20Univalue%20Path)|Easy| +|664|[Knight Probability in Chessboard](https://leetcode.com/problems/knight-probability-in-chessboard)|[C++](664.%20Knight%20Probability%20in%20Chessboard/solution.h) [Python](664.%20Knight%20Probability%20in%20Chessboard/solution.py)|[Note](664.%20Knight%20Probability%20in%20Chessboard)|Medium| +|665|[Maximum Sum of 3 Non-Overlapping Subarrays](https://leetcode.com/problems/maximum-sum-of-3-non-overlapping-subarrays)|[C++](665.%20Maximum%20Sum%20of%203%20Non-Overlapping%20Subarrays/solution.h) [Python](665.%20Maximum%20Sum%20of%203%20Non-Overlapping%20Subarrays/solution.py)|[Note](665.%20Maximum%20Sum%20of%203%20Non-Overlapping%20Subarrays)|Hard| +|666|[Employee Importance](https://leetcode.com/problems/employee-importance)|[C++](666.%20Employee%20Importance/solution.h) [Python](666.%20Employee%20Importance/solution.py)|[Note](666.%20Employee%20Importance)|Easy| +|667|[Stickers to Spell Word](https://leetcode.com/problems/stickers-to-spell-word)|[C++](667.%20Stickers%20to%20Spell%20Word/solution.h) [Python](667.%20Stickers%20to%20Spell%20Word/solution.py)|[Note](667.%20Stickers%20to%20Spell%20Word)|Hard| +|668|[Top K Frequent Words](https://leetcode.com/problems/top-k-frequent-words)|[C++](668.%20Top%20K%20Frequent%20Words/solution.h) [Python](668.%20Top%20K%20Frequent%20Words/solution.py)|[Note](668.%20Top%20K%20Frequent%20Words)|Medium| +|669|[Binary Number with Alternating Bits](https://leetcode.com/problems/binary-number-with-alternating-bits)|[C++](669.%20Binary%20Number%20with%20Alternating%20Bits/solution.h) [Python](669.%20Binary%20Number%20with%20Alternating%20Bits/solution.py)|[Note](669.%20Binary%20Number%20with%20Alternating%20Bits)|Easy| +|670|[Number of Distinct Islands](https://leetcode.com/problems/number-of-distinct-islands)|[C++](670.%20Number%20of%20Distinct%20Islands/solution.h) [Python](670.%20Number%20of%20Distinct%20Islands/solution.py)|[Note](670.%20Number%20of%20Distinct%20Islands)|None| +|671|[Max Area of Island](https://leetcode.com/problems/max-area-of-island)|[C++](671.%20Max%20Area%20of%20Island/solution.h) [Python](671.%20Max%20Area%20of%20Island/solution.py)|[Note](671.%20Max%20Area%20of%20Island)|Easy| +|672|[Count Binary Substrings](https://leetcode.com/problems/count-binary-substrings)|[C++](672.%20Count%20Binary%20Substrings/solution.h) [Python](672.%20Count%20Binary%20Substrings/solution.py)|[Note](672.%20Count%20Binary%20Substrings)|Easy| +|673|[Degree of an Array](https://leetcode.com/problems/degree-of-an-array)|[C++](673.%20Degree%20of%20an%20Array/solution.h) [Python](673.%20Degree%20of%20an%20Array/solution.py)|[Note](673.%20Degree%20of%20an%20Array)|Easy| +|674|[Partition to K Equal Sum Subsets](https://leetcode.com/problems/partition-to-k-equal-sum-subsets)|[C++](674.%20Partition%20to%20K%20Equal%20Sum%20Subsets/solution.h) [Python](674.%20Partition%20to%20K%20Equal%20Sum%20Subsets/solution.py)|[Note](674.%20Partition%20to%20K%20Equal%20Sum%20Subsets)|Medium| +|675|[Falling Squares](https://leetcode.com/problems/falling-squares)|[C++](675.%20Falling%20Squares/solution.h) [Python](675.%20Falling%20Squares/solution.py)|[Note](675.%20Falling%20Squares)|Hard| +|676|[Number of Distinct Islands II](https://leetcode.com/problems/number-of-distinct-islands-ii)|[C++](676.%20Number%20of%20Distinct%20Islands%20II/solution.h) [Python](676.%20Number%20of%20Distinct%20Islands%20II/solution.py)|[Note](676.%20Number%20of%20Distinct%20Islands%20II)|None| +|677|[Minimum ASCII Delete Sum for Two Strings](https://leetcode.com/problems/minimum-ascii-delete-sum-for-two-strings)|[C++](677.%20Minimum%20ASCII%20Delete%20Sum%20for%20Two%20Strings/solution.h) [Python](677.%20Minimum%20ASCII%20Delete%20Sum%20for%20Two%20Strings/solution.py)|[Note](677.%20Minimum%20ASCII%20Delete%20Sum%20for%20Two%20Strings)|Medium| +|678|[Subarray Product Less Than K](https://leetcode.com/problems/subarray-product-less-than-k)|[C++](678.%20Subarray%20Product%20Less%20Than%20K/solution.h) [Python](678.%20Subarray%20Product%20Less%20Than%20K/solution.py)|[Note](678.%20Subarray%20Product%20Less%20Than%20K)|Medium| +|679|[Best Time to Buy and Sell Stock with Transaction Fee](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee)|[C++](679.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock%20with%20Transaction%20Fee/solution.h) [Python](679.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock%20with%20Transaction%20Fee/solution.py)|[Note](679.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock%20with%20Transaction%20Fee)|Medium| +|680|[Range Module](https://leetcode.com/problems/range-module)|[C++](680.%20Range%20Module/solution.h) [Python](680.%20Range%20Module/solution.py)|[Note](680.%20Range%20Module)|Hard| +|681|[Max Stack](https://leetcode.com/problems/max-stack)|[C++](681.%20Max%20Stack/solution.h) [Python](681.%20Max%20Stack/solution.py)|[Note](681.%20Max%20Stack)|None| +|682|[1-bit and 2-bit Characters](https://leetcode.com/problems/1-bit-and-2-bit-characters)|[C++](682.%201-bit%20and%202-bit%20Characters/solution.h) [Python](682.%201-bit%20and%202-bit%20Characters/solution.py)|[Note](682.%201-bit%20and%202-bit%20Characters)|Easy| +|683|[Maximum Length of Repeated Subarray](https://leetcode.com/problems/maximum-length-of-repeated-subarray)|[C++](683.%20Maximum%20Length%20of%20Repeated%20Subarray/solution.h) [Python](683.%20Maximum%20Length%20of%20Repeated%20Subarray/solution.py)|[Note](683.%20Maximum%20Length%20of%20Repeated%20Subarray)|Medium| +|684|[Find K-th Smallest Pair Distance](https://leetcode.com/problems/find-k-th-smallest-pair-distance)|[C++](684.%20Find%20K-th%20Smallest%20Pair%20Distance/solution.h) [Python](684.%20Find%20K-th%20Smallest%20Pair%20Distance/solution.py)|[Note](684.%20Find%20K-th%20Smallest%20Pair%20Distance)|Hard| +|685|[Longest Word in Dictionary](https://leetcode.com/problems/longest-word-in-dictionary)|[C++](685.%20Longest%20Word%20in%20Dictionary/solution.h) [Python](685.%20Longest%20Word%20in%20Dictionary/solution.py)|[Note](685.%20Longest%20Word%20in%20Dictionary)|Easy| +|686|[Accounts Merge](https://leetcode.com/problems/accounts-merge)|[C++](686.%20Accounts%20Merge/solution.h) [Python](686.%20Accounts%20Merge/solution.py)|[Note](686.%20Accounts%20Merge)|Medium| +|687|[Remove Comments](https://leetcode.com/problems/remove-comments)|[C++](687.%20Remove%20Comments/solution.h) [Python](687.%20Remove%20Comments/solution.py)|[Note](687.%20Remove%20Comments)|Medium| +|688|[Candy Crush](https://leetcode.com/problems/candy-crush)|[C++](688.%20Candy%20Crush/solution.h) [Python](688.%20Candy%20Crush/solution.py)|[Note](688.%20Candy%20Crush)|None| +|689|[Find Pivot Index](https://leetcode.com/problems/find-pivot-index)|[C++](689.%20Find%20Pivot%20Index/solution.h) [Python](689.%20Find%20Pivot%20Index/solution.py)|[Note](689.%20Find%20Pivot%20Index)|Easy| +|690|[Split Linked List in Parts](https://leetcode.com/problems/split-linked-list-in-parts)|[C++](690.%20Split%20Linked%20List%20in%20Parts/solution.h) [Python](690.%20Split%20Linked%20List%20in%20Parts/solution.py)|[Note](690.%20Split%20Linked%20List%20in%20Parts)|Medium| +|691|[Number of Atoms](https://leetcode.com/problems/number-of-atoms)|[C++](691.%20Number%20of%20Atoms/solution.h) [Python](691.%20Number%20of%20Atoms/solution.py)|[Note](691.%20Number%20of%20Atoms)|Hard| +|692|[Minimum Window Subsequence](https://leetcode.com/problems/minimum-window-subsequence)|[C++](692.%20Minimum%20Window%20Subsequence/solution.h) [Python](692.%20Minimum%20Window%20Subsequence/solution.py)|[Note](692.%20Minimum%20Window%20Subsequence)|None| +|693|[Self Dividing Numbers](https://leetcode.com/problems/self-dividing-numbers)|[C++](693.%20Self%20Dividing%20Numbers/solution.h) [Python](693.%20Self%20Dividing%20Numbers/solution.py)|[Note](693.%20Self%20Dividing%20Numbers)|Easy| +|694|[My Calendar I](https://leetcode.com/problems/my-calendar-i)|[C++](694.%20My%20Calendar%20I/solution.h) [Python](694.%20My%20Calendar%20I/solution.py)|[Note](694.%20My%20Calendar%20I)|Medium| +|695|[Count Different Palindromic Subsequences](https://leetcode.com/problems/count-different-palindromic-subsequences)|[C++](695.%20Count%20Different%20Palindromic%20Subsequences/solution.h) [Python](695.%20Count%20Different%20Palindromic%20Subsequences/solution.py)|[Note](695.%20Count%20Different%20Palindromic%20Subsequences)|Hard| +|696|[My Calendar II](https://leetcode.com/problems/my-calendar-ii)|[C++](696.%20My%20Calendar%20II/solution.h) [Python](696.%20My%20Calendar%20II/solution.py)|[Note](696.%20My%20Calendar%20II)|Medium| +|697|[My Calendar III](https://leetcode.com/problems/my-calendar-iii)|[C++](697.%20My%20Calendar%20III/solution.h) [Python](697.%20My%20Calendar%20III/solution.py)|[Note](697.%20My%20Calendar%20III)|Hard| +|698|[Flood Fill](https://leetcode.com/problems/flood-fill)|[C++](698.%20Flood%20Fill/solution.h) [Python](698.%20Flood%20Fill/solution.py)|[Note](698.%20Flood%20Fill)|Easy| +|699|[Sentence Similarity](https://leetcode.com/problems/sentence-similarity)|[C++](699.%20Sentence%20Similarity/solution.h) [Python](699.%20Sentence%20Similarity/solution.py)|[Note](699.%20Sentence%20Similarity)|Easy| +|700|[Asteroid Collision](https://leetcode.com/problems/asteroid-collision)|[C++](700.%20Asteroid%20Collision/solution.h) [Python](700.%20Asteroid%20Collision/solution.py)|[Note](700.%20Asteroid%20Collision)|Medium| +|701|[Parse Lisp Expression](https://leetcode.com/problems/parse-lisp-expression)|[C++](701.%20Parse%20Lisp%20Expression/solution.h) [Python](701.%20Parse%20Lisp%20Expression/solution.py)|[Note](701.%20Parse%20Lisp%20Expression)|Hard| +|702|[Sentence Similarity II](https://leetcode.com/problems/sentence-similarity-ii)|[C++](702.%20Sentence%20Similarity%20II/solution.h) [Python](702.%20Sentence%20Similarity%20II/solution.py)|[Note](702.%20Sentence%20Similarity%20II)|Medium| +|703|[Monotone Increasing Digits](https://leetcode.com/problems/monotone-increasing-digits)|[C++](703.%20Monotone%20Increasing%20Digits/solution.h) [Python](703.%20Monotone%20Increasing%20Digits/solution.py)|[Note](703.%20Monotone%20Increasing%20Digits)|Medium| +|704|[Daily Temperatures](https://leetcode.com/problems/daily-temperatures)|[C++](704.%20Daily%20Temperatures/solution.h) [Python](704.%20Daily%20Temperatures/solution.py)|[Note](704.%20Daily%20Temperatures)|Medium| +|705|[Delete and Earn](https://leetcode.com/problems/delete-and-earn)|[C++](705.%20Delete%20and%20Earn/solution.h) [Python](705.%20Delete%20and%20Earn/solution.py)|[Note](705.%20Delete%20and%20Earn)|Medium| +|706|[Cherry Pickup](https://leetcode.com/problems/cherry-pickup)|[C++](706.%20Cherry%20Pickup/solution.h) [Python](706.%20Cherry%20Pickup/solution.py)|[Note](706.%20Cherry%20Pickup)|Hard| +|707|[Closest Leaf in a Binary Tree](https://leetcode.com/problems/closest-leaf-in-a-binary-tree)|[C++](707.%20Closest%20Leaf%20in%20a%20Binary%20Tree/solution.h) [Python](707.%20Closest%20Leaf%20in%20a%20Binary%20Tree/solution.py)|[Note](707.%20Closest%20Leaf%20in%20a%20Binary%20Tree)|New| +|708|[Network Delay Time](https://leetcode.com/problems/network-delay-time)|[C++](708.%20Network%20Delay%20Time/solution.h) [Python](708.%20Network%20Delay%20Time/solution.py)|[Note](708.%20Network%20Delay%20Time)|New| +|709|[Find Smallest Letter Greater Than Target](https://leetcode.com/problems/find-smallest-letter-greater-than-target)|[C++](709.%20Find%20Smallest%20Letter%20Greater%20Than%20Target/solution.h) [Python](709.%20Find%20Smallest%20Letter%20Greater%20Than%20Target/solution.py)|[Note](709.%20Find%20Smallest%20Letter%20Greater%20Than%20Target)|New| +|710|[Prefix and Suffix Search](https://leetcode.com/problems/prefix-and-suffix-search)|[C++](710.%20Prefix%20and%20Suffix%20Search/solution.h) [Python](710.%20Prefix%20and%20Suffix%20Search/solution.py)|[Note](710.%20Prefix%20and%20Suffix%20Search)|New| - -[1]:https://oj.leetcode.com/problems/single-number/ -[2]:https://oj.leetcode.com/problems/maximum-depth-of-binary-tree/ -[3]:https://oj.leetcode.com/problems/same-tree/ -[4]:https://oj.leetcode.com/problems/reverse-integer/ -[5]:https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/ -[6]:https://oj.leetcode.com/problems/unique-binary-search-trees/ -[7]:https://oj.leetcode.com/problems/linked-list-cycle/ -[8]:https://oj.leetcode.com/problems/binary-tree-inorder-traversal/ -[9]:https://oj.leetcode.com/problems/binary-tree-preorder-traversal/ -[10]:https://oj.leetcode.com/problems/populating-next-right-pointers-in-each-node/ -[11]:https://oj.leetcode.com/problems/search-insert-position/ -[12]:https://oj.leetcode.com/problems/remove-duplicates-from-sorted-list/ -[13]:https://oj.leetcode.com/problems/climbing-stairs/ -[14]:https://oj.leetcode.com/problems/maximum-subarray/ -[15]:https://oj.leetcode.com/problems/n-queens-ii/ -[16]:https://oj.leetcode.com/problems/roman-to-integer/ -[17]:https://oj.leetcode.com/problems/integer-to-roman/ -[18]:https://oj.leetcode.com/problems/single-number-ii/ -[19]:https://oj.leetcode.com/problems/merge-two-sorted-lists/ -[20]:https://oj.leetcode.com/problems/remove-element/ -[21]:https://oj.leetcode.com/problems/convert-sorted-array-to-binary-search-tree/ -[22]:https://oj.leetcode.com/problems/balanced-binary-tree/ -[23]:https://oj.leetcode.com/problems/swap-nodes-in-pairs/ -[24]:https://oj.leetcode.com/problems/remove-duplicates-from-sorted-array/ -[25]:https://oj.leetcode.com/problems/sort-colors/ -[26]:https://oj.leetcode.com/problems/merge-sorted-array/ -[27]:https://oj.leetcode.com/problems/symmetric-tree/ -[28]:https://oj.leetcode.com/problems/gray-code/ -[29]:https://oj.leetcode.com/problems/unique-paths/ -[30]:https://oj.leetcode.com/problems/plus-one/ -[31]:https://oj.leetcode.com/problems/generate-parentheses/ -[32]:https://oj.leetcode.com/problems/pascals-triangle/ -[33]:https://oj.leetcode.com/problems/container-with-most-water/ -[34]:https://oj.leetcode.com/problems/permutations/ -[35]:https://oj.leetcode.com/problems/rotate-image/ -[36]:https://oj.leetcode.com/problems/search-a-2d-matrix/ -[37]:https://oj.leetcode.com/problems/find-minimum-in-rotated-sorted-array/ -[38]:https://oj.leetcode.com/problems/minimum-path-sum/ -[39]:https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock/ -[40]:https://oj.leetcode.com/problems/binary-tree-level-order-traversal-ii/ -[41]:https://oj.leetcode.com/problems/search-in-rotated-sorted-array-ii/ -[42]:https://oj.leetcode.com/problems/binary-tree-postorder-traversal/ -[43]:https://oj.leetcode.com/problems/linked-list-cycle-ii/ -[44]:https://oj.leetcode.com/problems/set-matrix-zeroes/ -[45]:https://oj.leetcode.com/problems/spiral-matrix-ii/ -[46]:https://oj.leetcode.com/problems/remove-duplicates-from-sorted-array-ii/ -[47]:https://oj.leetcode.com/problems/populating-next-right-pointers-in-each-node-ii/ -[48]:https://oj.leetcode.com/problems/binary-tree-level-order-traversal/ -[49]:https://oj.leetcode.com/problems/path-sum/ -[50]:https://oj.leetcode.com/problems/pascals-triangle-ii/ -[51]:https://oj.leetcode.com/problems/combinations/ -[52]:https://oj.leetcode.com/problems/sum-root-to-leaf-numbers/ -[53]:https://oj.leetcode.com/problems/remove-nth-node-from-end-of-list/ -[54]:https://oj.leetcode.com/problems/minimum-depth-of-binary-tree/ -[55]:https://oj.leetcode.com/problems/length-of-last-word/ -[56]:https://oj.leetcode.com/problems/trapping-rain-water/ -[57]:https://oj.leetcode.com/problems/palindrome-number/ -[58]:https://oj.leetcode.com/problems/search-in-rotated-sorted-array/ -[59]:https://oj.leetcode.com/problems/valid-parentheses/ -[60]:https://oj.leetcode.com/problems/flatten-binary-tree-to-linked-list/ -[61]:https://oj.leetcode.com/problems/longest-consecutive-sequence/ -[62]:https://oj.leetcode.com/problems/unique-paths-ii/ -[63]:https://oj.leetcode.com/problems/subsets/ -[64]:https://oj.leetcode.com/problems/valid-sudoku/ -[65]:https://oj.leetcode.com/problems/unique-binary-search-trees-ii/ -[66]:https://oj.leetcode.com/problems/convert-sorted-list-to-binary-search-tree/ -[67]:https://oj.leetcode.com/problems/search-for-a-range/ -[68]:https://oj.leetcode.com/problems/jump-game/ -[69]:https://oj.leetcode.com/problems/count-and-say/ -[70]:https://oj.leetcode.com/problems/longest-common-prefix/ -[71]:https://oj.leetcode.com/problems/subsets-ii/ -[72]:https://oj.leetcode.com/problems/partition-list/ -[73]:https://oj.leetcode.com/problems/3sum-closest/ -[74]:https://oj.leetcode.com/problems/path-sum-ii/ -[75]:https://oj.leetcode.com/problems/combination-sum/ -[76]:https://oj.leetcode.com/problems/triangle/ -[77]:https://oj.leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/ -[78]:https://oj.leetcode.com/problems/binary-tree-zigzag-level-order-traversal/ -[79]:https://oj.leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/ -[80]:https://oj.leetcode.com/problems/letter-combinations-of-a-phone-number/ -[81]:https://oj.leetcode.com/problems/reverse-linked-list-ii/ -[82]:https://oj.leetcode.com/problems/powx-n/ -[83]:https://oj.leetcode.com/problems/n-queens/ -[84]:https://oj.leetcode.com/problems/gas-station/ -[85]:https://oj.leetcode.com/problems/palindrome-partitioning/ -[86]:https://oj.leetcode.com/problems/validate-binary-search-tree/ -[87]:https://oj.leetcode.com/problems/add-binary/ -[88]:https://oj.leetcode.com/problems/edit-distance/ -[89]:https://oj.leetcode.com/problems/next-permutation/ -[90]:https://oj.leetcode.com/problems/insertion-sort-list/ -[91]:https://oj.leetcode.com/problems/reverse-nodes-in-k-group/ -[92]:https://oj.leetcode.com/problems/distinct-subsequences/ -[93]:https://oj.leetcode.com/problems/permutations-ii/ -[94]:https://oj.leetcode.com/problems/remove-duplicates-from-sorted-list-ii/ -[95]:https://oj.leetcode.com/problems/jump-game-ii/ -[96]:https://oj.leetcode.com/problems/combination-sum-ii/ -[97]:https://oj.leetcode.com/problems/anagrams/ -[98]:https://oj.leetcode.com/problems/recover-binary-search-tree/ -[99]:https://oj.leetcode.com/problems/zigzag-conversion/ -[100]:https://oj.leetcode.com/problems/copy-list-with-random-pointer/ -[101]:https://oj.leetcode.com/problems/clone-graph/ -[102]:https://oj.leetcode.com/problems/add-two-numbers/ -[103]:https://oj.leetcode.com/problems/scramble-string/ -[104]:https://oj.leetcode.com/problems/valid-palindrome/ -[105]:https://oj.leetcode.com/problems/first-missing-positive/ -[106]:https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock-iii/ -[107]:https://oj.leetcode.com/problems/sqrtx/ -[108]:https://oj.leetcode.com/problems/permutation-sequence/ -[109]:https://oj.leetcode.com/problems/longest-substring-without-repeating-characters/ -[110]:https://oj.leetcode.com/problems/rotate-list/ -[111]:https://oj.leetcode.com/problems/implement-strstr/ -[112]:https://oj.leetcode.com/problems/4sum/ -[113]:https://oj.leetcode.com/problems/maximal-rectangle/ -[114]:https://oj.leetcode.com/problems/largest-rectangle-in-histogram/ -[115]:https://oj.leetcode.com/problems/merge-k-sorted-lists/ -[116]:https://oj.leetcode.com/problems/word-break/ -[117]:https://oj.leetcode.com/problems/merge-intervals/ -[118]:https://oj.leetcode.com/problems/sudoku-solver/ -[119]:https://oj.leetcode.com/problems/longest-palindromic-substring/ -[120]:https://oj.leetcode.com/problems/insert-interval/ -[121]:https://oj.leetcode.com/problems/spiral-matrix/ -[122]:https://oj.leetcode.com/problems/sort-list/ -[123]:https://oj.leetcode.com/problems/restore-ip-addresses/ -[124]:https://oj.leetcode.com/problems/multiply-strings/ -[125]:https://oj.leetcode.com/problems/reorder-list/ -[126]:https://oj.leetcode.com/problems/binary-tree-maximum-path-sum/ -[127]:https://oj.leetcode.com/problems/regular-expression-matching/ -[128]:https://oj.leetcode.com/problems/simplify-path/ -[129]:https://oj.leetcode.com/problems/word-search/ -[130]:https://oj.leetcode.com/problems/evaluate-reverse-polish-notation/ -[131]:https://oj.leetcode.com/problems/longest-valid-parentheses/ -[132]:https://oj.leetcode.com/problems/interleaving-string/ -[133]:https://oj.leetcode.com/problems/candy/ -[134]:https://oj.leetcode.com/problems/word-ladder/ -[135]:https://oj.leetcode.com/problems/two-sum/ -[136]:https://oj.leetcode.com/problems/palindrome-partitioning-ii/ -[137]:https://oj.leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/ -[138]:https://oj.leetcode.com/problems/minimum-window-substring/ -[139]:https://oj.leetcode.com/problems/substring-with-concatenation-of-all-words/ -[140]:https://oj.leetcode.com/problems/median-of-two-sorted-arrays/ -[141]:https://oj.leetcode.com/problems/3sum/ -[142]:https://oj.leetcode.com/problems/divide-two-integers/ -[143]:https://oj.leetcode.com/problems/word-break-ii/ -[144]:https://oj.leetcode.com/problems/decode-ways/ -[145]:https://oj.leetcode.com/problems/maximum-product-subarray/ -[146]:https://oj.leetcode.com/problems/string-to-integer-atoi/ -[147]:https://oj.leetcode.com/problems/surrounded-regions/ -[148]:https://oj.leetcode.com/problems/wildcard-matching/ -[149]:https://oj.leetcode.com/problems/lru-cache/ -[150]:https://oj.leetcode.com/problems/reverse-words-in-a-string/ -[151]:https://oj.leetcode.com/problems/text-justification/ -[152]:https://oj.leetcode.com/problems/word-ladder-ii/ -[153]:https://oj.leetcode.com/problems/valid-number/ -[154]:https://oj.leetcode.com/problems/max-points-on-a-line/