diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..732f944b --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +custom: ["https://paypal.me/foreverbonfy", "https://raw.githubusercontent.com/bonfy/image/master/global/sponsor.jpg"] diff --git a/.gitignore b/.gitignore index e34956bb..319b28f5 100644 --- a/.gitignore +++ b/.gitignore @@ -107,3 +107,6 @@ log/ .vscode/ *.out .envrc + +# Do not push sensitive files +config.cfg \ No newline at end of file diff --git a/001-two-sum/two-sum.js b/001-two-sum/two-sum.js deleted file mode 100644 index ae714d24..00000000 --- a/001-two-sum/two-sum.js +++ /dev/null @@ -1,31 +0,0 @@ -// Given an array of integers, return indices of the two numbers such that they add up to a specific target. -// -// You may assume that each input would have exactly one solution, and you may not use the same element twice. -// -// Example: -// -// -// Given nums = [2, 7, 11, 15], target = 9, -// -// Because nums[0] + nums[1] = 2 + 7 = 9, -// return [0, 1]. -// -// -//   -// - - -/** - * @param {number[]} nums - * @param {number} target - * @return {number[]} - */ -var twoSum = function(nums, target) { - for(var i=0;i a - b); - let result = []; - - for (let i = 0; i < nums.length - 2; i++) { - if (i > 0 && nums[i] === nums[i-1]) continue; // skip the same result - - let j = i + 1; - let k = nums.length - 1; - let target = -nums[i]; - - while (j < k) { - if (nums[j] + nums[k] === target) { - result.push([nums[i], nums[j], nums[k]]); - - j++; k--; - while(j < k && nums[j] === nums[j - 1]) j++; // skip the same result - while(j < k && nums[k] === nums[k + 1]) k--; // skip the same result - } else if (nums[j] + nums[k] > target) { - k--; - } else { - j++; - } - } - } - return result; -}; diff --git a/071-simplify-path/simplify-path.py b/071-simplify-path/simplify-path.py deleted file mode 100644 index 394d5319..00000000 --- a/071-simplify-path/simplify-path.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding:utf-8 -*- - - -# Given an absolute path for a file (Unix-style), simplify it. -# -# For example, -# path = "/home/", => "/home" -# path = "/a/./b/../../c/", => "/c" -# -# click to show corner cases. -# -# Corner Cases: -# -#   -# -#   -# -# -# Did you consider the case where path = "/../"? -# In this case, you should return "/". -# Another corner case is the path might contain multiple slashes '/' together, such as "/home//foo/". -# In this case, you should ignore redundant slashes and return "/home/foo". -# -# - - -class Solution(object): - def simplifyPath(self, path): - """ - :type path: str - :rtype: str - """ - # 思路: - # 1. split / 形成List - # 2. 如果 .. 就 pop 前面的 - # 3. 还要考虑 '///' '/...' - places = [p for p in path.split("/") if p!="." and p!=""] - stack = [] - for p in places: - if p == "..": - if len(stack) > 0: - stack.pop() - else: - stack.append(p) - return "/" + "/".join(stack) diff --git a/134-gas-station/gas-station.py b/134-gas-station/gas-station.py deleted file mode 100644 index 3b2f61c2..00000000 --- a/134-gas-station/gas-station.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding:utf-8 -*- - - -# -# There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. -# -# -# -# You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to its next station (i+1). You begin the journey with an empty tank at one of the gas stations. -# -# -# -# Return the starting gas station's index if you can travel around the circuit once, otherwise return -1. -# -# -# -# Note: -# The solution is guaranteed to be unique. -# - - -class Solution(object): - def canCompleteCircuit(self, gas, cost): - """ - :type gas: List[int] - :type cost: List[int] - :rtype: int - """ - if len(gas) == 0 or len(cost) == 0 or sum(gas) < sum(cost): - return -1 - position = 0 - balance = 0 # current tank balance - for i in range(len(gas)): - balance += gas[i] - cost[i] # update balance - if balance < 0: # balance drops to negative, reset the start position - balance = 0 - position = i+1 - return position diff --git a/189-rotate-array/rotate-array.py b/189-rotate-array/rotate-array.py deleted file mode 100644 index ba8b8518..00000000 --- a/189-rotate-array/rotate-array.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding:utf-8 -*- - - -# Rotate an array of n elements to the right by k steps. -# -# For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. -# -# Note: -# Try to come up as many solutions as you can, there are at least 3 different ways to solve this problem. -# -# [show hint] -# -# Hint: -# Could you do it in-place with O(1) extra space? -# -# Related problem: Reverse Words in a String II -# -# Credits: -# Special thanks to @Freezen for adding this problem and creating all test cases. -# - - -class Solution(object): - def rotate(self, nums, k): - """ - :type nums: List[int] - :type k: int - :rtype: void Do not return anything, modify nums in-place instead. - """ - while k>0: - t = nums.pop() - nums.insert(0, t) - k -= 1 diff --git a/237-delete-node-in-a-linked-list/delete-node-in-a-linked-list.py b/237-delete-node-in-a-linked-list/delete-node-in-a-linked-list.py deleted file mode 100644 index c69096ac..00000000 --- a/237-delete-node-in-a-linked-list/delete-node-in-a-linked-list.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding:utf-8 -*- - - -# -# Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. -# -# -# -# Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value 3, the linked list should become 1 -> 2 -> 4 after calling your function. -# - - -# Definition for singly-linked list. -# class ListNode(object): -# def __init__(self, x): -# self.val = x -# self.next = None - -class Solution(object): - def deleteNode(self, node): - """ - :type node: ListNode - :rtype: void Do not return anything, modify node in-place instead. - """ - node.val = node.next.val - node.next = node.next.next diff --git a/275-h-index-ii/h-index-ii.py b/275-h-index-ii/h-index-ii.py deleted file mode 100644 index 6237fd27..00000000 --- a/275-h-index-ii/h-index-ii.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding:utf-8 -*- - - -# -# Follow up for H-Index: What if the citations array is sorted in ascending order? Could you optimize your algorithm? -# - - -class Solution(object): - def hIndex(self, citations): - """ - :type citations: List[int] - :rtype: int - """ - n = len(citations) - l, r = 0, n-1 - - while l <= r: - mid = (l+r)/2 - if citations[mid] >= n-mid: - r = mid - 1 - else: - l = mid + 1 - return n-l diff --git a/313-super-ugly-number/super-ugly-number.py b/313-super-ugly-number/super-ugly-number.py deleted file mode 100644 index 7eac1abd..00000000 --- a/313-super-ugly-number/super-ugly-number.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding:utf-8 -*- - - -# -# Write a program to find the nth super ugly number. -# -# -# -# Super ugly numbers are positive numbers whose all prime factors are in the given prime list -# primes of size k. For example, [1, 2, 4, 7, 8, 13, 14, 16, 19, 26, 28, 32] -# is the sequence of the first 12 super ugly numbers given primes -# = [2, 7, 13, 19] of size 4. -# -# -# -# Note: -# (1) 1 is a super ugly number for any given primes. -# (2) The given numbers in primes are in ascending order. -# (3) 0 < k ≤ 100, 0 < n ≤ 106, 0 < primes[i] < 1000. -# (4) The nth super ugly number is guaranteed to fit in a 32-bit signed integer. -# -# -# Credits:Special thanks to @dietpepsi for adding this problem and creating all test cases. - - -class Solution(object): - def nthSuperUglyNumber(self, n, primes): - """ - :type n: int - :type primes: List[int] - :rtype: int - """ - uglies = [1] - def gen(prime): - for ugly in uglies: - yield ugly * prime - merged = heapq.merge(*map(gen, primes)) - while len(uglies) < n: - ugly = next(merged) - if ugly != uglies[-1]: - uglies.append(ugly) - return uglies[-1] diff --git a/324-wiggle-sort-ii/wiggle-sort-ii.py b/324-wiggle-sort-ii/wiggle-sort-ii.py deleted file mode 100644 index d3e36467..00000000 --- a/324-wiggle-sort-ii/wiggle-sort-ii.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding:utf-8 -*- - - -# -# Given an unsorted array nums, reorder it such that -# nums[0] < nums[1] > nums[2] < nums[3].... -# -# -# -# Example: -# (1) Given nums = [1, 5, 1, 1, 6, 4], one possible answer is [1, 4, 1, 5, 1, 6]. -# (2) Given nums = [1, 3, 2, 2, 3, 1], one possible answer is [2, 3, 1, 3, 1, 2]. -# -# -# -# Note: -# You may assume all input has valid answer. -# -# -# -# Follow Up: -# Can you do it in O(n) time and/or in-place with O(1) extra space? -# -# -# Credits:Special thanks to @dietpepsi for adding this problem and creating all test cases. - - -class Solution(object): - def wiggleSort(self, nums): - """ - :type nums: List[int] - :rtype: void Do not return anything, modify nums in-place instead. - """ - nums.sort() - half = len(nums[::2]) - nums[::2], nums[1::2] = nums[:half][::-1], nums[half:][::-1] diff --git a/335-self-crossing/self-crossing.py b/335-self-crossing/self-crossing.py deleted file mode 100644 index d212bcb9..00000000 --- a/335-self-crossing/self-crossing.py +++ /dev/null @@ -1,74 +0,0 @@ -# -*- coding:utf-8 -*- - - -# -# You are given an array x of n positive numbers. You start at point (0,0) and moves x[0] metres to the north, then x[1] metres to the west, -# x[2] metres to the south, -# x[3] metres to the east and so on. In other words, after each move your direction changes -# counter-clockwise. -# -# -# Write a one-pass algorithm with O(1) extra space to determine, if your path crosses itself, or not. -# -# -# -# Example 1: -# -# Given x = [2, 1, 1, 2], -# ????? -# ? ? -# ???????> -# ? -# -# Return true (self crossing) -# -# -# -# -# Example 2: -# -# Given x = [1, 2, 3, 4], -# ???????? -# ? ? -# ? -# ? -# ?????????????> -# -# Return false (not self crossing) -# -# -# -# -# Example 3: -# -# Given x = [1, 1, 1, 1], -# ????? -# ? ? -# ?????> -# -# Return true (self crossing) -# -# -# -# Credits:Special thanks to @dietpepsi for adding this problem and creating all test cases. - - -class Solution(object): - def isSelfCrossing(self, x): - """ - :type x: List[int] - :rtype: bool - """ - n = len(x) - x.append(0.5) # let x[-1] = 0.5 - if n < 4: return False - grow = x[2] > x[0] - - for i in range(3,n): - if not grow and x[i] >= x[i-2]: return True - if grow and x[i] <= x[i-2]: - grow = False - if x[i] + x[i-4] >= x[i-2]: - x[i-1] -= x[i-3] - return False - diff --git a/Pipfile b/Pipfile index a21b9540..bce8100c 100644 --- a/Pipfile +++ b/Pipfile @@ -4,7 +4,7 @@ verify_ssl = true name = "pypi" [packages] -requests = "==2.18.4" +requests = ">=2.20.0" selenium = "==3.11.0" certifi = "==2018.1.18" chardet = "==3.0.4" @@ -12,9 +12,9 @@ cssselect = "==1.0.3" idna = "==2.6" lxml = "==4.2.1" pyquery = "==1.4.0" -"urllib3" = "==1.22" +"urllib3" = ">=1.23" [dev-packages] [requires] -python_version = "3.6" +python_version = "3.7" diff --git a/Pipfile.lock b/Pipfile.lock index 899461c9..2cf30811 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,11 +1,11 @@ { "_meta": { "hash": { - "sha256": "0be993159568082dd1f43bd1d891cc603bb521c23425d49ba4a723982ca9684f" + "sha256": "e53e1a54bc8f865390d8c4fe3e62341e5a6e331b3597dc23c2918e72761a833d" }, "pipfile-spec": 6, "requires": { - "python_version": "3.6" + "python_version": "3.7" }, "sources": [ { @@ -92,11 +92,11 @@ }, "requests": { "hashes": [ - "sha256:6a1b267aa90cac58ac3a765d067950e7dbbf75b1da07e895d1f594193a40a38b", - "sha256:9c443e7324ba5b85070c4a818ade28bfabedf16ea10206da1132edaa6dda237e" + "sha256:11e007a8a2aa0323f5a921e9e6a2d7e4e67d9877e85773fba9ba6419025cbeb4", + "sha256:9cf5292fcd0f598c671cfc1e0d7d1a7f13bb8085e9a590f48c010551dc6c4b31" ], "index": "pypi", - "version": "==2.18.4" + "version": "==2.22.0" }, "selenium": { "hashes": [ @@ -108,11 +108,11 @@ }, "urllib3": { "hashes": [ - "sha256:06330f386d6e4b195fbfc736b297f58c5a892e4440e54d294d7004e3a9bbea1b", - "sha256:cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f" + "sha256:b246607a25ac80bedac05c6f282e3cdaf3afb65420fd024ac94435cabe6e18d1", + "sha256:dbe59173209418ae49d485b87d1681aefa36252ee85884c31346debd19463232" ], "index": "pypi", - "version": "==1.22" + "version": "==1.25.3" } }, "develop": {} diff --git a/README.md b/README.md index 718863f1..dec58ec4 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# :pencil2: Leetcode Solutions with Python,Javascript -Update time: 2018-04-20 17:17:06 +# :pencil2: Leetcode Solutions with Python,Rust +Update time: 2019-08-24 06:54:58 Auto created by [leetcode_generate](https://github.com/bonfy/leetcode) -I have solved **97 / 734** problems -while there are **133** problems still locked. +I have solved **113 / 1084** problems +while there are **173** problems still locked. If you want to use this tool please follow this [Usage Guide](https://github.com/bonfy/leetcode/blob/master/README_leetcode_generate.md) @@ -16,185 +16,185 @@ If you are loving solving problems in leetcode, please contact me to enjoy it to | # | Title | Source Code | Article | Difficulty | |:---:|:---:|:---:|:---:|:---:| -|1|[two-sum](https://leetcode.com/problems/two-sum)|[Python](https://github.com/bonfy/leetcode/blob/master/001-two-sum/two-sum.py) [Javascript](https://github.com/bonfy/leetcode/blob/master/001-two-sum/two-sum.js)|[:memo:](https://leetcode.com/articles/two-sum/)|Easy| -|2|[add-two-numbers](https://leetcode.com/problems/add-two-numbers)|[Python](https://github.com/bonfy/leetcode/blob/master/002-add-two-numbers/add-two-numbers.py)|[:memo:](https://leetcode.com/articles/add-two-numbers/)|Medium| -|3|[longest-substring-without-repeating-characters](https://leetcode.com/problems/longest-substring-without-repeating-characters)|[Python](https://github.com/bonfy/leetcode/blob/master/003-longest-substring-without-repeating-characters/longest-substring-without-repeating-characters.py)|[:memo:](https://leetcode.com/articles/longest-substring-without-repeating-characters/)|Medium| -|4|[median-of-two-sorted-arrays](https://leetcode.com/problems/median-of-two-sorted-arrays)|[Python](https://github.com/bonfy/leetcode/blob/master/004-median-of-two-sorted-arrays/median-of-two-sorted-arrays.py)|[:memo:](https://leetcode.com/articles/median-of-two-sorted-arrays/)|Hard| -|5|[longest-palindromic-substring](https://leetcode.com/problems/longest-palindromic-substring)|[Python](https://github.com/bonfy/leetcode/blob/master/005-longest-palindromic-substring/longest-palindromic-substring.py)|[:memo:](https://leetcode.com/articles/longest-palindromic-substring/)|Medium| -|6|[zigzag-conversion](https://leetcode.com/problems/zigzag-conversion)|[Python](https://github.com/bonfy/leetcode/blob/master/006-zigzag-conversion/zigzag-conversion.py)||Medium| -|7|[reverse-integer](https://leetcode.com/problems/reverse-integer)|[Python](https://github.com/bonfy/leetcode/blob/master/007-reverse-integer/reverse-integer.py)||Easy| -|8|[string-to-integer-atoi](https://leetcode.com/problems/string-to-integer-atoi)|[Python](https://github.com/bonfy/leetcode/blob/master/008-string-to-integer-atoi/string-to-integer-atoi.py)||Medium| -|9|[palindrome-number](https://leetcode.com/problems/palindrome-number)|[Python](https://github.com/bonfy/leetcode/blob/master/009-palindrome-number/palindrome-number.py)|[:memo:](https://leetcode.com/articles/palindrome-number/)|Easy| -|10|[regular-expression-matching](https://leetcode.com/problems/regular-expression-matching)|[Python](https://github.com/bonfy/leetcode/blob/master/010-regular-expression-matching/regular-expression-matching.py)|[:memo:](https://leetcode.com/articles/regular-expression-matching/)|Hard| -|11|[container-with-most-water](https://leetcode.com/problems/container-with-most-water)|[Python](https://github.com/bonfy/leetcode/blob/master/011-container-with-most-water/container-with-most-water.py)|[:memo:](https://leetcode.com/articles/container-most-water/)|Medium| -|12|[integer-to-roman](https://leetcode.com/problems/integer-to-roman)|[Python](https://github.com/bonfy/leetcode/blob/master/012-integer-to-roman/integer-to-roman.py)||Medium| -|13|[roman-to-integer](https://leetcode.com/problems/roman-to-integer)|[Python](https://github.com/bonfy/leetcode/blob/master/013-roman-to-integer/roman-to-integer.py)||Easy| -|14|[longest-common-prefix](https://leetcode.com/problems/longest-common-prefix)|[Python](https://github.com/bonfy/leetcode/blob/master/014-longest-common-prefix/longest-common-prefix.py)|[:memo:](https://leetcode.com/articles/longest-common-prefix/)|Easy| -|15|[3sum](https://leetcode.com/problems/3sum)|[Python](https://github.com/bonfy/leetcode/blob/master/015-3sum/3sum.py) [Javascript](https://github.com/bonfy/leetcode/blob/master/015-3sum/3sum.js)||Medium| -|16|[3sum-closest](https://leetcode.com/problems/3sum-closest)|[Python](https://github.com/bonfy/leetcode/blob/master/016-3sum-closest/3sum-closest.py)||Medium| -|17|[letter-combinations-of-a-phone-number](https://leetcode.com/problems/letter-combinations-of-a-phone-number)|[Python](https://github.com/bonfy/leetcode/blob/master/017-letter-combinations-of-a-phone-number/letter-combinations-of-a-phone-number.py)||Medium| -|18|[4sum](https://leetcode.com/problems/4sum)|[Python](https://github.com/bonfy/leetcode/blob/master/018-4sum/4sum.py)||Medium| -|19|[remove-nth-node-from-end-of-list](https://leetcode.com/problems/remove-nth-node-from-end-of-list)|[Python](https://github.com/bonfy/leetcode/blob/master/019-remove-nth-node-from-end-of-list/remove-nth-node-from-end-of-list.py)|[:memo:](https://leetcode.com/articles/remove-nth-node-end-list/)|Medium| -|20|[valid-parentheses](https://leetcode.com/problems/valid-parentheses)|[Python](https://github.com/bonfy/leetcode/blob/master/020-valid-parentheses/valid-parentheses.py)||Easy| -|21|[merge-two-sorted-lists](https://leetcode.com/problems/merge-two-sorted-lists)|[Python](https://github.com/bonfy/leetcode/blob/master/021-merge-two-sorted-lists/merge-two-sorted-lists.py)|[:memo:](https://leetcode.com/articles/merged-two-sorted-lists/)|Easy| -|22|[generate-parentheses](https://leetcode.com/problems/generate-parentheses)|[Python](https://github.com/bonfy/leetcode/blob/master/022-generate-parentheses/generate-parentheses.py)|[:memo:](https://leetcode.com/articles/generate-parentheses/)|Medium| -|23|[merge-k-sorted-lists](https://leetcode.com/problems/merge-k-sorted-lists)|[Python](https://github.com/bonfy/leetcode/blob/master/023-merge-k-sorted-lists/merge-k-sorted-lists.py)|[:memo:](https://leetcode.com/articles/merge-k-sorted-list/)|Hard| -|24|[swap-nodes-in-pairs](https://leetcode.com/problems/swap-nodes-in-pairs)|[Python](https://github.com/bonfy/leetcode/blob/master/024-swap-nodes-in-pairs/swap-nodes-in-pairs.py)||Medium| -|25|[reverse-nodes-in-k-group](https://leetcode.com/problems/reverse-nodes-in-k-group)|[Python](https://github.com/bonfy/leetcode/blob/master/025-reverse-nodes-in-k-group/reverse-nodes-in-k-group.py)||Hard| -|26|[remove-duplicates-from-sorted-array](https://leetcode.com/problems/remove-duplicates-from-sorted-array)|[Python](https://github.com/bonfy/leetcode/blob/master/026-remove-duplicates-from-sorted-array/remove-duplicates-from-sorted-array.py)|[:memo:](https://leetcode.com/articles/remove-duplicates-sorted-array/)|Easy| -|27|[remove-element](https://leetcode.com/problems/remove-element)|[Python](https://github.com/bonfy/leetcode/blob/master/027-remove-element/remove-element.py)|[:memo:](https://leetcode.com/articles/remove-element/)|Easy| -|28|[implement-strstr](https://leetcode.com/problems/implement-strstr)|[Python](https://github.com/bonfy/leetcode/blob/master/028-implement-strstr/implement-strstr.py)||Easy| +|1|[two-sum](https://leetcode.com/problems/two-sum)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0001-two-sum/two-sum.py) [Rust](https://github.com/bonfy/leetcode/blob/master/solutions/0001-two-sum/two-sum.rs)|[:memo:](https://leetcode.com/articles/two-sum/)|Easy| +|2|[add-two-numbers](https://leetcode.com/problems/add-two-numbers)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0002-add-two-numbers/add-two-numbers.py)|[:memo:](https://leetcode.com/articles/add-two-numbers/)|Medium| +|3|[longest-substring-without-repeating-characters](https://leetcode.com/problems/longest-substring-without-repeating-characters)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0003-longest-substring-without-repeating-characters/longest-substring-without-repeating-characters.py)|[:memo:](https://leetcode.com/articles/longest-substring-without-repeating-characters/)|Medium| +|4|[median-of-two-sorted-arrays](https://leetcode.com/problems/median-of-two-sorted-arrays)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0004-median-of-two-sorted-arrays/median-of-two-sorted-arrays.py)|[:memo:](https://leetcode.com/articles/median-of-two-sorted-arrays/)|Hard| +|5|[longest-palindromic-substring](https://leetcode.com/problems/longest-palindromic-substring)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0005-longest-palindromic-substring/longest-palindromic-substring.py)|[:memo:](https://leetcode.com/articles/longest-palindromic-substring/)|Medium| +|6|[zigzag-conversion](https://leetcode.com/problems/zigzag-conversion)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0006-zigzag-conversion/zigzag-conversion.py)|[:memo:](https://leetcode.com/articles/zigzag-conversion/)|Medium| +|7|[reverse-integer](https://leetcode.com/problems/reverse-integer)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0007-reverse-integer/reverse-integer.py)|[:memo:](https://leetcode.com/articles/reverse-integer/)|Easy| +|8|[string-to-integer-atoi](https://leetcode.com/problems/string-to-integer-atoi)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0008-string-to-integer-atoi/string-to-integer-atoi.py)||Medium| +|9|[palindrome-number](https://leetcode.com/problems/palindrome-number)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0009-palindrome-number/palindrome-number.py)|[:memo:](https://leetcode.com/articles/palindrome-number/)|Easy| +|10|[regular-expression-matching](https://leetcode.com/problems/regular-expression-matching)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0010-regular-expression-matching/regular-expression-matching.py)|[:memo:](https://leetcode.com/articles/regular-expression-matching/)|Hard| +|11|[container-with-most-water](https://leetcode.com/problems/container-with-most-water)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0011-container-with-most-water/container-with-most-water.py)|[:memo:](https://leetcode.com/articles/container-with-most-water/)|Medium| +|12|[integer-to-roman](https://leetcode.com/problems/integer-to-roman)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0012-integer-to-roman/integer-to-roman.py)||Medium| +|13|[roman-to-integer](https://leetcode.com/problems/roman-to-integer)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0013-roman-to-integer/roman-to-integer.py)||Easy| +|14|[longest-common-prefix](https://leetcode.com/problems/longest-common-prefix)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0014-longest-common-prefix/longest-common-prefix.py)|[:memo:](https://leetcode.com/articles/longest-common-prefix/)|Easy| +|15|[3sum](https://leetcode.com/problems/3sum)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0015-3sum/3sum.py)||Medium| +|16|[3sum-closest](https://leetcode.com/problems/3sum-closest)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0016-3sum-closest/3sum-closest.py)||Medium| +|17|[letter-combinations-of-a-phone-number](https://leetcode.com/problems/letter-combinations-of-a-phone-number)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0017-letter-combinations-of-a-phone-number/letter-combinations-of-a-phone-number.py)|[:memo:](https://leetcode.com/articles/letter-combinations-of-a-phone-number/)|Medium| +|18|[4sum](https://leetcode.com/problems/4sum)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0018-4sum/4sum.py)||Medium| +|19|[remove-nth-node-from-end-of-list](https://leetcode.com/problems/remove-nth-node-from-end-of-list)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0019-remove-nth-node-from-end-of-list/remove-nth-node-from-end-of-list.py)|[:memo:](https://leetcode.com/articles/remove-nth-node-from-end-of-list/)|Medium| +|20|[valid-parentheses](https://leetcode.com/problems/valid-parentheses)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0020-valid-parentheses/valid-parentheses.py)|[:memo:](https://leetcode.com/articles/valid-parentheses/)|Easy| +|21|[merge-two-sorted-lists](https://leetcode.com/problems/merge-two-sorted-lists)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0021-merge-two-sorted-lists/merge-two-sorted-lists.py)|[:memo:](https://leetcode.com/articles/merged-two-sorted-lists/)|Easy| +|22|[generate-parentheses](https://leetcode.com/problems/generate-parentheses)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0022-generate-parentheses/generate-parentheses.py)|[:memo:](https://leetcode.com/articles/generate-parentheses/)|Medium| +|23|[merge-k-sorted-lists](https://leetcode.com/problems/merge-k-sorted-lists)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0023-merge-k-sorted-lists/merge-k-sorted-lists.py)|[:memo:](https://leetcode.com/articles/merge-k-sorted-list/)|Hard| +|24|[swap-nodes-in-pairs](https://leetcode.com/problems/swap-nodes-in-pairs)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0024-swap-nodes-in-pairs/swap-nodes-in-pairs.py)||Medium| +|25|[reverse-nodes-in-k-group](https://leetcode.com/problems/reverse-nodes-in-k-group)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0025-reverse-nodes-in-k-group/reverse-nodes-in-k-group.py)||Hard| +|26|[remove-duplicates-from-sorted-array](https://leetcode.com/problems/remove-duplicates-from-sorted-array)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0026-remove-duplicates-from-sorted-array/remove-duplicates-from-sorted-array.py)|[:memo:](https://leetcode.com/articles/remove-duplicates-from-sorted-array/)|Easy| +|27|[remove-element](https://leetcode.com/problems/remove-element)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0027-remove-element/remove-element.py)|[:memo:](https://leetcode.com/articles/remove-element/)|Easy| +|28|[implement-strstr](https://leetcode.com/problems/implement-strstr)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0028-implement-strstr/implement-strstr.py)||Easy| |29|[divide-two-integers](https://leetcode.com/problems/divide-two-integers)|||Medium| |30|[substring-with-concatenation-of-all-words](https://leetcode.com/problems/substring-with-concatenation-of-all-words)|||Hard| |31|[next-permutation](https://leetcode.com/problems/next-permutation)||[:memo:](https://leetcode.com/articles/next-permutation/)|Medium| |32|[longest-valid-parentheses](https://leetcode.com/problems/longest-valid-parentheses)||[:memo:](https://leetcode.com/articles/longest-valid-parentheses/)|Hard| -|33|[search-in-rotated-sorted-array](https://leetcode.com/problems/search-in-rotated-sorted-array)|||Medium| -|34|[search-for-a-range](https://leetcode.com/problems/search-for-a-range)|[Python](https://github.com/bonfy/leetcode/blob/master/034-search-for-a-range/search-for-a-range.py)|[:memo:](https://leetcode.com/articles/search-for-a-range/)|Medium| -|35|[search-insert-position](https://leetcode.com/problems/search-insert-position)|[Python](https://github.com/bonfy/leetcode/blob/master/035-search-insert-position/search-insert-position.py)||Easy| -|36|[valid-sudoku](https://leetcode.com/problems/valid-sudoku)|||Medium| -|37|[sudoku-solver](https://leetcode.com/problems/sudoku-solver)|||Hard| -|38|[count-and-say](https://leetcode.com/problems/count-and-say)|[Python](https://github.com/bonfy/leetcode/blob/master/038-count-and-say/count-and-say.py)||Easy| -|39|[combination-sum](https://leetcode.com/problems/combination-sum)|[Python](https://github.com/bonfy/leetcode/blob/master/039-combination-sum/combination-sum.py)||Medium| +|33|[search-in-rotated-sorted-array](https://leetcode.com/problems/search-in-rotated-sorted-array)||[:memo:](https://leetcode.com/articles/search-in-rotated-sorted-array/)|Medium| +|34|[find-first-and-last-position-of-element-in-sorted-array](https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0034-find-first-and-last-position-of-element-in-sorted-array/find-first-and-last-position-of-element-in-sorted-array.py)|[:memo:](https://leetcode.com/articles/find-first-and-last-position-element-sorted-array/)|Medium| +|35|[search-insert-position](https://leetcode.com/problems/search-insert-position)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0035-search-insert-position/search-insert-position.py)||Easy| +|36|[valid-sudoku](https://leetcode.com/problems/valid-sudoku)||[:memo:](https://leetcode.com/articles/valid-sudoku/)|Medium| +|37|[sudoku-solver](https://leetcode.com/problems/sudoku-solver)||[:memo:](https://leetcode.com/articles/sudoku-solver/)|Hard| +|38|[count-and-say](https://leetcode.com/problems/count-and-say)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0038-count-and-say/count-and-say.py)||Easy| +|39|[combination-sum](https://leetcode.com/problems/combination-sum)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0039-combination-sum/combination-sum.py)||Medium| |40|[combination-sum-ii](https://leetcode.com/problems/combination-sum-ii)|||Medium| -|41|[first-missing-positive](https://leetcode.com/problems/first-missing-positive)|[Python](https://github.com/bonfy/leetcode/blob/master/041-first-missing-positive/first-missing-positive.py)||Hard| +|41|[first-missing-positive](https://leetcode.com/problems/first-missing-positive)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0041-first-missing-positive/first-missing-positive.py)|[:memo:](https://leetcode.com/articles/first-missing-positive/)|Hard| |42|[trapping-rain-water](https://leetcode.com/problems/trapping-rain-water)||[:memo:](https://leetcode.com/articles/trapping-rain-water/)|Hard| |43|[multiply-strings](https://leetcode.com/problems/multiply-strings)|||Medium| -|44|[wildcard-matching](https://leetcode.com/problems/wildcard-matching)|||Hard| +|44|[wildcard-matching](https://leetcode.com/problems/wildcard-matching)||[:memo:](https://leetcode.com/articles/wildcard-matching/)|Hard| |45|[jump-game-ii](https://leetcode.com/problems/jump-game-ii)|||Hard| -|46|[permutations](https://leetcode.com/problems/permutations)|||Medium| +|46|[permutations](https://leetcode.com/problems/permutations)||[:memo:](https://leetcode.com/articles/permutations/)|Medium| |47|[permutations-ii](https://leetcode.com/problems/permutations-ii)|||Medium| -|48|[rotate-image](https://leetcode.com/problems/rotate-image)|[Python](https://github.com/bonfy/leetcode/blob/master/048-rotate-image/rotate-image.py)||Medium| +|48|[rotate-image](https://leetcode.com/problems/rotate-image)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0048-rotate-image/rotate-image.py)|[:memo:](https://leetcode.com/articles/rotate-image/)|Medium| |49|[group-anagrams](https://leetcode.com/problems/group-anagrams)||[:memo:](https://leetcode.com/articles/group-anagrams/)|Medium| -|50|[powx-n](https://leetcode.com/problems/powx-n)|[Python](https://github.com/bonfy/leetcode/blob/master/050-powx-n/powx-n.py)|[:memo:](https://leetcode.com/articles/powx-n/)|Medium| -|51|[n-queens](https://leetcode.com/problems/n-queens)|||Hard| -|52|[n-queens-ii](https://leetcode.com/problems/n-queens-ii)|||Hard| -|53|[maximum-subarray](https://leetcode.com/problems/maximum-subarray)|[Python](https://github.com/bonfy/leetcode/blob/master/053-maximum-subarray/maximum-subarray.py)||Easy| -|54|[spiral-matrix](https://leetcode.com/problems/spiral-matrix)|[Python](https://github.com/bonfy/leetcode/blob/master/054-spiral-matrix/spiral-matrix.py)|[:memo:](https://leetcode.com/articles/spiral-matrix/)|Medium| -|55|[jump-game](https://leetcode.com/problems/jump-game)|[Python](https://github.com/bonfy/leetcode/blob/master/055-jump-game/jump-game.py)|[:memo:](https://leetcode.com/articles/jump-game/)|Medium| -|56|[merge-intervals](https://leetcode.com/problems/merge-intervals)|[Python](https://github.com/bonfy/leetcode/blob/master/056-merge-intervals/merge-intervals.py)|[:memo:](https://leetcode.com/articles/merge-intervals/)|Medium| -|57|[insert-interval](https://leetcode.com/problems/insert-interval)|[Python](https://github.com/bonfy/leetcode/blob/master/057-insert-interval/insert-interval.py)||Hard| -|58|[length-of-last-word](https://leetcode.com/problems/length-of-last-word)|[Python](https://github.com/bonfy/leetcode/blob/master/058-length-of-last-word/length-of-last-word.py)||Easy| +|50|[powx-n](https://leetcode.com/problems/powx-n)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0050-powx-n/powx-n.py)|[:memo:](https://leetcode.com/articles/powx-n/)|Medium| +|51|[n-queens](https://leetcode.com/problems/n-queens)||[:memo:](https://leetcode.com/articles/n-queens/)|Hard| +|52|[n-queens-ii](https://leetcode.com/problems/n-queens-ii)||[:memo:](https://leetcode.com/articles/n-queens-ii/)|Hard| +|53|[maximum-subarray](https://leetcode.com/problems/maximum-subarray)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0053-maximum-subarray/maximum-subarray.py)|[:memo:](https://leetcode.com/articles/maximum-subarray/)|Easy| +|54|[spiral-matrix](https://leetcode.com/problems/spiral-matrix)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0054-spiral-matrix/spiral-matrix.py)|[:memo:](https://leetcode.com/articles/spiral-matrix/)|Medium| +|55|[jump-game](https://leetcode.com/problems/jump-game)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0055-jump-game/jump-game.py)|[:memo:](https://leetcode.com/articles/jump-game/)|Medium| +|56|[merge-intervals](https://leetcode.com/problems/merge-intervals)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0056-merge-intervals/merge-intervals.py)|[:memo:](https://leetcode.com/articles/merge-intervals/)|Medium| +|57|[insert-interval](https://leetcode.com/problems/insert-interval)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0057-insert-interval/insert-interval.py)|[:memo:](https://leetcode.com/articles/insert-interval/)|Hard| +|58|[length-of-last-word](https://leetcode.com/problems/length-of-last-word)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0058-length-of-last-word/length-of-last-word.py)||Easy| |59|[spiral-matrix-ii](https://leetcode.com/problems/spiral-matrix-ii)|||Medium| |60|[permutation-sequence](https://leetcode.com/problems/permutation-sequence)|||Medium| -|61|[rotate-list](https://leetcode.com/problems/rotate-list)|||Medium| +|61|[rotate-list](https://leetcode.com/problems/rotate-list)||[:memo:](https://leetcode.com/articles/rotate-list/)|Medium| |62|[unique-paths](https://leetcode.com/problems/unique-paths)|||Medium| -|63|[unique-paths-ii](https://leetcode.com/problems/unique-paths-ii)|||Medium| +|63|[unique-paths-ii](https://leetcode.com/problems/unique-paths-ii)||[:memo:](https://leetcode.com/articles/unique-paths-ii/)|Medium| |64|[minimum-path-sum](https://leetcode.com/problems/minimum-path-sum)||[:memo:](https://leetcode.com/articles/minimum-path-sum/)|Medium| |65|[valid-number](https://leetcode.com/problems/valid-number)|||Hard| -|66|[plus-one](https://leetcode.com/problems/plus-one)|[Python](https://github.com/bonfy/leetcode/blob/master/066-plus-one/plus-one.py)||Easy| -|67|[add-binary](https://leetcode.com/problems/add-binary)|[Python](https://github.com/bonfy/leetcode/blob/master/067-add-binary/add-binary.py)||Easy| +|66|[plus-one](https://leetcode.com/problems/plus-one)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0066-plus-one/plus-one.py)||Easy| +|67|[add-binary](https://leetcode.com/problems/add-binary)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0067-add-binary/add-binary.py)||Easy| |68|[text-justification](https://leetcode.com/problems/text-justification)|||Hard| -|69|[sqrtx](https://leetcode.com/problems/sqrtx)|||Easy| -|70|[climbing-stairs](https://leetcode.com/problems/climbing-stairs)|[Python](https://github.com/bonfy/leetcode/blob/master/070-climbing-stairs/climbing-stairs.py)|[:memo:](https://leetcode.com/articles/climbing-stairs/)|Easy| -|71|[simplify-path](https://leetcode.com/problems/simplify-path)|[Python](https://github.com/bonfy/leetcode/blob/master/071-simplify-path/simplify-path.py)||Medium| -|72|[edit-distance](https://leetcode.com/problems/edit-distance)|||Hard| -|73|[set-matrix-zeroes](https://leetcode.com/problems/set-matrix-zeroes)|[Python](https://github.com/bonfy/leetcode/blob/master/073-set-matrix-zeroes/set-matrix-zeroes.py)||Medium| -|74|[search-a-2d-matrix](https://leetcode.com/problems/search-a-2d-matrix)|||Medium| -|75|[sort-colors](https://leetcode.com/problems/sort-colors)|[Python](https://github.com/bonfy/leetcode/blob/master/075-sort-colors/sort-colors.py)||Medium| -|76|[minimum-window-substring](https://leetcode.com/problems/minimum-window-substring)|||Hard| -|77|[combinations](https://leetcode.com/problems/combinations)|[Python](https://github.com/bonfy/leetcode/blob/master/077-combinations/combinations.py)||Medium| -|78|[subsets](https://leetcode.com/problems/subsets)|[Python](https://github.com/bonfy/leetcode/blob/master/078-subsets/subsets.py)||Medium| -|79|[word-search](https://leetcode.com/problems/word-search)|[Python](https://github.com/bonfy/leetcode/blob/master/079-word-search/word-search.py)||Medium| -|80|[remove-duplicates-from-sorted-array-ii](https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/080-remove-duplicates-from-sorted-array-ii/remove-duplicates-from-sorted-array-ii.py)||Medium| +|69|[sqrtx](https://leetcode.com/problems/sqrtx)||[:memo:](https://leetcode.com/articles/sqrtx/)|Easy| +|70|[climbing-stairs](https://leetcode.com/problems/climbing-stairs)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0070-climbing-stairs/climbing-stairs.py)|[:memo:](https://leetcode.com/articles/climbing-stairs/)|Easy| +|71|[simplify-path](https://leetcode.com/problems/simplify-path)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0071-simplify-path/simplify-path.py)||Medium| +|72|[edit-distance](https://leetcode.com/problems/edit-distance)||[:memo:](https://leetcode.com/articles/edit-distance/)|Hard| +|73|[set-matrix-zeroes](https://leetcode.com/problems/set-matrix-zeroes)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0073-set-matrix-zeroes/set-matrix-zeroes.py)|[:memo:](https://leetcode.com/articles/set-matrix-zeroes/)|Medium| +|74|[search-a-2d-matrix](https://leetcode.com/problems/search-a-2d-matrix)||[:memo:](https://leetcode.com/articles/search-in-2d-matrix/)|Medium| +|75|[sort-colors](https://leetcode.com/problems/sort-colors)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0075-sort-colors/sort-colors.py)|[:memo:](https://leetcode.com/articles/sort-colors/)|Medium| +|76|[minimum-window-substring](https://leetcode.com/problems/minimum-window-substring)||[:memo:](https://leetcode.com/articles/minimum-window-substring/)|Hard| +|77|[combinations](https://leetcode.com/problems/combinations)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0077-combinations/combinations.py)|[:memo:](https://leetcode.com/articles/combinations/)|Medium| +|78|[subsets](https://leetcode.com/problems/subsets)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0078-subsets/subsets.py)||Medium| +|79|[word-search](https://leetcode.com/problems/word-search)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0079-word-search/word-search.py)||Medium| +|80|[remove-duplicates-from-sorted-array-ii](https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0080-remove-duplicates-from-sorted-array-ii/remove-duplicates-from-sorted-array-ii.py)||Medium| |81|[search-in-rotated-sorted-array-ii](https://leetcode.com/problems/search-in-rotated-sorted-array-ii)|||Medium| |82|[remove-duplicates-from-sorted-list-ii](https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii)|||Medium| -|83|[remove-duplicates-from-sorted-list](https://leetcode.com/problems/remove-duplicates-from-sorted-list)|[Python](https://github.com/bonfy/leetcode/blob/master/083-remove-duplicates-from-sorted-list/remove-duplicates-from-sorted-list.py)|[:memo:](https://leetcode.com/articles/remove-duplicates-sorted-list/)|Easy| -|84|[largest-rectangle-in-histogram](https://leetcode.com/problems/largest-rectangle-in-histogram)||[:memo:](https://leetcode.com/articles/largest-rectangle-histogram/)|Hard| -|85|[maximal-rectangle](https://leetcode.com/problems/maximal-rectangle)|||Hard| -|86|[partition-list](https://leetcode.com/problems/partition-list)|[Python](https://github.com/bonfy/leetcode/blob/master/086-partition-list/partition-list.py)||Medium| +|83|[remove-duplicates-from-sorted-list](https://leetcode.com/problems/remove-duplicates-from-sorted-list)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0083-remove-duplicates-from-sorted-list/remove-duplicates-from-sorted-list.py)|[:memo:](https://leetcode.com/articles/remove-duplicates-from-sorted-list/)|Easy| +|84|[largest-rectangle-in-histogram](https://leetcode.com/problems/largest-rectangle-in-histogram)||[:memo:](https://leetcode.com/articles/largest-rectangle-in-histogram/)|Hard| +|85|[maximal-rectangle](https://leetcode.com/problems/maximal-rectangle)||[:memo:](https://leetcode.com/articles/maximal-rectangle/)|Hard| +|86|[partition-list](https://leetcode.com/problems/partition-list)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0086-partition-list/partition-list.py)|[:memo:](https://leetcode.com/articles/partition-list/)|Medium| |87|[scramble-string](https://leetcode.com/problems/scramble-string)|||Hard| -|88|[merge-sorted-array](https://leetcode.com/problems/merge-sorted-array)|[Python](https://github.com/bonfy/leetcode/blob/master/088-merge-sorted-array/merge-sorted-array.py)||Easy| +|88|[merge-sorted-array](https://leetcode.com/problems/merge-sorted-array)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0088-merge-sorted-array/merge-sorted-array.py)|[:memo:](https://leetcode.com/articles/merge-sorted-arrays/)|Easy| |89|[gray-code](https://leetcode.com/problems/gray-code)|||Medium| |90|[subsets-ii](https://leetcode.com/problems/subsets-ii)|||Medium| |91|[decode-ways](https://leetcode.com/problems/decode-ways)|||Medium| -|92|[reverse-linked-list-ii](https://leetcode.com/problems/reverse-linked-list-ii)|||Medium| -|93|[restore-ip-addresses](https://leetcode.com/problems/restore-ip-addresses)|[Python](https://github.com/bonfy/leetcode/blob/master/093-restore-ip-addresses/restore-ip-addresses.py)||Medium| -|94|[binary-tree-inorder-traversal](https://leetcode.com/problems/binary-tree-inorder-traversal)|[Python](https://github.com/bonfy/leetcode/blob/master/094-binary-tree-inorder-traversal/binary-tree-inorder-traversal.py)|[:memo:](https://leetcode.com/articles/binary-tree-inorder-traversal/)|Medium| -|95|[unique-binary-search-trees-ii](https://leetcode.com/problems/unique-binary-search-trees-ii)|||Medium| -|96|[unique-binary-search-trees](https://leetcode.com/problems/unique-binary-search-trees)|||Medium| -|97|[interleaving-string](https://leetcode.com/problems/interleaving-string)|[Python](https://github.com/bonfy/leetcode/blob/master/097-interleaving-string/interleaving-string.py)|[:memo:](https://leetcode.com/articles/interleaving-strings/)|Hard| -|98|[validate-binary-search-tree](https://leetcode.com/problems/validate-binary-search-tree)|||Medium| -|99|[recover-binary-search-tree](https://leetcode.com/problems/recover-binary-search-tree)|||Hard| -|100|[same-tree](https://leetcode.com/problems/same-tree)|[Python](https://github.com/bonfy/leetcode/blob/master/100-same-tree/same-tree.py)||Easy| -|101|[symmetric-tree](https://leetcode.com/problems/symmetric-tree)|[Python](https://github.com/bonfy/leetcode/blob/master/101-symmetric-tree/symmetric-tree.py)|[:memo:](https://leetcode.com/articles/symmetric-tree/)|Easy| -|102|[binary-tree-level-order-traversal](https://leetcode.com/problems/binary-tree-level-order-traversal)|||Medium| +|92|[reverse-linked-list-ii](https://leetcode.com/problems/reverse-linked-list-ii)||[:memo:](https://leetcode.com/articles/reverse-linked-list-ii/)|Medium| +|93|[restore-ip-addresses](https://leetcode.com/problems/restore-ip-addresses)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0093-restore-ip-addresses/restore-ip-addresses.py)|[:memo:](https://leetcode.com/articles/restore-ip-addresses/)|Medium| +|94|[binary-tree-inorder-traversal](https://leetcode.com/problems/binary-tree-inorder-traversal)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0094-binary-tree-inorder-traversal/binary-tree-inorder-traversal.py)|[:memo:](https://leetcode.com/articles/binary-tree-inorder-traversal/)|Medium| +|95|[unique-binary-search-trees-ii](https://leetcode.com/problems/unique-binary-search-trees-ii)||[:memo:](https://leetcode.com/articles/unique-binary-search-trees-ii/)|Medium| +|96|[unique-binary-search-trees](https://leetcode.com/problems/unique-binary-search-trees)||[:memo:](https://leetcode.com/articles/unique-binary-search-trees/)|Medium| +|97|[interleaving-string](https://leetcode.com/problems/interleaving-string)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0097-interleaving-string/interleaving-string.py)|[:memo:](https://leetcode.com/articles/interleaving-strings/)|Hard| +|98|[validate-binary-search-tree](https://leetcode.com/problems/validate-binary-search-tree)||[:memo:](https://leetcode.com/articles/validate-binary-search-tree/)|Medium| +|99|[recover-binary-search-tree](https://leetcode.com/problems/recover-binary-search-tree)||[:memo:](https://leetcode.com/articles/recover-binary-search-tree/)|Hard| +|100|[same-tree](https://leetcode.com/problems/same-tree)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0100-same-tree/same-tree.py)|[:memo:](https://leetcode.com/articles/same-tree/)|Easy| +|101|[symmetric-tree](https://leetcode.com/problems/symmetric-tree)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0101-symmetric-tree/symmetric-tree.py)|[:memo:](https://leetcode.com/articles/symmetric-tree/)|Easy| +|102|[binary-tree-level-order-traversal](https://leetcode.com/problems/binary-tree-level-order-traversal)||[:memo:](https://leetcode.com/articles/binary-tree-level-order-traversal/)|Medium| |103|[binary-tree-zigzag-level-order-traversal](https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal)|||Medium| -|104|[maximum-depth-of-binary-tree](https://leetcode.com/problems/maximum-depth-of-binary-tree)|[Python](https://github.com/bonfy/leetcode/blob/master/104-maximum-depth-of-binary-tree/maximum-depth-of-binary-tree.py)||Easy| -|105|[construct-binary-tree-from-preorder-and-inorder-traversal](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal)|||Medium| -|106|[construct-binary-tree-from-inorder-and-postorder-traversal](https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal)|||Medium| -|107|[binary-tree-level-order-traversal-ii](https://leetcode.com/problems/binary-tree-level-order-traversal-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/107-binary-tree-level-order-traversal-ii/binary-tree-level-order-traversal-ii.py)||Easy| -|108|[convert-sorted-array-to-binary-search-tree](https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree)|[Python](https://github.com/bonfy/leetcode/blob/master/108-convert-sorted-array-to-binary-search-tree/convert-sorted-array-to-binary-search-tree.py)||Easy| -|109|[convert-sorted-list-to-binary-search-tree](https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree)|||Medium| +|104|[maximum-depth-of-binary-tree](https://leetcode.com/problems/maximum-depth-of-binary-tree)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0104-maximum-depth-of-binary-tree/maximum-depth-of-binary-tree.py)|[:memo:](https://leetcode.com/articles/maximum-depth-of-binary-tree/)|Easy| +|105|[construct-binary-tree-from-preorder-and-inorder-traversal](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal)||[:memo:](https://leetcode.com/articles/construct-binary-tree-from-preorder-and-inorder-tr/)|Medium| +|106|[construct-binary-tree-from-inorder-and-postorder-traversal](https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal)||[:memo:](https://leetcode.com/articles/construct-binary-tree-from-inorder-and-postorder-t/)|Medium| +|107|[binary-tree-level-order-traversal-ii](https://leetcode.com/problems/binary-tree-level-order-traversal-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0107-binary-tree-level-order-traversal-ii/binary-tree-level-order-traversal-ii.py)||Easy| +|108|[convert-sorted-array-to-binary-search-tree](https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0108-convert-sorted-array-to-binary-search-tree/convert-sorted-array-to-binary-search-tree.py)||Easy| +|109|[convert-sorted-list-to-binary-search-tree](https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree)||[:memo:](https://leetcode.com/articles/convert-sorted-list-to-binary-search-tree/)|Medium| |110|[balanced-binary-tree](https://leetcode.com/problems/balanced-binary-tree)|||Easy| -|111|[minimum-depth-of-binary-tree](https://leetcode.com/problems/minimum-depth-of-binary-tree)|[Python](https://github.com/bonfy/leetcode/blob/master/111-minimum-depth-of-binary-tree/minimum-depth-of-binary-tree.py)||Easy| -|112|[path-sum](https://leetcode.com/problems/path-sum)|[Python](https://github.com/bonfy/leetcode/blob/master/112-path-sum/path-sum.py)||Easy| -|113|[path-sum-ii](https://leetcode.com/problems/path-sum-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/113-path-sum-ii/path-sum-ii.py)||Medium| +|111|[minimum-depth-of-binary-tree](https://leetcode.com/problems/minimum-depth-of-binary-tree)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0111-minimum-depth-of-binary-tree/minimum-depth-of-binary-tree.py)|[:memo:](https://leetcode.com/articles/minimum-depth-of-binary-tree/)|Easy| +|112|[path-sum](https://leetcode.com/problems/path-sum)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0112-path-sum/path-sum.py)|[:memo:](https://leetcode.com/articles/path-sum/)|Easy| +|113|[path-sum-ii](https://leetcode.com/problems/path-sum-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0113-path-sum-ii/path-sum-ii.py)||Medium| |114|[flatten-binary-tree-to-linked-list](https://leetcode.com/problems/flatten-binary-tree-to-linked-list)|||Medium| |115|[distinct-subsequences](https://leetcode.com/problems/distinct-subsequences)|||Hard| |116|[populating-next-right-pointers-in-each-node](https://leetcode.com/problems/populating-next-right-pointers-in-each-node)|||Medium| |117|[populating-next-right-pointers-in-each-node-ii](https://leetcode.com/problems/populating-next-right-pointers-in-each-node-ii)|||Medium| -|118|[pascals-triangle](https://leetcode.com/problems/pascals-triangle)|[Python](https://github.com/bonfy/leetcode/blob/master/118-pascals-triangle/pascals-triangle.py)|[:memo:](https://leetcode.com/articles/pascals-triangle/)|Easy| -|119|[pascals-triangle-ii](https://leetcode.com/problems/pascals-triangle-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/119-pascals-triangle-ii/pascals-triangle-ii.py)||Easy| +|118|[pascals-triangle](https://leetcode.com/problems/pascals-triangle)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0118-pascals-triangle/pascals-triangle.py)|[:memo:](https://leetcode.com/articles/pascals-triangle/)|Easy| +|119|[pascals-triangle-ii](https://leetcode.com/problems/pascals-triangle-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0119-pascals-triangle-ii/pascals-triangle-ii.py)||Easy| |120|[triangle](https://leetcode.com/problems/triangle)|||Medium| -|121|[best-time-to-buy-and-sell-stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock)|[Python](https://github.com/bonfy/leetcode/blob/master/121-best-time-to-buy-and-sell-stock/best-time-to-buy-and-sell-stock.py)|[:memo:](https://leetcode.com/articles/best-time-buy-and-sell-stock/)|Easy| -|122|[best-time-to-buy-and-sell-stock-ii](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/122-best-time-to-buy-and-sell-stock-ii/best-time-to-buy-and-sell-stock-ii.py)|[:memo:](https://leetcode.com/articles/best-time-buy-and-sell-stock-ii/)|Easy| +|121|[best-time-to-buy-and-sell-stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0121-best-time-to-buy-and-sell-stock/best-time-to-buy-and-sell-stock.py)|[:memo:](https://leetcode.com/articles/best-time-to-buy-and-sell-stock/)|Easy| +|122|[best-time-to-buy-and-sell-stock-ii](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0122-best-time-to-buy-and-sell-stock-ii/best-time-to-buy-and-sell-stock-ii.py)|[:memo:](https://leetcode.com/articles/best-time-to-buy-and-sell-stock-ii/)|Easy| |123|[best-time-to-buy-and-sell-stock-iii](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii)|||Hard| -|124|[binary-tree-maximum-path-sum](https://leetcode.com/problems/binary-tree-maximum-path-sum)|||Hard| -|125|[valid-palindrome](https://leetcode.com/problems/valid-palindrome)|[Python](https://github.com/bonfy/leetcode/blob/master/125-valid-palindrome/valid-palindrome.py)||Easy| +|124|[binary-tree-maximum-path-sum](https://leetcode.com/problems/binary-tree-maximum-path-sum)||[:memo:](https://leetcode.com/articles/binary-tree-maximum-path-sum/)|Hard| +|125|[valid-palindrome](https://leetcode.com/problems/valid-palindrome)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0125-valid-palindrome/valid-palindrome.py)||Easy| |126|[word-ladder-ii](https://leetcode.com/problems/word-ladder-ii)|||Hard| -|127|[word-ladder](https://leetcode.com/problems/word-ladder)|||Medium| +|127|[word-ladder](https://leetcode.com/problems/word-ladder)||[:memo:](https://leetcode.com/articles/word-ladder/)|Medium| |128|[longest-consecutive-sequence](https://leetcode.com/problems/longest-consecutive-sequence)||[:memo:](https://leetcode.com/articles/longest-consecutive-sequence/)|Hard| |129|[sum-root-to-leaf-numbers](https://leetcode.com/problems/sum-root-to-leaf-numbers)|||Medium| |130|[surrounded-regions](https://leetcode.com/problems/surrounded-regions)|||Medium| |131|[palindrome-partitioning](https://leetcode.com/problems/palindrome-partitioning)|||Medium| |132|[palindrome-partitioning-ii](https://leetcode.com/problems/palindrome-partitioning-ii)|||Hard| |133|[clone-graph](https://leetcode.com/problems/clone-graph)|||Medium| -|134|[gas-station](https://leetcode.com/problems/gas-station)|[Python](https://github.com/bonfy/leetcode/blob/master/134-gas-station/gas-station.py)||Medium| +|134|[gas-station](https://leetcode.com/problems/gas-station)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0134-gas-station/gas-station.py)|[:memo:](https://leetcode.com/articles/gas-station/)|Medium| |135|[candy](https://leetcode.com/problems/candy)||[:memo:](https://leetcode.com/articles/candy/)|Hard| -|136|[single-number](https://leetcode.com/problems/single-number)|[Python](https://github.com/bonfy/leetcode/blob/master/136-single-number/single-number.py)|[:memo:](https://leetcode.com/articles/single-number/)|Easy| -|137|[single-number-ii](https://leetcode.com/problems/single-number-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/137-single-number-ii/single-number-ii.py)||Medium| -|138|[copy-list-with-random-pointer](https://leetcode.com/problems/copy-list-with-random-pointer)|||Medium| +|136|[single-number](https://leetcode.com/problems/single-number)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0136-single-number/single-number.py)|[:memo:](https://leetcode.com/articles/single-number/)|Easy| +|137|[single-number-ii](https://leetcode.com/problems/single-number-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0137-single-number-ii/single-number-ii.py)|[:memo:](https://leetcode.com/articles/single-number-ii/)|Medium| +|138|[copy-list-with-random-pointer](https://leetcode.com/problems/copy-list-with-random-pointer)||[:memo:](https://leetcode.com/articles/copy-list-with-random-pointer/)|Medium| |139|[word-break](https://leetcode.com/problems/word-break)||[:memo:](https://leetcode.com/articles/word-break/)|Medium| |140|[word-break-ii](https://leetcode.com/problems/word-break-ii)||[:memo:](https://leetcode.com/articles/word-break-ii/)|Hard| -|141|[linked-list-cycle](https://leetcode.com/problems/linked-list-cycle)||[:memo:](https://leetcode.com/articles/linked-list-cycle/)|Easy| +|141|[linked-list-cycle](https://leetcode.com/problems/linked-list-cycle)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0141-linked-list-cycle/linked-list-cycle.py)|[:memo:](https://leetcode.com/articles/linked-list-cycle/)|Easy| |142|[linked-list-cycle-ii](https://leetcode.com/problems/linked-list-cycle-ii)||[:memo:](https://leetcode.com/articles/linked-list-cycle-ii/)|Medium| |143|[reorder-list](https://leetcode.com/problems/reorder-list)|||Medium| -|144|[binary-tree-preorder-traversal](https://leetcode.com/problems/binary-tree-preorder-traversal)|||Medium| -|145|[binary-tree-postorder-traversal](https://leetcode.com/problems/binary-tree-postorder-traversal)|||Hard| -|146|[lru-cache](https://leetcode.com/problems/lru-cache)|||Hard| +|144|[binary-tree-preorder-traversal](https://leetcode.com/problems/binary-tree-preorder-traversal)||[:memo:](https://leetcode.com/articles/binary-tree-preorder-transversal/)|Medium| +|145|[binary-tree-postorder-traversal](https://leetcode.com/problems/binary-tree-postorder-traversal)||[:memo:](https://leetcode.com/articles/binary-tree-postorder-transversal/)|Hard| +|146|[lru-cache](https://leetcode.com/problems/lru-cache)||[:memo:](https://leetcode.com/articles/lru-cache/)|Medium| |147|[insertion-sort-list](https://leetcode.com/problems/insertion-sort-list)|||Medium| |148|[sort-list](https://leetcode.com/problems/sort-list)|||Medium| -|149|[max-points-on-a-line](https://leetcode.com/problems/max-points-on-a-line)|||Hard| +|149|[max-points-on-a-line](https://leetcode.com/problems/max-points-on-a-line)||[:memo:](https://leetcode.com/articles/max-points-on-a-line/)|Hard| |150|[evaluate-reverse-polish-notation](https://leetcode.com/problems/evaluate-reverse-polish-notation)|||Medium| |151|[reverse-words-in-a-string](https://leetcode.com/problems/reverse-words-in-a-string)|||Medium| |152|[maximum-product-subarray](https://leetcode.com/problems/maximum-product-subarray)|||Medium| -|153|[find-minimum-in-rotated-sorted-array](https://leetcode.com/problems/find-minimum-in-rotated-sorted-array)|||Medium| +|153|[find-minimum-in-rotated-sorted-array](https://leetcode.com/problems/find-minimum-in-rotated-sorted-array)||[:memo:](https://leetcode.com/articles/find-minimum-in-rotated-sorted-array/)|Medium| |154|[find-minimum-in-rotated-sorted-array-ii](https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii)|||Hard| |155|[min-stack](https://leetcode.com/problems/min-stack)|||Easy| |156|[binary-tree-upside-down](https://leetcode.com/problems/binary-tree-upside-down)|:lock:||Medium| |157|[read-n-characters-given-read4](https://leetcode.com/problems/read-n-characters-given-read4)|:lock:||Easy| |158|[read-n-characters-given-read4-ii-call-multiple-times](https://leetcode.com/problems/read-n-characters-given-read4-ii-call-multiple-times)|:lock:||Hard| -|159|[longest-substring-with-at-most-two-distinct-characters](https://leetcode.com/problems/longest-substring-with-at-most-two-distinct-characters)|:lock:||Hard| -|160|[intersection-of-two-linked-lists](https://leetcode.com/problems/intersection-of-two-linked-lists)||[:memo:](https://leetcode.com/articles/intersection-two-linked-lists/)|Easy| -|161|[one-edit-distance](https://leetcode.com/problems/one-edit-distance)|:lock:||Medium| +|159|[longest-substring-with-at-most-two-distinct-characters](https://leetcode.com/problems/longest-substring-with-at-most-two-distinct-characters)|:lock:|[:memo:](https://leetcode.com/articles/longest-substring-with-at-most-two-distinct-charac/)|Hard| +|160|[intersection-of-two-linked-lists](https://leetcode.com/problems/intersection-of-two-linked-lists)||[:memo:](https://leetcode.com/articles/intersection-of-two-linked-lists/)|Easy| +|161|[one-edit-distance](https://leetcode.com/problems/one-edit-distance)|:lock:|[:memo:](https://leetcode.com/articles/one-edit-distance/)|Medium| |162|[find-peak-element](https://leetcode.com/problems/find-peak-element)||[:memo:](https://leetcode.com/articles/find-peak-element/)|Medium| |163|[missing-ranges](https://leetcode.com/problems/missing-ranges)|:lock:||Medium| |164|[maximum-gap](https://leetcode.com/problems/maximum-gap)||[:memo:](https://leetcode.com/articles/maximum-gap/)|Hard| |165|[compare-version-numbers](https://leetcode.com/problems/compare-version-numbers)|||Medium| -|166|[fraction-to-recurring-decimal](https://leetcode.com/problems/fraction-to-recurring-decimal)||[:memo:](https://leetcode.com/articles/fraction-recurring-decimal/)|Medium| -|167|[two-sum-ii-input-array-is-sorted](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted)||[:memo:](https://leetcode.com/articles/two-sum-ii-input-array-sorted/)|Easy| +|166|[fraction-to-recurring-decimal](https://leetcode.com/problems/fraction-to-recurring-decimal)||[:memo:](https://leetcode.com/articles/fraction-to-recurring-decimal/)|Medium| +|167|[two-sum-ii-input-array-is-sorted](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted)||[:memo:](https://leetcode.com/articles/two-sum-ii-input-array-is-sorted/)|Easy| |168|[excel-sheet-column-title](https://leetcode.com/problems/excel-sheet-column-title)|||Easy| |169|[majority-element](https://leetcode.com/problems/majority-element)||[:memo:](https://leetcode.com/articles/majority-element/)|Easy| |170|[two-sum-iii-data-structure-design](https://leetcode.com/problems/two-sum-iii-data-structure-design)|:lock:||Easy| |171|[excel-sheet-column-number](https://leetcode.com/problems/excel-sheet-column-number)|||Easy| |172|[factorial-trailing-zeroes](https://leetcode.com/problems/factorial-trailing-zeroes)|||Easy| -|173|[binary-search-tree-iterator](https://leetcode.com/problems/binary-search-tree-iterator)|||Medium| +|173|[binary-search-tree-iterator](https://leetcode.com/problems/binary-search-tree-iterator)||[:memo:](https://leetcode.com/articles/binary-search-tree-iterator/)|Medium| |174|[dungeon-game](https://leetcode.com/problems/dungeon-game)|||Hard| |179|[largest-number](https://leetcode.com/problems/largest-number)||[:memo:](https://leetcode.com/articles/largest-number/)|Medium| |186|[reverse-words-in-a-string-ii](https://leetcode.com/problems/reverse-words-in-a-string-ii)|:lock:||Medium| |187|[repeated-dna-sequences](https://leetcode.com/problems/repeated-dna-sequences)|||Medium| |188|[best-time-to-buy-and-sell-stock-iv](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv)|||Hard| -|189|[rotate-array](https://leetcode.com/problems/rotate-array)|[Python](https://github.com/bonfy/leetcode/blob/master/189-rotate-array/rotate-array.py)|[:memo:](https://leetcode.com/articles/rotate-array/)|Easy| +|189|[rotate-array](https://leetcode.com/problems/rotate-array)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0189-rotate-array/rotate-array.py)|[:memo:](https://leetcode.com/articles/rotate-array/)|Easy| |190|[reverse-bits](https://leetcode.com/problems/reverse-bits)|||Easy| |191|[number-of-1-bits](https://leetcode.com/problems/number-of-1-bits)||[:memo:](https://leetcode.com/articles/number-1-bits/)|Easy| |198|[house-robber](https://leetcode.com/problems/house-robber)||[:memo:](https://leetcode.com/articles/house-robber/)|Easy| @@ -205,89 +205,89 @@ If you are loving solving problems in leetcode, please contact me to enjoy it to |203|[remove-linked-list-elements](https://leetcode.com/problems/remove-linked-list-elements)|||Easy| |204|[count-primes](https://leetcode.com/problems/count-primes)|||Easy| |205|[isomorphic-strings](https://leetcode.com/problems/isomorphic-strings)|||Easy| -|206|[reverse-linked-list](https://leetcode.com/problems/reverse-linked-list)|[Python](https://github.com/bonfy/leetcode/blob/master/206-reverse-linked-list/reverse-linked-list.py)|[:memo:](https://leetcode.com/articles/reverse-linked-list/)|Easy| +|206|[reverse-linked-list](https://leetcode.com/problems/reverse-linked-list)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0206-reverse-linked-list/reverse-linked-list.py)|[:memo:](https://leetcode.com/articles/reverse-linked-list/)|Easy| |207|[course-schedule](https://leetcode.com/problems/course-schedule)|||Medium| |208|[implement-trie-prefix-tree](https://leetcode.com/problems/implement-trie-prefix-tree)||[:memo:](https://leetcode.com/articles/implement-trie-prefix-tree/)|Medium| |209|[minimum-size-subarray-sum](https://leetcode.com/problems/minimum-size-subarray-sum)||[:memo:](https://leetcode.com/articles/minimum-size-subarray-sum/)|Medium| -|210|[course-schedule-ii](https://leetcode.com/problems/course-schedule-ii)|||Medium| +|210|[course-schedule-ii](https://leetcode.com/problems/course-schedule-ii)||[:memo:](https://leetcode.com/articles/course-schedule-ii/)|Medium| |211|[add-and-search-word-data-structure-design](https://leetcode.com/problems/add-and-search-word-data-structure-design)|||Medium| |212|[word-search-ii](https://leetcode.com/problems/word-search-ii)|||Hard| |213|[house-robber-ii](https://leetcode.com/problems/house-robber-ii)|||Medium| |214|[shortest-palindrome](https://leetcode.com/problems/shortest-palindrome)||[:memo:](https://leetcode.com/articles/shortest-palindrome/)|Hard| -|215|[kth-largest-element-in-an-array](https://leetcode.com/problems/kth-largest-element-in-an-array)|||Medium| +|215|[kth-largest-element-in-an-array](https://leetcode.com/problems/kth-largest-element-in-an-array)||[:memo:](https://leetcode.com/articles/kth-largest-element-in-an-array/)|Medium| |216|[combination-sum-iii](https://leetcode.com/problems/combination-sum-iii)|||Medium| |217|[contains-duplicate](https://leetcode.com/problems/contains-duplicate)||[:memo:](https://leetcode.com/articles/contains-duplicate/)|Easy| -|218|[the-skyline-problem](https://leetcode.com/problems/the-skyline-problem)|||Hard| +|218|[the-skyline-problem](https://leetcode.com/problems/the-skyline-problem)||[:memo:](https://leetcode.com/articles/skyline-problem/)|Hard| |219|[contains-duplicate-ii](https://leetcode.com/problems/contains-duplicate-ii)||[:memo:](https://leetcode.com/articles/contains-duplicate-ii/)|Easy| |220|[contains-duplicate-iii](https://leetcode.com/problems/contains-duplicate-iii)||[:memo:](https://leetcode.com/articles/contains-duplicate-iii/)|Medium| |221|[maximal-square](https://leetcode.com/problems/maximal-square)||[:memo:](https://leetcode.com/articles/maximal-square/)|Medium| -|222|[count-complete-tree-nodes](https://leetcode.com/problems/count-complete-tree-nodes)|||Medium| +|222|[count-complete-tree-nodes](https://leetcode.com/problems/count-complete-tree-nodes)||[:memo:](https://leetcode.com/articles/count-complete-tree-nodes/)|Medium| |223|[rectangle-area](https://leetcode.com/problems/rectangle-area)|||Medium| -|224|[basic-calculator](https://leetcode.com/problems/basic-calculator)|||Hard| +|224|[basic-calculator](https://leetcode.com/problems/basic-calculator)||[:memo:](https://leetcode.com/articles/basic-calculator/)|Hard| |225|[implement-stack-using-queues](https://leetcode.com/problems/implement-stack-using-queues)||[:memo:](https://leetcode.com/articles/implement-stack-using-queues/)|Easy| |226|[invert-binary-tree](https://leetcode.com/problems/invert-binary-tree)||[:memo:](https://leetcode.com/articles/invert-binary-tree/)|Easy| -|227|[basic-calculator-ii](https://leetcode.com/problems/basic-calculator-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/227-basic-calculator-ii/basic-calculator-ii.py)||Medium| +|227|[basic-calculator-ii](https://leetcode.com/problems/basic-calculator-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0227-basic-calculator-ii/basic-calculator-ii.py)||Medium| |228|[summary-ranges](https://leetcode.com/problems/summary-ranges)||[:memo:](https://leetcode.com/articles/summary-ranges/)|Medium| |229|[majority-element-ii](https://leetcode.com/problems/majority-element-ii)|||Medium| -|230|[kth-smallest-element-in-a-bst](https://leetcode.com/problems/kth-smallest-element-in-a-bst)|||Medium| -|231|[power-of-two](https://leetcode.com/problems/power-of-two)|||Easy| +|230|[kth-smallest-element-in-a-bst](https://leetcode.com/problems/kth-smallest-element-in-a-bst)||[:memo:](https://leetcode.com/articles/kth-smallest-element-in-a-bst/)|Medium| +|231|[power-of-two](https://leetcode.com/problems/power-of-two)||[:memo:](https://leetcode.com/articles/power-of-two/)|Easy| |232|[implement-queue-using-stacks](https://leetcode.com/problems/implement-queue-using-stacks)||[:memo:](https://leetcode.com/articles/implement-queue-using-stacks/)|Easy| |233|[number-of-digit-one](https://leetcode.com/problems/number-of-digit-one)||[:memo:](https://leetcode.com/articles/number-of-digit-one/)|Hard| |234|[palindrome-linked-list](https://leetcode.com/problems/palindrome-linked-list)|||Easy| -|235|[lowest-common-ancestor-of-a-binary-search-tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree)|||Easy| -|236|[lowest-common-ancestor-of-a-binary-tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree)|||Medium| -|237|[delete-node-in-a-linked-list](https://leetcode.com/problems/delete-node-in-a-linked-list)|[Python](https://github.com/bonfy/leetcode/blob/master/237-delete-node-in-a-linked-list/delete-node-in-a-linked-list.py)|[:memo:](https://leetcode.com/articles/delete-node-linked-list/)|Easy| -|238|[product-of-array-except-self](https://leetcode.com/problems/product-of-array-except-self)|||Medium| -|239|[sliding-window-maximum](https://leetcode.com/problems/sliding-window-maximum)|||Hard| -|240|[search-a-2d-matrix-ii](https://leetcode.com/problems/search-a-2d-matrix-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/240-search-a-2d-matrix-ii/search-a-2d-matrix-ii.py)|[:memo:](https://leetcode.com/articles/search-a-2d-matrix-ii/)|Medium| +|235|[lowest-common-ancestor-of-a-binary-search-tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree)||[:memo:](https://leetcode.com/articles/lowest-common-ancestor-of-a-binary-search-tree/)|Easy| +|236|[lowest-common-ancestor-of-a-binary-tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree)||[:memo:](https://leetcode.com/articles/lowest-common-ancestor-of-a-binary-tree/)|Medium| +|237|[delete-node-in-a-linked-list](https://leetcode.com/problems/delete-node-in-a-linked-list)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0237-delete-node-in-a-linked-list/delete-node-in-a-linked-list.py)|[:memo:](https://leetcode.com/articles/delete-node-linked-list/)|Easy| +|238|[product-of-array-except-self](https://leetcode.com/problems/product-of-array-except-self)||[:memo:](https://leetcode.com/articles/product-of-array-except-self/)|Medium| +|239|[sliding-window-maximum](https://leetcode.com/problems/sliding-window-maximum)||[:memo:](https://leetcode.com/articles/sliding-window-maximum/)|Hard| +|240|[search-a-2d-matrix-ii](https://leetcode.com/problems/search-a-2d-matrix-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0240-search-a-2d-matrix-ii/search-a-2d-matrix-ii.py)|[:memo:](https://leetcode.com/articles/search-a-2d-matrix-ii/)|Medium| |241|[different-ways-to-add-parentheses](https://leetcode.com/problems/different-ways-to-add-parentheses)|||Medium| -|242|[valid-anagram](https://leetcode.com/problems/valid-anagram)|[Python](https://github.com/bonfy/leetcode/blob/master/242-valid-anagram/valid-anagram.py)|[:memo:](https://leetcode.com/articles/valid-anagram/)|Easy| +|242|[valid-anagram](https://leetcode.com/problems/valid-anagram)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0242-valid-anagram/valid-anagram.py)|[:memo:](https://leetcode.com/articles/valid-anagram/)|Easy| |243|[shortest-word-distance](https://leetcode.com/problems/shortest-word-distance)|:lock:|[:memo:](https://leetcode.com/articles/shortest-word-distance/)|Easy| -|244|[shortest-word-distance-ii](https://leetcode.com/problems/shortest-word-distance-ii)|:lock:||Medium| +|244|[shortest-word-distance-ii](https://leetcode.com/problems/shortest-word-distance-ii)|:lock:|[:memo:](https://leetcode.com/articles/shortest-word-distance-ii/)|Medium| |245|[shortest-word-distance-iii](https://leetcode.com/problems/shortest-word-distance-iii)|:lock:||Medium| |246|[strobogrammatic-number](https://leetcode.com/problems/strobogrammatic-number)|:lock:||Easy| |247|[strobogrammatic-number-ii](https://leetcode.com/problems/strobogrammatic-number-ii)|:lock:||Medium| |248|[strobogrammatic-number-iii](https://leetcode.com/problems/strobogrammatic-number-iii)|:lock:||Hard| |249|[group-shifted-strings](https://leetcode.com/problems/group-shifted-strings)|:lock:||Medium| -|250|[count-univalue-subtrees](https://leetcode.com/problems/count-univalue-subtrees)|:lock:||Medium| +|250|[count-univalue-subtrees](https://leetcode.com/problems/count-univalue-subtrees)|:lock:|[:memo:](https://leetcode.com/articles/count-univalue-subtrees/)|Medium| |251|[flatten-2d-vector](https://leetcode.com/problems/flatten-2d-vector)|:lock:||Medium| |252|[meeting-rooms](https://leetcode.com/problems/meeting-rooms)|:lock:|[:memo:](https://leetcode.com/articles/meeting-rooms/)|Easy| -|253|[meeting-rooms-ii](https://leetcode.com/problems/meeting-rooms-ii)|:lock:||Medium| +|253|[meeting-rooms-ii](https://leetcode.com/problems/meeting-rooms-ii)|:lock:|[:memo:](https://leetcode.com/articles/meeting-rooms-ii/)|Medium| |254|[factor-combinations](https://leetcode.com/problems/factor-combinations)|:lock:||Medium| |255|[verify-preorder-sequence-in-binary-search-tree](https://leetcode.com/problems/verify-preorder-sequence-in-binary-search-tree)|:lock:||Medium| |256|[paint-house](https://leetcode.com/problems/paint-house)|:lock:||Easy| -|257|[binary-tree-paths](https://leetcode.com/problems/binary-tree-paths)|||Easy| +|257|[binary-tree-paths](https://leetcode.com/problems/binary-tree-paths)||[:memo:](https://leetcode.com/articles/binary-tree-paths/)|Easy| |258|[add-digits](https://leetcode.com/problems/add-digits)|||Easy| |259|[3sum-smaller](https://leetcode.com/problems/3sum-smaller)|:lock:|[:memo:](https://leetcode.com/articles/3sum-smaller/)|Medium| |260|[single-number-iii](https://leetcode.com/problems/single-number-iii)|||Medium| |261|[graph-valid-tree](https://leetcode.com/problems/graph-valid-tree)|:lock:||Medium| -|263|[ugly-number](https://leetcode.com/problems/ugly-number)|[Python](https://github.com/bonfy/leetcode/blob/master/263-ugly-number/ugly-number.py)||Easy| -|264|[ugly-number-ii](https://leetcode.com/problems/ugly-number-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/264-ugly-number-ii/ugly-number-ii.py)||Medium| +|263|[ugly-number](https://leetcode.com/problems/ugly-number)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0263-ugly-number/ugly-number.py)||Easy| +|264|[ugly-number-ii](https://leetcode.com/problems/ugly-number-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0264-ugly-number-ii/ugly-number-ii.py)|[:memo:](https://leetcode.com/articles/ugly-number-ii/)|Medium| |265|[paint-house-ii](https://leetcode.com/problems/paint-house-ii)|:lock:||Hard| |266|[palindrome-permutation](https://leetcode.com/problems/palindrome-permutation)|:lock:|[:memo:](https://leetcode.com/articles/palindrome-permutation/)|Easy| |267|[palindrome-permutation-ii](https://leetcode.com/problems/palindrome-permutation-ii)|:lock:|[:memo:](https://leetcode.com/articles/palindrome-permutation-ii/)|Medium| |268|[missing-number](https://leetcode.com/problems/missing-number)||[:memo:](https://leetcode.com/articles/missing-number/)|Easy| |269|[alien-dictionary](https://leetcode.com/problems/alien-dictionary)|:lock:||Hard| -|270|[closest-binary-search-tree-value](https://leetcode.com/problems/closest-binary-search-tree-value)|:lock:||Easy| -|271|[encode-and-decode-strings](https://leetcode.com/problems/encode-and-decode-strings)|:lock:||Medium| +|270|[closest-binary-search-tree-value](https://leetcode.com/problems/closest-binary-search-tree-value)|:lock:|[:memo:](https://leetcode.com/articles/closest-bst-value/)|Easy| +|271|[encode-and-decode-strings](https://leetcode.com/problems/encode-and-decode-strings)|:lock:|[:memo:](https://leetcode.com/articles/encode-and-decode-strings/)|Medium| |272|[closest-binary-search-tree-value-ii](https://leetcode.com/problems/closest-binary-search-tree-value-ii)|:lock:||Hard| -|273|[integer-to-english-words](https://leetcode.com/problems/integer-to-english-words)|||Hard| -|274|[h-index](https://leetcode.com/problems/h-index)|[Python](https://github.com/bonfy/leetcode/blob/master/274-h-index/h-index.py)|[:memo:](https://leetcode.com/articles/h-index/)|Medium| -|275|[h-index-ii](https://leetcode.com/problems/h-index-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/275-h-index-ii/h-index-ii.py)||Medium| +|273|[integer-to-english-words](https://leetcode.com/problems/integer-to-english-words)||[:memo:](https://leetcode.com/articles/integer-to-english-words/)|Hard| +|274|[h-index](https://leetcode.com/problems/h-index)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0274-h-index/h-index.py)|[:memo:](https://leetcode.com/articles/h-index/)|Medium| +|275|[h-index-ii](https://leetcode.com/problems/h-index-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0275-h-index-ii/h-index-ii.py)|[:memo:](https://leetcode.com/articles/h-index-ii/)|Medium| |276|[paint-fence](https://leetcode.com/problems/paint-fence)|:lock:||Easy| |277|[find-the-celebrity](https://leetcode.com/problems/find-the-celebrity)|:lock:||Medium| |278|[first-bad-version](https://leetcode.com/problems/first-bad-version)||[:memo:](https://leetcode.com/articles/first-bad-version/)|Easy| |279|[perfect-squares](https://leetcode.com/problems/perfect-squares)|||Medium| |280|[wiggle-sort](https://leetcode.com/problems/wiggle-sort)|:lock:|[:memo:](https://leetcode.com/articles/wiggle-sort/)|Medium| |281|[zigzag-iterator](https://leetcode.com/problems/zigzag-iterator)|:lock:||Medium| -|282|[expression-add-operators](https://leetcode.com/problems/expression-add-operators)|||Hard| +|282|[expression-add-operators](https://leetcode.com/problems/expression-add-operators)||[:memo:](https://leetcode.com/articles/expression-add-operators/)|Hard| |283|[move-zeroes](https://leetcode.com/problems/move-zeroes)||[:memo:](https://leetcode.com/articles/move-zeroes/)|Easy| |284|[peeking-iterator](https://leetcode.com/problems/peeking-iterator)|||Medium| -|285|[inorder-successor-in-bst](https://leetcode.com/problems/inorder-successor-in-bst)|:lock:||Medium| +|285|[inorder-successor-in-bst](https://leetcode.com/problems/inorder-successor-in-bst)|:lock:|[:memo:](https://leetcode.com/articles/inorder-successor-in-bst/)|Medium| |286|[walls-and-gates](https://leetcode.com/problems/walls-and-gates)|:lock:|[:memo:](https://leetcode.com/articles/walls-and-gates/)|Medium| |287|[find-the-duplicate-number](https://leetcode.com/problems/find-the-duplicate-number)||[:memo:](https://leetcode.com/articles/find-the-duplicate-number/)|Medium| |288|[unique-word-abbreviation](https://leetcode.com/problems/unique-word-abbreviation)|:lock:|[:memo:](https://leetcode.com/articles/unique-word-abbreviation/)|Medium| -|289|[game-of-life](https://leetcode.com/problems/game-of-life)|||Medium| +|289|[game-of-life](https://leetcode.com/problems/game-of-life)||[:memo:](https://leetcode.com/articles/game-of-life/)|Medium| |290|[word-pattern](https://leetcode.com/problems/word-pattern)|||Easy| |291|[word-pattern-ii](https://leetcode.com/problems/word-pattern-ii)|:lock:||Hard| |292|[nim-game](https://leetcode.com/problems/nim-game)||[:memo:](https://leetcode.com/articles/nim-game/)|Easy| @@ -295,11 +295,11 @@ If you are loving solving problems in leetcode, please contact me to enjoy it to |294|[flip-game-ii](https://leetcode.com/problems/flip-game-ii)|:lock:||Medium| |295|[find-median-from-data-stream](https://leetcode.com/problems/find-median-from-data-stream)||[:memo:](https://leetcode.com/articles/find-median-from-data-stream/)|Hard| |296|[best-meeting-point](https://leetcode.com/problems/best-meeting-point)|:lock:|[:memo:](https://leetcode.com/articles/best-meeting-point/)|Hard| -|297|[serialize-and-deserialize-binary-tree](https://leetcode.com/problems/serialize-and-deserialize-binary-tree)|||Hard| +|297|[serialize-and-deserialize-binary-tree](https://leetcode.com/problems/serialize-and-deserialize-binary-tree)||[:memo:](https://leetcode.com/articles/serialize-and-deserialize-binary-tree/)|Hard| |298|[binary-tree-longest-consecutive-sequence](https://leetcode.com/problems/binary-tree-longest-consecutive-sequence)|:lock:|[:memo:](https://leetcode.com/articles/binary-tree-longest-consecutive-sequence/)|Medium| -|299|[bulls-and-cows](https://leetcode.com/problems/bulls-and-cows)|||Medium| +|299|[bulls-and-cows](https://leetcode.com/problems/bulls-and-cows)|||Easy| |300|[longest-increasing-subsequence](https://leetcode.com/problems/longest-increasing-subsequence)||[:memo:](https://leetcode.com/articles/longest-increasing-subsequence/)|Medium| -|301|[remove-invalid-parentheses](https://leetcode.com/problems/remove-invalid-parentheses)|||Hard| +|301|[remove-invalid-parentheses](https://leetcode.com/problems/remove-invalid-parentheses)||[:memo:](https://leetcode.com/articles/remove-invalid-parentheses/)|Hard| |302|[smallest-rectangle-enclosing-black-pixels](https://leetcode.com/problems/smallest-rectangle-enclosing-black-pixels)|:lock:|[:memo:](https://leetcode.com/articles/smallest-rectangle-enclosing-black-pixels/)|Hard| |303|[range-sum-query-immutable](https://leetcode.com/problems/range-sum-query-immutable)||[:memo:](https://leetcode.com/articles/range-sum-query-immutable/)|Easy| |304|[range-sum-query-2d-immutable](https://leetcode.com/problems/range-sum-query-2d-immutable)||[:memo:](https://leetcode.com/articles/range-sum-query-2d-immutable/)|Medium| @@ -310,44 +310,44 @@ If you are loving solving problems in leetcode, please contact me to enjoy it to |309|[best-time-to-buy-and-sell-stock-with-cooldown](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown)|||Medium| |310|[minimum-height-trees](https://leetcode.com/problems/minimum-height-trees)|||Medium| |311|[sparse-matrix-multiplication](https://leetcode.com/problems/sparse-matrix-multiplication)|:lock:||Medium| -|312|[burst-balloons](https://leetcode.com/problems/burst-balloons)|||Hard| -|313|[super-ugly-number](https://leetcode.com/problems/super-ugly-number)|[Python](https://github.com/bonfy/leetcode/blob/master/313-super-ugly-number/super-ugly-number.py)||Medium| +|312|[burst-balloons](https://leetcode.com/problems/burst-balloons)||[:memo:](https://leetcode.com/articles/burst-balloons/)|Hard| +|313|[super-ugly-number](https://leetcode.com/problems/super-ugly-number)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0313-super-ugly-number/super-ugly-number.py)||Medium| |314|[binary-tree-vertical-order-traversal](https://leetcode.com/problems/binary-tree-vertical-order-traversal)|:lock:||Medium| |315|[count-of-smaller-numbers-after-self](https://leetcode.com/problems/count-of-smaller-numbers-after-self)|||Hard| -|316|[remove-duplicate-letters](https://leetcode.com/problems/remove-duplicate-letters)|||Hard| +|316|[remove-duplicate-letters](https://leetcode.com/problems/remove-duplicate-letters)||[:memo:](https://leetcode.com/articles/remove-duplicate-letters/)|Hard| |317|[shortest-distance-from-all-buildings](https://leetcode.com/problems/shortest-distance-from-all-buildings)|:lock:||Hard| -|318|[maximum-product-of-word-lengths](https://leetcode.com/problems/maximum-product-of-word-lengths)|||Medium| +|318|[maximum-product-of-word-lengths](https://leetcode.com/problems/maximum-product-of-word-lengths)||[:memo:](https://leetcode.com/articles/maximum-product-of-word-lengths/)|Medium| |319|[bulb-switcher](https://leetcode.com/problems/bulb-switcher)|||Medium| |320|[generalized-abbreviation](https://leetcode.com/problems/generalized-abbreviation)|:lock:|[:memo:](https://leetcode.com/articles/generalized-abbreviation/)|Medium| |321|[create-maximum-number](https://leetcode.com/problems/create-maximum-number)|||Hard| |322|[coin-change](https://leetcode.com/problems/coin-change)||[:memo:](https://leetcode.com/articles/coin-change/)|Medium| |323|[number-of-connected-components-in-an-undirected-graph](https://leetcode.com/problems/number-of-connected-components-in-an-undirected-graph)|:lock:||Medium| -|324|[wiggle-sort-ii](https://leetcode.com/problems/wiggle-sort-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/324-wiggle-sort-ii/wiggle-sort-ii.py)||Medium| +|324|[wiggle-sort-ii](https://leetcode.com/problems/wiggle-sort-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0324-wiggle-sort-ii/wiggle-sort-ii.py)||Medium| |325|[maximum-size-subarray-sum-equals-k](https://leetcode.com/problems/maximum-size-subarray-sum-equals-k)|:lock:||Medium| |326|[power-of-three](https://leetcode.com/problems/power-of-three)||[:memo:](https://leetcode.com/articles/power-of-three/)|Easy| |327|[count-of-range-sum](https://leetcode.com/problems/count-of-range-sum)|||Hard| |328|[odd-even-linked-list](https://leetcode.com/problems/odd-even-linked-list)||[:memo:](https://leetcode.com/articles/odd-even-linked-list/)|Medium| |329|[longest-increasing-path-in-a-matrix](https://leetcode.com/problems/longest-increasing-path-in-a-matrix)||[:memo:](https://leetcode.com/articles/longest-increasing-path-matrix/)|Hard| |330|[patching-array](https://leetcode.com/problems/patching-array)||[:memo:](https://leetcode.com/articles/patching-array/)|Hard| -|331|[verify-preorder-serialization-of-a-binary-tree](https://leetcode.com/problems/verify-preorder-serialization-of-a-binary-tree)|||Medium| +|331|[verify-preorder-serialization-of-a-binary-tree](https://leetcode.com/problems/verify-preorder-serialization-of-a-binary-tree)||[:memo:](https://leetcode.com/articles/verify-preorder-serialization-of-a-binary-tree/)|Medium| |332|[reconstruct-itinerary](https://leetcode.com/problems/reconstruct-itinerary)|||Medium| |333|[largest-bst-subtree](https://leetcode.com/problems/largest-bst-subtree)|:lock:||Medium| |334|[increasing-triplet-subsequence](https://leetcode.com/problems/increasing-triplet-subsequence)|||Medium| -|335|[self-crossing](https://leetcode.com/problems/self-crossing)|[Python](https://github.com/bonfy/leetcode/blob/master/335-self-crossing/self-crossing.py)||Hard| +|335|[self-crossing](https://leetcode.com/problems/self-crossing)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0335-self-crossing/self-crossing.py)||Hard| |336|[palindrome-pairs](https://leetcode.com/problems/palindrome-pairs)|||Hard| |337|[house-robber-iii](https://leetcode.com/problems/house-robber-iii)|||Medium| |338|[counting-bits](https://leetcode.com/problems/counting-bits)||[:memo:](https://leetcode.com/articles/counting-bits/)|Medium| |339|[nested-list-weight-sum](https://leetcode.com/problems/nested-list-weight-sum)|:lock:|[:memo:](https://leetcode.com/articles/nested-list-weight-sum/)|Easy| -|340|[longest-substring-with-at-most-k-distinct-characters](https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters)|:lock:||Hard| +|340|[longest-substring-with-at-most-k-distinct-characters](https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters)|:lock:|[:memo:](https://leetcode.com/articles/longest-substring-with-at-most-k-distinct-characte/)|Hard| |341|[flatten-nested-list-iterator](https://leetcode.com/problems/flatten-nested-list-iterator)|||Medium| |342|[power-of-four](https://leetcode.com/problems/power-of-four)|||Easy| |343|[integer-break](https://leetcode.com/problems/integer-break)|||Medium| |344|[reverse-string](https://leetcode.com/problems/reverse-string)|||Easy| |345|[reverse-vowels-of-a-string](https://leetcode.com/problems/reverse-vowels-of-a-string)|||Easy| |346|[moving-average-from-data-stream](https://leetcode.com/problems/moving-average-from-data-stream)|:lock:||Easy| -|347|[top-k-frequent-elements](https://leetcode.com/problems/top-k-frequent-elements)|[Python](https://github.com/bonfy/leetcode/blob/master/347-top-k-frequent-elements/top-k-frequent-elements.py)||Medium| +|347|[top-k-frequent-elements](https://leetcode.com/problems/top-k-frequent-elements)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0347-top-k-frequent-elements/top-k-frequent-elements.py)|[:memo:](https://leetcode.com/articles/top-k-frequent-elements/)|Medium| |348|[design-tic-tac-toe](https://leetcode.com/problems/design-tic-tac-toe)|:lock:||Medium| -|349|[intersection-of-two-arrays](https://leetcode.com/problems/intersection-of-two-arrays)|||Easy| +|349|[intersection-of-two-arrays](https://leetcode.com/problems/intersection-of-two-arrays)||[:memo:](https://leetcode.com/articles/intersection-of-two-arrays/)|Easy| |350|[intersection-of-two-arrays-ii](https://leetcode.com/problems/intersection-of-two-arrays-ii)|||Easy| |351|[android-unlock-patterns](https://leetcode.com/problems/android-unlock-patterns)|:lock:|[:memo:](https://leetcode.com/articles/android-unlock-patterns/)|Medium| |352|[data-stream-as-disjoint-intervals](https://leetcode.com/problems/data-stream-as-disjoint-intervals)|||Hard| @@ -379,38 +379,38 @@ If you are loving solving problems in leetcode, please contact me to enjoy it to |378|[kth-smallest-element-in-a-sorted-matrix](https://leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix)|||Medium| |379|[design-phone-directory](https://leetcode.com/problems/design-phone-directory)|:lock:||Medium| |380|[insert-delete-getrandom-o1](https://leetcode.com/problems/insert-delete-getrandom-o1)|||Medium| -|381|[insert-delete-getrandom-o1-duplicates-allowed](https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed)|||Hard| +|381|[insert-delete-getrandom-o1-duplicates-allowed](https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed)||[:memo:](https://leetcode.com/articles/insert-delete-getrandom-o1-duplicates-allowed/)|Hard| |382|[linked-list-random-node](https://leetcode.com/problems/linked-list-random-node)|||Medium| |383|[ransom-note](https://leetcode.com/problems/ransom-note)|||Easy| |384|[shuffle-an-array](https://leetcode.com/problems/shuffle-an-array)||[:memo:](https://leetcode.com/articles/shuffle-an-array/)|Medium| |385|[mini-parser](https://leetcode.com/problems/mini-parser)|||Medium| |386|[lexicographical-numbers](https://leetcode.com/problems/lexicographical-numbers)|||Medium| -|387|[first-unique-character-in-a-string](https://leetcode.com/problems/first-unique-character-in-a-string)|||Easy| +|387|[first-unique-character-in-a-string](https://leetcode.com/problems/first-unique-character-in-a-string)||[:memo:](https://leetcode.com/articles/first-unique-character-in-a-string/)|Easy| |388|[longest-absolute-file-path](https://leetcode.com/problems/longest-absolute-file-path)|||Medium| |389|[find-the-difference](https://leetcode.com/problems/find-the-difference)|||Easy| |390|[elimination-game](https://leetcode.com/problems/elimination-game)|||Medium| |391|[perfect-rectangle](https://leetcode.com/problems/perfect-rectangle)|||Hard| -|392|[is-subsequence](https://leetcode.com/problems/is-subsequence)|||Medium| -|393|[utf-8-validation](https://leetcode.com/problems/utf-8-validation)|||Medium| +|392|[is-subsequence](https://leetcode.com/problems/is-subsequence)|||Easy| +|393|[utf-8-validation](https://leetcode.com/problems/utf-8-validation)||[:memo:](https://leetcode.com/articles/utf-8-validation/)|Medium| |394|[decode-string](https://leetcode.com/problems/decode-string)|||Medium| |395|[longest-substring-with-at-least-k-repeating-characters](https://leetcode.com/problems/longest-substring-with-at-least-k-repeating-characters)|||Medium| |396|[rotate-function](https://leetcode.com/problems/rotate-function)|||Medium| |397|[integer-replacement](https://leetcode.com/problems/integer-replacement)|||Medium| |398|[random-pick-index](https://leetcode.com/problems/random-pick-index)|||Medium| |399|[evaluate-division](https://leetcode.com/problems/evaluate-division)|||Medium| -|400|[nth-digit](https://leetcode.com/problems/nth-digit)|||Easy| +|400|[nth-digit](https://leetcode.com/problems/nth-digit)|||Medium| |401|[binary-watch](https://leetcode.com/problems/binary-watch)|||Easy| |402|[remove-k-digits](https://leetcode.com/problems/remove-k-digits)|||Medium| |403|[frog-jump](https://leetcode.com/problems/frog-jump)||[:memo:](https://leetcode.com/articles/frog-jump/)|Hard| |404|[sum-of-left-leaves](https://leetcode.com/problems/sum-of-left-leaves)|||Easy| -|405|[convert-a-number-to-hexadecimal](https://leetcode.com/problems/convert-a-number-to-hexadecimal)|[Python](https://github.com/bonfy/leetcode/blob/master/405-convert-a-number-to-hexadecimal/convert-a-number-to-hexadecimal.py)||Easy| -|406|[queue-reconstruction-by-height](https://leetcode.com/problems/queue-reconstruction-by-height)|||Medium| +|405|[convert-a-number-to-hexadecimal](https://leetcode.com/problems/convert-a-number-to-hexadecimal)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0405-convert-a-number-to-hexadecimal/convert-a-number-to-hexadecimal.py)||Easy| +|406|[queue-reconstruction-by-height](https://leetcode.com/problems/queue-reconstruction-by-height)||[:memo:](https://leetcode.com/articles/queue-reconstruction-by-height/)|Medium| |407|[trapping-rain-water-ii](https://leetcode.com/problems/trapping-rain-water-ii)|||Hard| |408|[valid-word-abbreviation](https://leetcode.com/problems/valid-word-abbreviation)|:lock:||Easy| |409|[longest-palindrome](https://leetcode.com/problems/longest-palindrome)||[:memo:](https://leetcode.com/articles/longest-palindrome/)|Easy| |410|[split-array-largest-sum](https://leetcode.com/problems/split-array-largest-sum)||[:memo:](https://leetcode.com/articles/split-array-largest-sum/)|Hard| |411|[minimum-unique-word-abbreviation](https://leetcode.com/problems/minimum-unique-word-abbreviation)|:lock:||Hard| -|412|[fizz-buzz](https://leetcode.com/problems/fizz-buzz)|||Easy| +|412|[fizz-buzz](https://leetcode.com/problems/fizz-buzz)||[:memo:](https://leetcode.com/articles/fizz-buzz/)|Easy| |413|[arithmetic-slices](https://leetcode.com/problems/arithmetic-slices)||[:memo:](https://leetcode.com/articles/arithmetic-slices/)|Medium| |414|[third-maximum-number](https://leetcode.com/problems/third-maximum-number)|||Easy| |415|[add-strings](https://leetcode.com/problems/add-strings)|||Easy| @@ -418,18 +418,19 @@ If you are loving solving problems in leetcode, please contact me to enjoy it to |417|[pacific-atlantic-water-flow](https://leetcode.com/problems/pacific-atlantic-water-flow)|||Medium| |418|[sentence-screen-fitting](https://leetcode.com/problems/sentence-screen-fitting)|:lock:||Medium| |419|[battleships-in-a-board](https://leetcode.com/problems/battleships-in-a-board)|||Medium| -|420|[strong-password-checker](https://leetcode.com/problems/strong-password-checker)|[Python](https://github.com/bonfy/leetcode/blob/master/420-strong-password-checker/strong-password-checker.py)||Hard| +|420|[strong-password-checker](https://leetcode.com/problems/strong-password-checker)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0420-strong-password-checker/strong-password-checker.py)||Hard| |421|[maximum-xor-of-two-numbers-in-an-array](https://leetcode.com/problems/maximum-xor-of-two-numbers-in-an-array)|||Medium| |422|[valid-word-square](https://leetcode.com/problems/valid-word-square)|:lock:||Easy| -|423|[reconstruct-original-digits-from-english](https://leetcode.com/problems/reconstruct-original-digits-from-english)|||Medium| +|423|[reconstruct-original-digits-from-english](https://leetcode.com/problems/reconstruct-original-digits-from-english)||[:memo:](https://leetcode.com/articles/reconstruct-original-digits-from-english/)|Medium| |424|[longest-repeating-character-replacement](https://leetcode.com/problems/longest-repeating-character-replacement)|||Medium| |425|[word-squares](https://leetcode.com/problems/word-squares)|:lock:||Hard| |432|[all-oone-data-structure](https://leetcode.com/problems/all-oone-data-structure)|||Hard| +|433|[minimum-genetic-mutation](https://leetcode.com/problems/minimum-genetic-mutation)|||Medium| |434|[number-of-segments-in-a-string](https://leetcode.com/problems/number-of-segments-in-a-string)||[:memo:](https://leetcode.com/articles/number-of-segments-in-a-string/)|Easy| |435|[non-overlapping-intervals](https://leetcode.com/problems/non-overlapping-intervals)||[:memo:](https://leetcode.com/articles/non-overlapping-intervals/)|Medium| |436|[find-right-interval](https://leetcode.com/problems/find-right-interval)||[:memo:](https://leetcode.com/articles/find-right-interval/)|Medium| |437|[path-sum-iii](https://leetcode.com/problems/path-sum-iii)|||Easy| -|438|[find-all-anagrams-in-a-string](https://leetcode.com/problems/find-all-anagrams-in-a-string)|[Python](https://github.com/bonfy/leetcode/blob/master/438-find-all-anagrams-in-a-string/find-all-anagrams-in-a-string.py)||Easy| +|438|[find-all-anagrams-in-a-string](https://leetcode.com/problems/find-all-anagrams-in-a-string)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0438-find-all-anagrams-in-a-string/find-all-anagrams-in-a-string.py)||Medium| |439|[ternary-expression-parser](https://leetcode.com/problems/ternary-expression-parser)|:lock:||Medium| |440|[k-th-smallest-in-lexicographical-order](https://leetcode.com/problems/k-th-smallest-in-lexicographical-order)|||Hard| |441|[arranging-coins](https://leetcode.com/problems/arranging-coins)|||Easy| @@ -440,17 +441,19 @@ If you are loving solving problems in leetcode, please contact me to enjoy it to |446|[arithmetic-slices-ii-subsequence](https://leetcode.com/problems/arithmetic-slices-ii-subsequence)||[:memo:](https://leetcode.com/articles/arithmetic-slices-ii-subsequence/)|Hard| |447|[number-of-boomerangs](https://leetcode.com/problems/number-of-boomerangs)|||Easy| |448|[find-all-numbers-disappeared-in-an-array](https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array)|||Easy| -|449|[serialize-and-deserialize-bst](https://leetcode.com/problems/serialize-and-deserialize-bst)|||Medium| -|450|[delete-node-in-a-bst](https://leetcode.com/problems/delete-node-in-a-bst)|||Medium| +|449|[serialize-and-deserialize-bst](https://leetcode.com/problems/serialize-and-deserialize-bst)||[:memo:](https://leetcode.com/articles/serialize-and-deserialize-bst/)|Medium| +|450|[delete-node-in-a-bst](https://leetcode.com/problems/delete-node-in-a-bst)||[:memo:](https://leetcode.com/articles/delete-node-in-a-bst/)|Medium| |451|[sort-characters-by-frequency](https://leetcode.com/problems/sort-characters-by-frequency)|||Medium| -|452|[minimum-number-of-arrows-to-burst-balloons](https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons)|||Medium| +|452|[minimum-number-of-arrows-to-burst-balloons](https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons)||[:memo:](https://leetcode.com/articles/minimum-number-of-arrows-to-burst-balloons/)|Medium| |453|[minimum-moves-to-equal-array-elements](https://leetcode.com/problems/minimum-moves-to-equal-array-elements)||[:memo:](https://leetcode.com/articles/minimum-moves-to-equal-array-elements/)|Easy| -|454|[4sum-ii](https://leetcode.com/problems/4sum-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/454-4sum-ii/4sum-ii.py)||Medium| -|455|[assign-cookies](https://leetcode.com/problems/assign-cookies)|[Python](https://github.com/bonfy/leetcode/blob/master/455-assign-cookies/assign-cookies.py)||Easy| +|454|[4sum-ii](https://leetcode.com/problems/4sum-ii)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0454-4sum-ii/4sum-ii.py)||Medium| +|455|[assign-cookies](https://leetcode.com/problems/assign-cookies)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0455-assign-cookies/assign-cookies.py)||Easy| |456|[132-pattern](https://leetcode.com/problems/132-pattern)||[:memo:](https://leetcode.com/articles/132-pattern/)|Medium| +|457|[circular-array-loop](https://leetcode.com/problems/circular-array-loop)|||Medium| +|458|[poor-pigs](https://leetcode.com/problems/poor-pigs)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0458-poor-pigs/poor-pigs.py)|[:memo:](https://leetcode.com/articles/poor-pigs/)|Hard| |459|[repeated-substring-pattern](https://leetcode.com/problems/repeated-substring-pattern)|||Easy| |460|[lfu-cache](https://leetcode.com/problems/lfu-cache)|||Hard| -|461|[hamming-distance](https://leetcode.com/problems/hamming-distance)|[Python](https://github.com/bonfy/leetcode/blob/master/461-hamming-distance/hamming-distance.py)||Easy| +|461|[hamming-distance](https://leetcode.com/problems/hamming-distance)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0461-hamming-distance/hamming-distance.py)||Easy| |462|[minimum-moves-to-equal-array-elements-ii](https://leetcode.com/problems/minimum-moves-to-equal-array-elements-ii)||[:memo:](https://leetcode.com/articles/minimum-moves-to-equal-array-elements-ii/)|Medium| |463|[island-perimeter](https://leetcode.com/problems/island-perimeter)|||Easy| |464|[can-i-win](https://leetcode.com/problems/can-i-win)|||Medium| @@ -461,18 +464,18 @@ If you are loving solving problems in leetcode, please contact me to enjoy it to |469|[convex-polygon](https://leetcode.com/problems/convex-polygon)|:lock:||Medium| |471|[encode-string-with-shortest-length](https://leetcode.com/problems/encode-string-with-shortest-length)|:lock:||Hard| |472|[concatenated-words](https://leetcode.com/problems/concatenated-words)|||Hard| -|473|[matchsticks-to-square](https://leetcode.com/problems/matchsticks-to-square)|||Medium| +|473|[matchsticks-to-square](https://leetcode.com/problems/matchsticks-to-square)||[:memo:](https://leetcode.com/articles/matchsticks-to-square/)|Medium| |474|[ones-and-zeroes](https://leetcode.com/problems/ones-and-zeroes)||[:memo:](https://leetcode.com/articles/ones-and-zeroes/)|Medium| |475|[heaters](https://leetcode.com/problems/heaters)|||Easy| |476|[number-complement](https://leetcode.com/problems/number-complement)|||Easy| |477|[total-hamming-distance](https://leetcode.com/problems/total-hamming-distance)||[:memo:](https://leetcode.com/articles/total-hamming-distance/)|Medium| -|479|[largest-palindrome-product](https://leetcode.com/problems/largest-palindrome-product)|||Easy| +|479|[largest-palindrome-product](https://leetcode.com/problems/largest-palindrome-product)|||Hard| |480|[sliding-window-median](https://leetcode.com/problems/sliding-window-median)||[:memo:](https://leetcode.com/articles/sliding-window-median/)|Hard| |481|[magical-string](https://leetcode.com/problems/magical-string)|||Medium| |482|[license-key-formatting](https://leetcode.com/problems/license-key-formatting)|||Easy| |483|[smallest-good-base](https://leetcode.com/problems/smallest-good-base)|||Hard| |484|[find-permutation](https://leetcode.com/problems/find-permutation)|:lock:|[:memo:](https://leetcode.com/articles/find-permutation/)|Medium| -|485|[max-consecutive-ones](https://leetcode.com/problems/max-consecutive-ones)|[Python](https://github.com/bonfy/leetcode/blob/master/485-max-consecutive-ones/max-consecutive-ones.py)||Easy| +|485|[max-consecutive-ones](https://leetcode.com/problems/max-consecutive-ones)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0485-max-consecutive-ones/max-consecutive-ones.py)||Easy| |486|[predict-the-winner](https://leetcode.com/problems/predict-the-winner)||[:memo:](https://leetcode.com/articles/predict-the-winner/)|Medium| |487|[max-consecutive-ones-ii](https://leetcode.com/problems/max-consecutive-ones-ii)|:lock:||Medium| |488|[zuma-game](https://leetcode.com/problems/zuma-game)|||Hard| @@ -481,31 +484,34 @@ If you are loving solving problems in leetcode, please contact me to enjoy it to |492|[construct-the-rectangle](https://leetcode.com/problems/construct-the-rectangle)|||Easy| |493|[reverse-pairs](https://leetcode.com/problems/reverse-pairs)||[:memo:](https://leetcode.com/articles/reverse-pairs/)|Hard| |494|[target-sum](https://leetcode.com/problems/target-sum)||[:memo:](https://leetcode.com/articles/target-sum/)|Medium| -|495|[teemo-attacking](https://leetcode.com/problems/teemo-attacking)|||Medium| +|495|[teemo-attacking](https://leetcode.com/problems/teemo-attacking)||[:memo:](https://leetcode.com/articles/teemo-attacking/)|Medium| |496|[next-greater-element-i](https://leetcode.com/problems/next-greater-element-i)||[:memo:](https://leetcode.com/articles/greater-element-i/)|Easy| |498|[diagonal-traverse](https://leetcode.com/problems/diagonal-traverse)|||Medium| |499|[the-maze-iii](https://leetcode.com/problems/the-maze-iii)|:lock:||Hard| |500|[keyboard-row](https://leetcode.com/problems/keyboard-row)|||Easy| |501|[find-mode-in-binary-search-tree](https://leetcode.com/problems/find-mode-in-binary-search-tree)|||Easy| -|502|[ipo](https://leetcode.com/problems/ipo)|||Hard| +|502|[ipo](https://leetcode.com/problems/ipo)||[:memo:](https://leetcode.com/articles/ipo/)|Hard| |503|[next-greater-element-ii](https://leetcode.com/problems/next-greater-element-ii)||[:memo:](https://leetcode.com/articles/next-greater-element-ii/)|Medium| |504|[base-7](https://leetcode.com/problems/base-7)|||Easy| |505|[the-maze-ii](https://leetcode.com/problems/the-maze-ii)|:lock:|[:memo:](https://leetcode.com/articles/the-maze-ii/)|Medium| -|506|[relative-ranks](https://leetcode.com/problems/relative-ranks)|[Python](https://github.com/bonfy/leetcode/blob/master/506-relative-ranks/relative-ranks.py)||Easy| +|506|[relative-ranks](https://leetcode.com/problems/relative-ranks)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0506-relative-ranks/relative-ranks.py)||Easy| |507|[perfect-number](https://leetcode.com/problems/perfect-number)||[:memo:](https://leetcode.com/articles/perfect-number/)|Easy| |508|[most-frequent-subtree-sum](https://leetcode.com/problems/most-frequent-subtree-sum)|||Medium| +|509|[inorder-successor-in-bst-ii](https://leetcode.com/problems/inorder-successor-in-bst-ii)|:lock:|[:memo:](https://leetcode.com/articles/inorder-successor-in-a-bst-ii/)|Medium| +|511|[all-paths-from-source-lead-to-destination](https://leetcode.com/problems/all-paths-from-source-lead-to-destination)|:lock:||Medium| |513|[find-bottom-left-tree-value](https://leetcode.com/problems/find-bottom-left-tree-value)|||Medium| |514|[freedom-trail](https://leetcode.com/problems/freedom-trail)|||Hard| |515|[find-largest-value-in-each-tree-row](https://leetcode.com/problems/find-largest-value-in-each-tree-row)|||Medium| |516|[longest-palindromic-subsequence](https://leetcode.com/problems/longest-palindromic-subsequence)|||Medium| -|517|[super-washing-machines](https://leetcode.com/problems/super-washing-machines)|||Hard| +|517|[super-washing-machines](https://leetcode.com/problems/super-washing-machines)||[:memo:](https://leetcode.com/articles/super-washing-machines/)|Hard| +|518|[coin-change-2](https://leetcode.com/problems/coin-change-2)|||Medium| |520|[detect-capital](https://leetcode.com/problems/detect-capital)|||Easy| |521|[longest-uncommon-subsequence-i](https://leetcode.com/problems/longest-uncommon-subsequence-i)||[:memo:](https://leetcode.com/articles/longest-uncommon-subsequence-i/)|Easy| |522|[longest-uncommon-subsequence-ii](https://leetcode.com/problems/longest-uncommon-subsequence-ii)||[:memo:](https://leetcode.com/articles/longest-uncommon-subsequence-ii/)|Medium| |523|[continuous-subarray-sum](https://leetcode.com/problems/continuous-subarray-sum)||[:memo:](https://leetcode.com/articles/continous-subarray-sum/)|Medium| |524|[longest-word-in-dictionary-through-deleting](https://leetcode.com/problems/longest-word-in-dictionary-through-deleting)||[:memo:](https://leetcode.com/articles/longest-word-in-dictionary-through-deletion/)|Medium| |525|[contiguous-array](https://leetcode.com/problems/contiguous-array)||[:memo:](https://leetcode.com/articles/contiguous-array/)|Medium| -|526|[beautiful-arrangement](https://leetcode.com/problems/beautiful-arrangement)|[Python](https://github.com/bonfy/leetcode/blob/master/526-beautiful-arrangement/beautiful-arrangement.py)|[:memo:](https://leetcode.com/articles/beautiful-arrangement/)|Medium| +|526|[beautiful-arrangement](https://leetcode.com/problems/beautiful-arrangement)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/0526-beautiful-arrangement/beautiful-arrangement.py)|[:memo:](https://leetcode.com/articles/beautiful-arrangement/)|Medium| |527|[word-abbreviation](https://leetcode.com/problems/word-abbreviation)|:lock:|[:memo:](https://leetcode.com/articles/word-abbreviation/)|Hard| |529|[minesweeper](https://leetcode.com/problems/minesweeper)|||Medium| |530|[minimum-absolute-difference-in-bst](https://leetcode.com/problems/minimum-absolute-difference-in-bst)|||Easy| @@ -574,7 +580,7 @@ If you are loving solving problems in leetcode, please contact me to enjoy it to |629|[k-inverse-pairs-array](https://leetcode.com/problems/k-inverse-pairs-array)||[:memo:](https://leetcode.com/articles/k-inverse-pairs-array/)|Hard| |630|[course-schedule-iii](https://leetcode.com/problems/course-schedule-iii)||[:memo:](https://leetcode.com/articles/course-schedule-iii/)|Hard| |631|[design-excel-sum-formula](https://leetcode.com/problems/design-excel-sum-formula)|:lock:|[:memo:](https://leetcode.com/articles/design-excel-sum-formula/)|Hard| -|632|[smallest-range](https://leetcode.com/problems/smallest-range)||[:memo:](https://leetcode.com/articles/smallest-range/)|Hard| +|632|[smallest-range-covering-elements-from-k-lists](https://leetcode.com/problems/smallest-range-covering-elements-from-k-lists)||[:memo:](https://leetcode.com/articles/smallest-range/)|Hard| |633|[sum-of-square-numbers](https://leetcode.com/problems/sum-of-square-numbers)||[:memo:](https://leetcode.com/articles/sum-of-square-numbers/)|Easy| |634|[find-the-derangement-of-an-array](https://leetcode.com/problems/find-the-derangement-of-an-array)|:lock:|[:memo:](https://leetcode.com/articles/find-derangements/)|Medium| |635|[design-log-storage-system](https://leetcode.com/problems/design-log-storage-system)|:lock:|[:memo:](https://leetcode.com/articles/design-log-storage/)|Medium| @@ -598,7 +604,7 @@ If you are loving solving problems in leetcode, please contact me to enjoy it to |654|[maximum-binary-tree](https://leetcode.com/problems/maximum-binary-tree)||[:memo:](https://leetcode.com/articles/maximum-binary-tree/)|Medium| |655|[print-binary-tree](https://leetcode.com/problems/print-binary-tree)||[:memo:](https://leetcode.com/articles/print-binary-tree/)|Medium| |656|[coin-path](https://leetcode.com/problems/coin-path)|:lock:|[:memo:](https://leetcode.com/articles/coin-path/)|Hard| -|657|[judge-route-circle](https://leetcode.com/problems/judge-route-circle)||[:memo:](https://leetcode.com/articles/judge-route-circle/)|Easy| +|657|[robot-return-to-origin](https://leetcode.com/problems/robot-return-to-origin)||[:memo:](https://leetcode.com/articles/judge-route-circle/)|Easy| |658|[find-k-closest-elements](https://leetcode.com/problems/find-k-closest-elements)||[:memo:](https://leetcode.com/articles/find-k-closest-elements/)|Medium| |659|[split-array-into-consecutive-subsequences](https://leetcode.com/problems/split-array-into-consecutive-subsequences)||[:memo:](https://leetcode.com/articles/split-array-into-consecutive-subsequences/)|Medium| |660|[remove-9](https://leetcode.com/problems/remove-9)|:lock:|[:memo:](https://leetcode.com/articles/remove-9/)|Hard| @@ -636,7 +642,7 @@ If you are loving solving problems in leetcode, please contact me to enjoy it to |692|[top-k-frequent-words](https://leetcode.com/problems/top-k-frequent-words)||[:memo:](https://leetcode.com/articles/top-k-frequent-words/)|Medium| |693|[binary-number-with-alternating-bits](https://leetcode.com/problems/binary-number-with-alternating-bits)||[:memo:](https://leetcode.com/articles/binary-number-with-alternating-bits/)|Easy| |694|[number-of-distinct-islands](https://leetcode.com/problems/number-of-distinct-islands)|:lock:|[:memo:](https://leetcode.com/articles/number-of-distinct-islands/)|Medium| -|695|[max-area-of-island](https://leetcode.com/problems/max-area-of-island)||[:memo:](https://leetcode.com/articles/max-area-of-island/)|Easy| +|695|[max-area-of-island](https://leetcode.com/problems/max-area-of-island)||[:memo:](https://leetcode.com/articles/max-area-of-island/)|Medium| |696|[count-binary-substrings](https://leetcode.com/problems/count-binary-substrings)||[:memo:](https://leetcode.com/articles/count-binary-substrings/)|Easy| |697|[degree-of-an-array](https://leetcode.com/problems/degree-of-an-array)||[:memo:](https://leetcode.com/articles/degree-of-an-array/)|Easy| |698|[partition-to-k-equal-sum-subsets](https://leetcode.com/problems/partition-to-k-equal-sum-subsets)||[:memo:](https://leetcode.com/articles/partition-to-k-equal-sum-subsets/)|Medium| @@ -646,7 +652,7 @@ If you are loving solving problems in leetcode, please contact me to enjoy it to |713|[subarray-product-less-than-k](https://leetcode.com/problems/subarray-product-less-than-k)||[:memo:](https://leetcode.com/articles/subarray-product-less-than-k/)|Medium| |714|[best-time-to-buy-and-sell-stock-with-transaction-fee](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee)||[:memo:](https://leetcode.com/articles/best-time-to-buy-and-sell-stock-with-transaction-fee/)|Medium| |715|[range-module](https://leetcode.com/problems/range-module)||[:memo:](https://leetcode.com/articles/range-module/)|Hard| -|716|[max-stack](https://leetcode.com/problems/max-stack)|:lock:|[:memo:](https://leetcode.com/articles/max-stack/)|Hard| +|716|[max-stack](https://leetcode.com/problems/max-stack)|:lock:|[:memo:](https://leetcode.com/articles/max-stack/)|Easy| |717|[1-bit-and-2-bit-characters](https://leetcode.com/problems/1-bit-and-2-bit-characters)||[:memo:](https://leetcode.com/articles/1-bit-and-2-bit-characters/)|Easy| |718|[maximum-length-of-repeated-subarray](https://leetcode.com/problems/maximum-length-of-repeated-subarray)||[:memo:](https://leetcode.com/articles/maximum-length-of-repeated-subarray/)|Medium| |719|[find-k-th-smallest-pair-distance](https://leetcode.com/problems/find-k-th-smallest-pair-distance)||[:memo:](https://leetcode.com/articles/find-k-th-smallest-pair-distance/)|Hard| @@ -672,41 +678,57 @@ If you are loving solving problems in leetcode, please contact me to enjoy it to |739|[daily-temperatures](https://leetcode.com/problems/daily-temperatures)||[:memo:](https://leetcode.com/articles/daily-temperatures/)|Medium| |740|[delete-and-earn](https://leetcode.com/problems/delete-and-earn)||[:memo:](https://leetcode.com/articles/delete-and-earn/)|Medium| |741|[cherry-pickup](https://leetcode.com/problems/cherry-pickup)||[:memo:](https://leetcode.com/articles/cherry-pickup/)|Hard| +|742|[to-lower-case](https://leetcode.com/problems/to-lower-case)|||Easy| |743|[closest-leaf-in-a-binary-tree](https://leetcode.com/problems/closest-leaf-in-a-binary-tree)|:lock:|[:memo:](https://leetcode.com/articles/closest-leaf-in-binary-tree/)|Medium| |744|[network-delay-time](https://leetcode.com/problems/network-delay-time)||[:memo:](https://leetcode.com/articles/network-delay-time/)|Medium| |745|[find-smallest-letter-greater-than-target](https://leetcode.com/problems/find-smallest-letter-greater-than-target)||[:memo:](https://leetcode.com/articles/find-smallest-letter-greater-than-target/)|Easy| |746|[prefix-and-suffix-search](https://leetcode.com/problems/prefix-and-suffix-search)||[:memo:](https://leetcode.com/articles/prefix-and-suffix-search/)|Hard| |747|[min-cost-climbing-stairs](https://leetcode.com/problems/min-cost-climbing-stairs)||[:memo:](https://leetcode.com/articles/min-cost-climbing-stairs/)|Easy| |748|[largest-number-at-least-twice-of-others](https://leetcode.com/problems/largest-number-at-least-twice-of-others)||[:memo:](https://leetcode.com/articles/largest-number-at-least-twice-of-others/)|Easy| -|749|[shortest-completing-word](https://leetcode.com/problems/shortest-completing-word)||[:memo:](https://leetcode.com/articles/shortest-completing-word/)|Medium| +|749|[shortest-completing-word](https://leetcode.com/problems/shortest-completing-word)||[:memo:](https://leetcode.com/articles/shortest-completing-word/)|Easy| |750|[contain-virus](https://leetcode.com/problems/contain-virus)||[:memo:](https://leetcode.com/articles/contain-virus/)|Hard| |751|[number-of-corner-rectangles](https://leetcode.com/problems/number-of-corner-rectangles)|:lock:|[:memo:](https://leetcode.com/articles/number-of-corner-rectangles/)|Medium| |752|[ip-to-cidr](https://leetcode.com/problems/ip-to-cidr)|:lock:|[:memo:](https://leetcode.com/articles/ip-to-cidr/)|Easy| |753|[open-the-lock](https://leetcode.com/problems/open-the-lock)||[:memo:](https://leetcode.com/articles/open-the-lock/)|Medium| |754|[cracking-the-safe](https://leetcode.com/problems/cracking-the-safe)||[:memo:](https://leetcode.com/articles/cracking-the-safe/)|Hard| -|755|[reach-a-number](https://leetcode.com/problems/reach-a-number)||[:memo:](https://leetcode.com/articles/reach-a-number/)|Medium| +|755|[reach-a-number](https://leetcode.com/problems/reach-a-number)||[:memo:](https://leetcode.com/articles/reach-a-number/)|Easy| |756|[pour-water](https://leetcode.com/problems/pour-water)|:lock:|[:memo:](https://leetcode.com/articles/pour-water/)|Medium| |757|[pyramid-transition-matrix](https://leetcode.com/problems/pyramid-transition-matrix)||[:memo:](https://leetcode.com/articles/pyramid-transition-matrix/)|Medium| +|758|[convert-binary-search-tree-to-sorted-doubly-linked-list](https://leetcode.com/problems/convert-binary-search-tree-to-sorted-doubly-linked-list)|:lock:|[:memo:](https://leetcode.com/articles/convert-binary-search-tree-to-sorted-doubly-linked/)|Medium| |759|[set-intersection-size-at-least-two](https://leetcode.com/problems/set-intersection-size-at-least-two)||[:memo:](https://leetcode.com/articles/set-intersection-size-at-least-two/)|Hard| |760|[bold-words-in-string](https://leetcode.com/problems/bold-words-in-string)|:lock:|[:memo:](https://leetcode.com/articles/bold-words-in-string/)|Easy| |761|[employee-free-time](https://leetcode.com/problems/employee-free-time)|:lock:|[:memo:](https://leetcode.com/articles/employee-free-time/)|Hard| |762|[find-anagram-mappings](https://leetcode.com/problems/find-anagram-mappings)|:lock:|[:memo:](https://leetcode.com/articles/find-anagram-mappings/)|Easy| |763|[special-binary-string](https://leetcode.com/problems/special-binary-string)||[:memo:](https://leetcode.com/articles/special-binary-string/)|Hard| +|764|[n-ary-tree-level-order-traversal](https://leetcode.com/problems/n-ary-tree-level-order-traversal)|||Easy| +|765|[serialize-and-deserialize-n-ary-tree](https://leetcode.com/problems/serialize-and-deserialize-n-ary-tree)|:lock:||Hard| +|766|[flatten-a-multilevel-doubly-linked-list](https://leetcode.com/problems/flatten-a-multilevel-doubly-linked-list)|||Medium| |767|[prime-number-of-set-bits-in-binary-representation](https://leetcode.com/problems/prime-number-of-set-bits-in-binary-representation)||[:memo:](https://leetcode.com/articles/prime-number-of-set-bits-in-binary-representation/)|Easy| |768|[partition-labels](https://leetcode.com/problems/partition-labels)||[:memo:](https://leetcode.com/articles/partition-labels/)|Medium| |769|[largest-plus-sign](https://leetcode.com/problems/largest-plus-sign)||[:memo:](https://leetcode.com/articles/largest-plus-sign/)|Medium| |770|[couples-holding-hands](https://leetcode.com/problems/couples-holding-hands)||[:memo:](https://leetcode.com/articles/couples-holding-hands/)|Hard| +|771|[encode-n-ary-tree-to-binary-tree](https://leetcode.com/problems/encode-n-ary-tree-to-binary-tree)|:lock:||Hard| +|772|[construct-quad-tree](https://leetcode.com/problems/construct-quad-tree)|||Medium| +|773|[quad-tree-intersection](https://leetcode.com/problems/quad-tree-intersection)|||Easy| +|774|[maximum-depth-of-n-ary-tree](https://leetcode.com/problems/maximum-depth-of-n-ary-tree)||[:memo:](https://leetcode.com/articles/maximum-depth-of-n-ary-tree/)|Easy| +|775|[n-ary-tree-preorder-traversal](https://leetcode.com/problems/n-ary-tree-preorder-traversal)||[:memo:](https://leetcode.com/articles/n-ary-tree-preorder-traversal/)|Easy| +|776|[n-ary-tree-postorder-traversal](https://leetcode.com/problems/n-ary-tree-postorder-traversal)||[:memo:](https://leetcode.com/articles/n-ary-tree-postorder-transversal/)|Easy| |777|[toeplitz-matrix](https://leetcode.com/problems/toeplitz-matrix)||[:memo:](https://leetcode.com/articles/toeplitz-matrix/)|Easy| |778|[reorganize-string](https://leetcode.com/problems/reorganize-string)||[:memo:](https://leetcode.com/articles/reorganized-string/)|Medium| |779|[max-chunks-to-make-sorted-ii](https://leetcode.com/problems/max-chunks-to-make-sorted-ii)||[:memo:](https://leetcode.com/articles/max-chunks-to-make-sorted-ii/)|Hard| |780|[max-chunks-to-make-sorted](https://leetcode.com/problems/max-chunks-to-make-sorted)||[:memo:](https://leetcode.com/articles/max-chunks-to-make-sorted-i/)|Medium| |781|[basic-calculator-iv](https://leetcode.com/problems/basic-calculator-iv)||[:memo:](https://leetcode.com/articles/basic-calculator-iv/)|Hard| |782|[jewels-and-stones](https://leetcode.com/problems/jewels-and-stones)||[:memo:](https://leetcode.com/articles/jewels-and-stones/)|Easy| +|783|[search-in-a-binary-search-tree](https://leetcode.com/problems/search-in-a-binary-search-tree)|||Easy| +|784|[insert-into-a-binary-search-tree](https://leetcode.com/problems/insert-into-a-binary-search-tree)||[:memo:](https://leetcode.com/articles/insert-into-a-bst/)|Medium| |785|[basic-calculator-iii](https://leetcode.com/problems/basic-calculator-iii)|:lock:||Hard| +|786|[search-in-a-sorted-array-of-unknown-size](https://leetcode.com/problems/search-in-a-sorted-array-of-unknown-size)|:lock:||Medium| |787|[sliding-puzzle](https://leetcode.com/problems/sliding-puzzle)||[:memo:](https://leetcode.com/articles/sliding-puzzle/)|Hard| |788|[minimize-max-distance-to-gas-station](https://leetcode.com/problems/minimize-max-distance-to-gas-station)|:lock:|[:memo:](https://leetcode.com/articles/minimize-max-distance-to-gas-station/)|Hard| +|789|[kth-largest-element-in-a-stream](https://leetcode.com/problems/kth-largest-element-in-a-stream)|||Easy| |790|[global-and-local-inversions](https://leetcode.com/problems/global-and-local-inversions)||[:memo:](https://leetcode.com/articles/global-and-local-inversions/)|Medium| |791|[split-bst](https://leetcode.com/problems/split-bst)|:lock:|[:memo:](https://leetcode.com/articles/split-bst/)|Medium| +|792|[binary-search](https://leetcode.com/problems/binary-search)||[:memo:](https://leetcode.com/articles/binary-search/)|Easy| |793|[swap-adjacent-in-lr-string](https://leetcode.com/problems/swap-adjacent-in-lr-string)||[:memo:](https://leetcode.com/articles/swap-adjacent-in-lr-string/)|Medium| |794|[swim-in-rising-water](https://leetcode.com/problems/swim-in-rising-water)||[:memo:](https://leetcode.com/articles/swim-in-rising-water/)|Hard| |795|[k-th-symbol-in-grammar](https://leetcode.com/problems/k-th-symbol-in-grammar)||[:memo:](https://leetcode.com/articles/k-th-symbol-in-grammar/)|Medium| @@ -730,6 +752,8 @@ If you are loving solving problems in leetcode, please contact me to enjoy it to |813|[all-paths-from-source-to-target](https://leetcode.com/problems/all-paths-from-source-to-target)||[:memo:](https://leetcode.com/articles/all-paths-from-source-to-target/)|Medium| |814|[smallest-rotation-with-highest-score](https://leetcode.com/problems/smallest-rotation-with-highest-score)||[:memo:](https://leetcode.com/articles/smallest-rotation-with-highest-score/)|Hard| |815|[champagne-tower](https://leetcode.com/problems/champagne-tower)||[:memo:](https://leetcode.com/articles/champagne-tower/)|Medium| +|816|[design-hashset](https://leetcode.com/problems/design-hashset)|||Easy| +|817|[design-hashmap](https://leetcode.com/problems/design-hashmap)|||Easy| |818|[similar-rgb-color](https://leetcode.com/problems/similar-rgb-color)|:lock:|[:memo:](https://leetcode.com/articles/similar-rgb-color/)|Easy| |819|[minimum-swaps-to-make-sequences-increasing](https://leetcode.com/problems/minimum-swaps-to-make-sequences-increasing)||[:memo:](https://leetcode.com/articles/minimum-swaps-to-make-sequences-increasing/)|Medium| |820|[find-eventual-safe-states](https://leetcode.com/problems/find-eventual-safe-states)||[:memo:](https://leetcode.com/articles/find-eventual-safe-states/)|Medium| @@ -750,3 +774,329 @@ If you are loving solving problems in leetcode, please contact me to enjoy it to |835|[linked-list-components](https://leetcode.com/problems/linked-list-components)||[:memo:](https://leetcode.com/articles/linked-list-components/)|Medium| |836|[race-car](https://leetcode.com/problems/race-car)||[:memo:](https://leetcode.com/articles/race-car/)|Hard| |837|[most-common-word](https://leetcode.com/problems/most-common-word)||[:memo:](https://leetcode.com/articles/most-common-word/)|Easy| +|838|[design-linked-list](https://leetcode.com/problems/design-linked-list)|||Easy| +|839|[short-encoding-of-words](https://leetcode.com/problems/short-encoding-of-words)||[:memo:](https://leetcode.com/articles/short-encoding-of-words/)|Medium| +|841|[shortest-distance-to-a-character](https://leetcode.com/problems/shortest-distance-to-a-character)||[:memo:](https://leetcode.com/articles/shortest-distance-to-a-character/)|Easy| +|842|[card-flipping-game](https://leetcode.com/problems/card-flipping-game)||[:memo:](https://leetcode.com/articles/card-flipping-game/)|Medium| +|843|[binary-trees-with-factors](https://leetcode.com/problems/binary-trees-with-factors)||[:memo:](https://leetcode.com/articles/binary-trees-with-factors/)|Medium| +|850|[insert-into-a-cyclic-sorted-list](https://leetcode.com/problems/insert-into-a-cyclic-sorted-list)|:lock:||Medium| +|851|[goat-latin](https://leetcode.com/problems/goat-latin)||[:memo:](https://leetcode.com/articles/goat-latin/)|Easy| +|852|[friends-of-appropriate-ages](https://leetcode.com/problems/friends-of-appropriate-ages)||[:memo:](https://leetcode.com/articles/friends-of-appropriate-ages/)|Medium| +|853|[most-profit-assigning-work](https://leetcode.com/problems/most-profit-assigning-work)||[:memo:](https://leetcode.com/articles/most-profit-assigning-work/)|Medium| +|854|[making-a-large-island](https://leetcode.com/problems/making-a-large-island)||[:memo:](https://leetcode.com/articles/making-a-large-island/)|Hard| +|855|[unique-letter-string](https://leetcode.com/problems/unique-letter-string)||[:memo:](https://leetcode.com/articles/unique-letter-string/)|Hard| +|856|[consecutive-numbers-sum](https://leetcode.com/problems/consecutive-numbers-sum)||[:memo:](https://leetcode.com/articles/consecutive-numbers-sum/)|Hard| +|857|[positions-of-large-groups](https://leetcode.com/problems/positions-of-large-groups)||[:memo:](https://leetcode.com/articles/positions-of-large-groups/)|Easy| +|858|[masking-personal-information](https://leetcode.com/problems/masking-personal-information)||[:memo:](https://leetcode.com/articles/masking-personal-information/)|Medium| +|859|[design-circular-deque](https://leetcode.com/problems/design-circular-deque)|||Medium| +|860|[design-circular-queue](https://leetcode.com/problems/design-circular-queue)|||Medium| +|861|[flipping-an-image](https://leetcode.com/problems/flipping-an-image)||[:memo:](https://leetcode.com/articles/flipping-an-image/)|Easy| +|862|[find-and-replace-in-string](https://leetcode.com/problems/find-and-replace-in-string)||[:memo:](https://leetcode.com/articles/find-and-replace-in-string/)|Medium| +|863|[sum-of-distances-in-tree](https://leetcode.com/problems/sum-of-distances-in-tree)||[:memo:](https://leetcode.com/articles/sum-of-distances-in-tree/)|Hard| +|864|[image-overlap](https://leetcode.com/problems/image-overlap)||[:memo:](https://leetcode.com/articles/image-overlap/)|Medium| +|865|[robot-room-cleaner](https://leetcode.com/problems/robot-room-cleaner)|:lock:|[:memo:](https://leetcode.com/articles/robot-room-cleaner/)|Hard| +|866|[rectangle-overlap](https://leetcode.com/problems/rectangle-overlap)||[:memo:](https://leetcode.com/articles/rectangle-overlap/)|Easy| +|867|[new-21-game](https://leetcode.com/problems/new-21-game)||[:memo:](https://leetcode.com/articles/new-21-game/)|Medium| +|868|[push-dominoes](https://leetcode.com/problems/push-dominoes)||[:memo:](https://leetcode.com/articles/push-dominoes/)|Medium| +|869|[similar-string-groups](https://leetcode.com/problems/similar-string-groups)||[:memo:](https://leetcode.com/articles/similar-string-groups/)|Hard| +|870|[magic-squares-in-grid](https://leetcode.com/problems/magic-squares-in-grid)||[:memo:](https://leetcode.com/articles/magic-squares-in-grid/)|Easy| +|871|[keys-and-rooms](https://leetcode.com/problems/keys-and-rooms)||[:memo:](https://leetcode.com/articles/keys-and-rooms/)|Medium| +|872|[split-array-into-fibonacci-sequence](https://leetcode.com/problems/split-array-into-fibonacci-sequence)||[:memo:](https://leetcode.com/articles/split-array-into-fibonacci-sequence/)|Medium| +|873|[guess-the-word](https://leetcode.com/problems/guess-the-word)||[:memo:](https://leetcode.com/articles/guess-the-word/)|Hard| +|874|[backspace-string-compare](https://leetcode.com/problems/backspace-string-compare)||[:memo:](https://leetcode.com/articles/backspace-string-compare/)|Easy| +|875|[longest-mountain-in-array](https://leetcode.com/problems/longest-mountain-in-array)||[:memo:](https://leetcode.com/articles/longest-mountain-in-array/)|Medium| +|876|[hand-of-straights](https://leetcode.com/problems/hand-of-straights)||[:memo:](https://leetcode.com/articles/hand-of-straights/)|Medium| +|877|[shortest-path-visiting-all-nodes](https://leetcode.com/problems/shortest-path-visiting-all-nodes)||[:memo:](https://leetcode.com/articles/shortest-path-visiting-all-nodes/)|Hard| +|878|[shifting-letters](https://leetcode.com/problems/shifting-letters)||[:memo:](https://leetcode.com/articles/shifting-letters/)|Medium| +|879|[maximize-distance-to-closest-person](https://leetcode.com/problems/maximize-distance-to-closest-person)||[:memo:](https://leetcode.com/articles/maximize-distance-to-closest-person/)|Easy| +|880|[rectangle-area-ii](https://leetcode.com/problems/rectangle-area-ii)||[:memo:](https://leetcode.com/articles/rectangle-area-ii/)|Hard| +|881|[loud-and-rich](https://leetcode.com/problems/loud-and-rich)||[:memo:](https://leetcode.com/articles/loud-and-rich/)|Medium| +|882|[peak-index-in-a-mountain-array](https://leetcode.com/problems/peak-index-in-a-mountain-array)||[:memo:](https://leetcode.com/articles/peak-index-in-a-mountain-array/)|Easy| +|883|[car-fleet](https://leetcode.com/problems/car-fleet)||[:memo:](https://leetcode.com/articles/car-fleet/)|Medium| +|884|[k-similar-strings](https://leetcode.com/problems/k-similar-strings)||[:memo:](https://leetcode.com/articles/k-similar-strings/)|Hard| +|885|[exam-room](https://leetcode.com/problems/exam-room)||[:memo:](https://leetcode.com/articles/exam-room/)|Medium| +|886|[score-of-parentheses](https://leetcode.com/problems/score-of-parentheses)||[:memo:](https://leetcode.com/articles/score-of-parentheses/)|Medium| +|887|[minimum-cost-to-hire-k-workers](https://leetcode.com/problems/minimum-cost-to-hire-k-workers)||[:memo:](https://leetcode.com/articles/minimum-cost-to-hire-k-workers/)|Hard| +|888|[mirror-reflection](https://leetcode.com/problems/mirror-reflection)||[:memo:](https://leetcode.com/articles/mirror-reflection/)|Medium| +|889|[buddy-strings](https://leetcode.com/problems/buddy-strings)||[:memo:](https://leetcode.com/articles/buddy-strings/)|Easy| +|890|[lemonade-change](https://leetcode.com/problems/lemonade-change)||[:memo:](https://leetcode.com/articles/lemonade-change/)|Easy| +|891|[score-after-flipping-matrix](https://leetcode.com/problems/score-after-flipping-matrix)||[:memo:](https://leetcode.com/articles/score-after-flipping-matrix/)|Medium| +|892|[shortest-subarray-with-sum-at-least-k](https://leetcode.com/problems/shortest-subarray-with-sum-at-least-k)||[:memo:](https://leetcode.com/articles/shortest-subarray-with-sum-atleast-k/)|Hard| +|893|[all-nodes-distance-k-in-binary-tree](https://leetcode.com/problems/all-nodes-distance-k-in-binary-tree)||[:memo:](https://leetcode.com/articles/all-nodes-distance-k-in-binary-tree/)|Medium| +|894|[random-pick-with-blacklist](https://leetcode.com/problems/random-pick-with-blacklist)||[:memo:](https://leetcode.com/articles/random-pick-with-blacklist/)|Hard| +|895|[shortest-path-to-get-all-keys](https://leetcode.com/problems/shortest-path-to-get-all-keys)||[:memo:](https://leetcode.com/articles/shortest-path-to-get-all-keys/)|Hard| +|896|[smallest-subtree-with-all-the-deepest-nodes](https://leetcode.com/problems/smallest-subtree-with-all-the-deepest-nodes)||[:memo:](https://leetcode.com/articles/smallest-subtree-with-all-the-deepest-nodes/)|Medium| +|897|[prime-palindrome](https://leetcode.com/problems/prime-palindrome)||[:memo:](https://leetcode.com/articles/prime-palindrome/)|Medium| +|898|[transpose-matrix](https://leetcode.com/problems/transpose-matrix)||[:memo:](https://leetcode.com/articles/transpose-matrix/)|Easy| +|899|[binary-gap](https://leetcode.com/problems/binary-gap)||[:memo:](https://leetcode.com/articles/binary-gap/)|Easy| +|900|[reordered-power-of-2](https://leetcode.com/problems/reordered-power-of-2)||[:memo:](https://leetcode.com/articles/reordered-power-of-2/)|Medium| +|901|[advantage-shuffle](https://leetcode.com/problems/advantage-shuffle)||[:memo:](https://leetcode.com/articles/advantage-shuffle/)|Medium| +|902|[minimum-number-of-refueling-stops](https://leetcode.com/problems/minimum-number-of-refueling-stops)||[:memo:](https://leetcode.com/articles/minimum-number-of-refueling-stops/)|Hard| +|903|[implement-rand10-using-rand7](https://leetcode.com/problems/implement-rand10-using-rand7)||[:memo:](https://leetcode.com/articles/implement-rand10-using-rand7/)|Medium| +|904|[leaf-similar-trees](https://leetcode.com/problems/leaf-similar-trees)||[:memo:](https://leetcode.com/articles/leaf-similar-trees/)|Easy| +|905|[length-of-longest-fibonacci-subsequence](https://leetcode.com/problems/length-of-longest-fibonacci-subsequence)||[:memo:](https://leetcode.com/articles/length-of-longest-fibonacci-subsequence/)|Medium| +|906|[walking-robot-simulation](https://leetcode.com/problems/walking-robot-simulation)||[:memo:](https://leetcode.com/articles/walking-robot-simulation/)|Easy| +|907|[koko-eating-bananas](https://leetcode.com/problems/koko-eating-bananas)||[:memo:](https://leetcode.com/articles/koko-eating-bananas/)|Medium| +|908|[middle-of-the-linked-list](https://leetcode.com/problems/middle-of-the-linked-list)||[:memo:](https://leetcode.com/articles/middle-of-the-linked-list/)|Easy| +|909|[stone-game](https://leetcode.com/problems/stone-game)||[:memo:](https://leetcode.com/articles/stone-game/)|Medium| +|910|[nth-magical-number](https://leetcode.com/problems/nth-magical-number)||[:memo:](https://leetcode.com/articles/nth-magical-number/)|Hard| +|911|[profitable-schemes](https://leetcode.com/problems/profitable-schemes)||[:memo:](https://leetcode.com/articles/profitable-schemes/)|Hard| +|912|[random-pick-with-weight](https://leetcode.com/problems/random-pick-with-weight)||[:memo:](https://leetcode.com/articles/random-pick-with-weight/)|Medium| +|913|[random-flip-matrix](https://leetcode.com/problems/random-flip-matrix)||[:memo:](https://leetcode.com/articles/random-flip-matrix/)|Medium| +|914|[random-point-in-non-overlapping-rectangles](https://leetcode.com/problems/random-point-in-non-overlapping-rectangles)||[:memo:](https://leetcode.com/articles/random-point-in-non-overlapping-rectangles/)|Medium| +|915|[generate-random-point-in-a-circle](https://leetcode.com/problems/generate-random-point-in-a-circle)||[:memo:](https://leetcode.com/articles/generate-random-point-in-a-circle/)|Medium| +|916|[decoded-string-at-index](https://leetcode.com/problems/decoded-string-at-index)||[:memo:](https://leetcode.com/articles/decoded-string-at-index/)|Medium| +|917|[boats-to-save-people](https://leetcode.com/problems/boats-to-save-people)||[:memo:](https://leetcode.com/articles/boats-to-save-people/)|Medium| +|918|[reachable-nodes-in-subdivided-graph](https://leetcode.com/problems/reachable-nodes-in-subdivided-graph)||[:memo:](https://leetcode.com/articles/reachable-nodes-in-subdivided-graph/)|Hard| +|919|[projection-area-of-3d-shapes](https://leetcode.com/problems/projection-area-of-3d-shapes)||[:memo:](https://leetcode.com/articles/projection-area-of-3d-shapes/)|Easy| +|920|[uncommon-words-from-two-sentences](https://leetcode.com/problems/uncommon-words-from-two-sentences)||[:memo:](https://leetcode.com/articles/uncommon-words-from-two-sentences/)|Easy| +|921|[spiral-matrix-iii](https://leetcode.com/problems/spiral-matrix-iii)||[:memo:](https://leetcode.com/articles/spiral-matrix-iii/)|Medium| +|922|[possible-bipartition](https://leetcode.com/problems/possible-bipartition)||[:memo:](https://leetcode.com/articles/possible-bipartition/)|Medium| +|923|[super-egg-drop](https://leetcode.com/problems/super-egg-drop)||[:memo:](https://leetcode.com/articles/super-egg-drop/)|Hard| +|924|[fair-candy-swap](https://leetcode.com/problems/fair-candy-swap)||[:memo:](https://leetcode.com/articles/fair-candy-swap/)|Easy| +|925|[construct-binary-tree-from-preorder-and-postorder-traversal](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-postorder-traversal)||[:memo:](https://leetcode.com/articles/construct-binary-tree-from-preorder-and-postorder-/)|Medium| +|926|[find-and-replace-pattern](https://leetcode.com/problems/find-and-replace-pattern)||[:memo:](https://leetcode.com/articles/find-and-replace-pattern/)|Medium| +|927|[sum-of-subsequence-widths](https://leetcode.com/problems/sum-of-subsequence-widths)||[:memo:](https://leetcode.com/articles/sum-of-subsequence-widths/)|Hard| +|928|[surface-area-of-3d-shapes](https://leetcode.com/problems/surface-area-of-3d-shapes)||[:memo:](https://leetcode.com/articles/surface-area-of-3d-shapes/)|Easy| +|929|[groups-of-special-equivalent-strings](https://leetcode.com/problems/groups-of-special-equivalent-strings)||[:memo:](https://leetcode.com/articles/groups-of-special-equivalent-strings/)|Easy| +|930|[all-possible-full-binary-trees](https://leetcode.com/problems/all-possible-full-binary-trees)||[:memo:](https://leetcode.com/articles/all-possible-full-binary-trees/)|Medium| +|931|[maximum-frequency-stack](https://leetcode.com/problems/maximum-frequency-stack)||[:memo:](https://leetcode.com/articles/maximum-frequency-stack/)|Hard| +|932|[monotonic-array](https://leetcode.com/problems/monotonic-array)||[:memo:](https://leetcode.com/articles/monotonic-array/)|Easy| +|933|[increasing-order-search-tree](https://leetcode.com/problems/increasing-order-search-tree)||[:memo:](https://leetcode.com/articles/increasing-order-search-tree/)|Easy| +|934|[bitwise-ors-of-subarrays](https://leetcode.com/problems/bitwise-ors-of-subarrays)||[:memo:](https://leetcode.com/articles/bitwise-ors-of-subarrays/)|Medium| +|935|[orderly-queue](https://leetcode.com/problems/orderly-queue)||[:memo:](https://leetcode.com/articles/orderly-queue/)|Hard| +|936|[rle-iterator](https://leetcode.com/problems/rle-iterator)||[:memo:](https://leetcode.com/articles/rle-iterator/)|Medium| +|937|[online-stock-span](https://leetcode.com/problems/online-stock-span)||[:memo:](https://leetcode.com/articles/online-stock-span/)|Medium| +|938|[numbers-at-most-n-given-digit-set](https://leetcode.com/problems/numbers-at-most-n-given-digit-set)||[:memo:](https://leetcode.com/articles/numbers-at-most-n-given-digit-set/)|Hard| +|939|[valid-permutations-for-di-sequence](https://leetcode.com/problems/valid-permutations-for-di-sequence)||[:memo:](https://leetcode.com/articles/valid-permutations-for-di-sequence/)|Hard| +|940|[fruit-into-baskets](https://leetcode.com/problems/fruit-into-baskets)||[:memo:](https://leetcode.com/articles/fruit-into-baskets/)|Medium| +|941|[sort-array-by-parity](https://leetcode.com/problems/sort-array-by-parity)||[:memo:](https://leetcode.com/articles/sort-array-by-parity/)|Easy| +|942|[super-palindromes](https://leetcode.com/problems/super-palindromes)||[:memo:](https://leetcode.com/articles/super-palindromes/)|Hard| +|943|[sum-of-subarray-minimums](https://leetcode.com/problems/sum-of-subarray-minimums)||[:memo:](https://leetcode.com/articles/sum-of-subarray-minimums/)|Medium| +|944|[smallest-range-i](https://leetcode.com/problems/smallest-range-i)||[:memo:](https://leetcode.com/articles/smallest-range-i/)|Easy| +|945|[snakes-and-ladders](https://leetcode.com/problems/snakes-and-ladders)||[:memo:](https://leetcode.com/articles/snakes-and-ladders/)|Medium| +|946|[smallest-range-ii](https://leetcode.com/problems/smallest-range-ii)||[:memo:](https://leetcode.com/articles/smallest-range-ii/)|Medium| +|947|[online-election](https://leetcode.com/problems/online-election)||[:memo:](https://leetcode.com/articles/online-election/)|Medium| +|948|[sort-an-array](https://leetcode.com/problems/sort-an-array)|||Medium| +|949|[cat-and-mouse](https://leetcode.com/problems/cat-and-mouse)||[:memo:](https://leetcode.com/articles/cat-and-mouse-game/)|Hard| +|950|[x-of-a-kind-in-a-deck-of-cards](https://leetcode.com/problems/x-of-a-kind-in-a-deck-of-cards)||[:memo:](https://leetcode.com/articles/x-of-a-kind-in-a-deck-of-cards/)|Easy| +|951|[partition-array-into-disjoint-intervals](https://leetcode.com/problems/partition-array-into-disjoint-intervals)||[:memo:](https://leetcode.com/articles/parition-array-into-disjoint-intervals/)|Medium| +|952|[word-subsets](https://leetcode.com/problems/word-subsets)||[:memo:](https://leetcode.com/articles/word-subsets/)|Medium| +|953|[reverse-only-letters](https://leetcode.com/problems/reverse-only-letters)||[:memo:](https://leetcode.com/articles/reverse-only-letters/)|Easy| +|954|[maximum-sum-circular-subarray](https://leetcode.com/problems/maximum-sum-circular-subarray)||[:memo:](https://leetcode.com/articles/maximum-sub-circular-subarray/)|Medium| +|955|[complete-binary-tree-inserter](https://leetcode.com/problems/complete-binary-tree-inserter)||[:memo:](https://leetcode.com/articles/complete-binary-tree-inserter/)|Medium| +|956|[number-of-music-playlists](https://leetcode.com/problems/number-of-music-playlists)||[:memo:](https://leetcode.com/articles/number-of-music-playlists/)|Hard| +|957|[minimum-add-to-make-parentheses-valid](https://leetcode.com/problems/minimum-add-to-make-parentheses-valid)||[:memo:](https://leetcode.com/articles/minimum-add-to-make-parentheses-valid/)|Medium| +|958|[sort-array-by-parity-ii](https://leetcode.com/problems/sort-array-by-parity-ii)||[:memo:](https://leetcode.com/articles/sort-array-by-parity-ii/)|Easy| +|959|[3sum-with-multiplicity](https://leetcode.com/problems/3sum-with-multiplicity)||[:memo:](https://leetcode.com/articles/3sum-with-multiplicity/)|Medium| +|960|[minimize-malware-spread](https://leetcode.com/problems/minimize-malware-spread)||[:memo:](https://leetcode.com/articles/minimize-malware-spread/)|Hard| +|961|[long-pressed-name](https://leetcode.com/problems/long-pressed-name)||[:memo:](https://leetcode.com/articles/long-pressed-name/)|Easy| +|962|[flip-string-to-monotone-increasing](https://leetcode.com/problems/flip-string-to-monotone-increasing)||[:memo:](https://leetcode.com/articles/flip-string-to-monotone-increasing/)|Medium| +|963|[three-equal-parts](https://leetcode.com/problems/three-equal-parts)||[:memo:](https://leetcode.com/articles/three-equal-parts/)|Hard| +|964|[minimize-malware-spread-ii](https://leetcode.com/problems/minimize-malware-spread-ii)||[:memo:](https://leetcode.com/articles/minimize-malware-spread-ii/)|Hard| +|965|[unique-email-addresses](https://leetcode.com/problems/unique-email-addresses)||[:memo:](https://leetcode.com/articles/unique-email-addresses/)|Easy| +|966|[binary-subarrays-with-sum](https://leetcode.com/problems/binary-subarrays-with-sum)||[:memo:](https://leetcode.com/articles/binary-subarrays-with-sum/)|Medium| +|967|[minimum-falling-path-sum](https://leetcode.com/problems/minimum-falling-path-sum)||[:memo:](https://leetcode.com/articles/minimum-path-falling-sum/)|Medium| +|968|[beautiful-array](https://leetcode.com/problems/beautiful-array)||[:memo:](https://leetcode.com/articles/beautiful-array/)|Medium| +|969|[number-of-recent-calls](https://leetcode.com/problems/number-of-recent-calls)||[:memo:](https://leetcode.com/articles/number-of-recent-calls/)|Easy| +|971|[shortest-bridge](https://leetcode.com/problems/shortest-bridge)||[:memo:](https://leetcode.com/articles/shortest-bridge/)|Medium| +|972|[knight-dialer](https://leetcode.com/problems/knight-dialer)||[:memo:](https://leetcode.com/articles/knight-dialer/)|Medium| +|973|[stamping-the-sequence](https://leetcode.com/problems/stamping-the-sequence)||[:memo:](https://leetcode.com/articles/stamping-the-sequence/)|Hard| +|974|[reorder-log-files](https://leetcode.com/problems/reorder-log-files)||[:memo:](https://leetcode.com/articles/reorder-log-files/)|Easy| +|975|[range-sum-of-bst](https://leetcode.com/problems/range-sum-of-bst)||[:memo:](https://leetcode.com/articles/range-sum-of-bst/)|Easy| +|976|[minimum-area-rectangle](https://leetcode.com/problems/minimum-area-rectangle)||[:memo:](https://leetcode.com/articles/minimum-area-rectangle/)|Medium| +|977|[distinct-subsequences-ii](https://leetcode.com/problems/distinct-subsequences-ii)||[:memo:](https://leetcode.com/articles/distinct-subsequences-ii/)|Hard| +|978|[valid-mountain-array](https://leetcode.com/problems/valid-mountain-array)||[:memo:](https://leetcode.com/articles/valid-mountain-array/)|Easy| +|979|[di-string-match](https://leetcode.com/problems/di-string-match)||[:memo:](https://leetcode.com/articles/di-string-match/)|Easy| +|980|[find-the-shortest-superstring](https://leetcode.com/problems/find-the-shortest-superstring)||[:memo:](https://leetcode.com/articles/find-the-shortest-superstring/)|Hard| +|981|[delete-columns-to-make-sorted](https://leetcode.com/problems/delete-columns-to-make-sorted)||[:memo:](https://leetcode.com/articles/delete-columns-to-make-sorted/)|Easy| +|982|[minimum-increment-to-make-array-unique](https://leetcode.com/problems/minimum-increment-to-make-array-unique)||[:memo:](https://leetcode.com/articles/minimum-increment-to-make-array-unique/)|Medium| +|983|[validate-stack-sequences](https://leetcode.com/problems/validate-stack-sequences)||[:memo:](https://leetcode.com/articles/validate-stack-sequences/)|Medium| +|984|[most-stones-removed-with-same-row-or-column](https://leetcode.com/problems/most-stones-removed-with-same-row-or-column)||[:memo:](https://leetcode.com/articles/most-stones-removed-with-same-row-or-column/)|Medium| +|985|[bag-of-tokens](https://leetcode.com/problems/bag-of-tokens)||[:memo:](https://leetcode.com/articles/bag-of-tokens/)|Medium| +|986|[largest-time-for-given-digits](https://leetcode.com/problems/largest-time-for-given-digits)||[:memo:](https://leetcode.com/articles/largest-time-for-given-digits/)|Easy| +|987|[reveal-cards-in-increasing-order](https://leetcode.com/problems/reveal-cards-in-increasing-order)||[:memo:](https://leetcode.com/articles/reveal-cards-in-increasing-order/)|Medium| +|988|[flip-equivalent-binary-trees](https://leetcode.com/problems/flip-equivalent-binary-trees)||[:memo:](https://leetcode.com/articles/flip-equivalent-binary-trees/)|Medium| +|989|[largest-component-size-by-common-factor](https://leetcode.com/problems/largest-component-size-by-common-factor)||[:memo:](https://leetcode.com/articles/largest-component-size-by-common-factor/)|Hard| +|990|[verifying-an-alien-dictionary](https://leetcode.com/problems/verifying-an-alien-dictionary)||[:memo:](https://leetcode.com/articles/verifying-an-alien-dictionary/)|Easy| +|991|[array-of-doubled-pairs](https://leetcode.com/problems/array-of-doubled-pairs)||[:memo:](https://leetcode.com/articles/array-of-doubled-pairs/)|Medium| +|992|[delete-columns-to-make-sorted-ii](https://leetcode.com/problems/delete-columns-to-make-sorted-ii)||[:memo:](https://leetcode.com/articles/delete-columns-to-make-sorted-ii/)|Medium| +|993|[tallest-billboard](https://leetcode.com/problems/tallest-billboard)||[:memo:](https://leetcode.com/articles/tallest-billboard/)|Hard| +|994|[prison-cells-after-n-days](https://leetcode.com/problems/prison-cells-after-n-days)||[:memo:](https://leetcode.com/articles/prison-cells-after-n-days/)|Medium| +|998|[check-completeness-of-a-binary-tree](https://leetcode.com/problems/check-completeness-of-a-binary-tree)||[:memo:](https://leetcode.com/articles/check-completeness-of-a-binary-tree/)|Medium| +|999|[regions-cut-by-slashes](https://leetcode.com/problems/regions-cut-by-slashes)||[:memo:](https://leetcode.com/articles/regions-cut-by-slashes/)|Medium| +|1000|[delete-columns-to-make-sorted-iii](https://leetcode.com/problems/delete-columns-to-make-sorted-iii)||[:memo:](https://leetcode.com/articles/delete-columns-to-make-sorted-iii/)|Hard| +|1001|[n-repeated-element-in-size-2n-array](https://leetcode.com/problems/n-repeated-element-in-size-2n-array)||[:memo:](https://leetcode.com/articles/n-repeated-element-in-size-2n-array/)|Easy| +|1002|[maximum-width-ramp](https://leetcode.com/problems/maximum-width-ramp)||[:memo:](https://leetcode.com/articles/maximum-width-ramp/)|Medium| +|1003|[minimum-area-rectangle-ii](https://leetcode.com/problems/minimum-area-rectangle-ii)||[:memo:](https://leetcode.com/articles/minimum-area-rectangle-ii/)|Medium| +|1004|[least-operators-to-express-number](https://leetcode.com/problems/least-operators-to-express-number)||[:memo:](https://leetcode.com/articles/least-operators-to-express-number/)|Hard| +|1005|[univalued-binary-tree](https://leetcode.com/problems/univalued-binary-tree)||[:memo:](https://leetcode.com/articles/univalued-binary-tree/)|Easy| +|1006|[vowel-spellchecker](https://leetcode.com/problems/vowel-spellchecker)||[:memo:](https://leetcode.com/articles/vowel-spellchecker/)|Medium| +|1007|[numbers-with-same-consecutive-differences](https://leetcode.com/problems/numbers-with-same-consecutive-differences)||[:memo:](https://leetcode.com/articles/numbers-with-same-consecutive-differences/)|Medium| +|1008|[binary-tree-cameras](https://leetcode.com/problems/binary-tree-cameras)||[:memo:](https://leetcode.com/articles/binary-tree-cameras/)|Hard| +|1009|[pancake-sorting](https://leetcode.com/problems/pancake-sorting)||[:memo:](https://leetcode.com/articles/pancake-sorting/)|Medium| +|1010|[powerful-integers](https://leetcode.com/problems/powerful-integers)||[:memo:](https://leetcode.com/articles/powerful-integers/)|Easy| +|1011|[flip-binary-tree-to-match-preorder-traversal](https://leetcode.com/problems/flip-binary-tree-to-match-preorder-traversal)||[:memo:](https://leetcode.com/articles/flip-binary-tree-to-match-preorder-traversal/)|Medium| +|1012|[equal-rational-numbers](https://leetcode.com/problems/equal-rational-numbers)||[:memo:](https://leetcode.com/articles/equal-rational-numbers/)|Hard| +|1013|[fibonacci-number](https://leetcode.com/problems/fibonacci-number)||[:memo:](https://leetcode.com/articles/fibonacci-number/)|Easy| +|1014|[k-closest-points-to-origin](https://leetcode.com/problems/k-closest-points-to-origin)||[:memo:](https://leetcode.com/articles/k-closest-points-to-origin/)|Medium| +|1016|[subarray-sums-divisible-by-k](https://leetcode.com/problems/subarray-sums-divisible-by-k)||[:memo:](https://leetcode.com/articles/subarray-sums-divisible-by-k/)|Medium| +|1017|[odd-even-jump](https://leetcode.com/problems/odd-even-jump)||[:memo:](https://leetcode.com/articles/odd-even-jump/)|Hard| +|1018|[largest-perimeter-triangle](https://leetcode.com/problems/largest-perimeter-triangle)||[:memo:](https://leetcode.com/articles/largest-perimeter-triangle/)|Easy| +|1019|[squares-of-a-sorted-array](https://leetcode.com/problems/squares-of-a-sorted-array)||[:memo:](https://leetcode.com/articles/squares-of-a-sorted-array/)|Easy| +|1020|[longest-turbulent-subarray](https://leetcode.com/problems/longest-turbulent-subarray)||[:memo:](https://leetcode.com/articles/longest-turbulent-subarray/)|Medium| +|1021|[distribute-coins-in-binary-tree](https://leetcode.com/problems/distribute-coins-in-binary-tree)||[:memo:](https://leetcode.com/articles/distribute-coins-in-binary-tree/)|Medium| +|1022|[unique-paths-iii](https://leetcode.com/problems/unique-paths-iii)||[:memo:](https://leetcode.com/articles/unique-paths-iii/)|Hard| +|1023|[time-based-key-value-store](https://leetcode.com/problems/time-based-key-value-store)||[:memo:](https://leetcode.com/articles/time-based-key-value-store/)|Medium| +|1024|[triples-with-bitwise-and-equal-to-zero](https://leetcode.com/problems/triples-with-bitwise-and-equal-to-zero)|||Hard| +|1025|[minimum-cost-for-tickets](https://leetcode.com/problems/minimum-cost-for-tickets)||[:memo:](https://leetcode.com/articles/minimum-cost-for-tickets/)|Medium| +|1026|[string-without-aaa-or-bbb](https://leetcode.com/problems/string-without-aaa-or-bbb)||[:memo:](https://leetcode.com/articles/string-without-aaa-or-bbb/)|Medium| +|1027|[sum-of-even-numbers-after-queries](https://leetcode.com/problems/sum-of-even-numbers-after-queries)||[:memo:](https://leetcode.com/articles/sum-of-even-numbers-after-queries/)|Easy| +|1028|[interval-list-intersections](https://leetcode.com/problems/interval-list-intersections)||[:memo:](https://leetcode.com/articles/interval-list-intersections/)|Medium| +|1029|[vertical-order-traversal-of-a-binary-tree](https://leetcode.com/problems/vertical-order-traversal-of-a-binary-tree)||[:memo:](https://leetcode.com/articles/vertical-order-traversal-of-a-binary-tree/)|Medium| +|1030|[smallest-string-starting-from-leaf](https://leetcode.com/problems/smallest-string-starting-from-leaf)||[:memo:](https://leetcode.com/articles/smallest-string-starting-from-leaf/)|Medium| +|1031|[add-to-array-form-of-integer](https://leetcode.com/problems/add-to-array-form-of-integer)||[:memo:](https://leetcode.com/articles/add-to-array-form-of-integer/)|Easy| +|1032|[satisfiability-of-equality-equations](https://leetcode.com/problems/satisfiability-of-equality-equations)||[:memo:](https://leetcode.com/articles/satisfiability-of-equality-equations/)|Medium| +|1033|[broken-calculator](https://leetcode.com/problems/broken-calculator)||[:memo:](https://leetcode.com/articles/broken-calculator/)|Medium| +|1034|[subarrays-with-k-different-integers](https://leetcode.com/problems/subarrays-with-k-different-integers)||[:memo:](https://leetcode.com/articles/subarrays-with-k-different-integers/)|Hard| +|1035|[cousins-in-binary-tree](https://leetcode.com/problems/cousins-in-binary-tree)||[:memo:](https://leetcode.com/articles/cousins-in-binary-tree/)|Easy| +|1036|[rotting-oranges](https://leetcode.com/problems/rotting-oranges)||[:memo:](https://leetcode.com/articles/rotting-oranges/)|Easy| +|1037|[minimum-number-of-k-consecutive-bit-flips](https://leetcode.com/problems/minimum-number-of-k-consecutive-bit-flips)||[:memo:](https://leetcode.com/articles/minimum-number-of-k-consecutive-bit-flips/)|Hard| +|1038|[number-of-squareful-arrays](https://leetcode.com/problems/number-of-squareful-arrays)||[:memo:](https://leetcode.com/articles/number-of-squareful-arrays/)|Hard| +|1039|[find-the-town-judge](https://leetcode.com/problems/find-the-town-judge)|||Easy| +|1040|[maximum-binary-tree-ii](https://leetcode.com/problems/maximum-binary-tree-ii)|||Medium| +|1041|[available-captures-for-rook](https://leetcode.com/problems/available-captures-for-rook)|||Easy| +|1042|[minimum-cost-to-merge-stones](https://leetcode.com/problems/minimum-cost-to-merge-stones)|||Hard| +|1043|[grid-illumination](https://leetcode.com/problems/grid-illumination)|||Hard| +|1044|[find-common-characters](https://leetcode.com/problems/find-common-characters)|||Easy| +|1045|[check-if-word-is-valid-after-substitutions](https://leetcode.com/problems/check-if-word-is-valid-after-substitutions)|||Medium| +|1046|[max-consecutive-ones-iii](https://leetcode.com/problems/max-consecutive-ones-iii)|||Medium| +|1047|[maximize-sum-of-array-after-k-negations](https://leetcode.com/problems/maximize-sum-of-array-after-k-negations)|||Easy| +|1048|[clumsy-factorial](https://leetcode.com/problems/clumsy-factorial)|||Medium| +|1049|[minimum-domino-rotations-for-equal-row](https://leetcode.com/problems/minimum-domino-rotations-for-equal-row)||[:memo:](https://leetcode.com/articles/minimum-domino-rotations-for-equal-row/)|Medium| +|1050|[construct-binary-search-tree-from-preorder-traversal](https://leetcode.com/problems/construct-binary-search-tree-from-preorder-traversal)||[:memo:](https://leetcode.com/articles/construct-bst-from-preorder-traversal/)|Medium| +|1051|[shortest-way-to-form-string](https://leetcode.com/problems/shortest-way-to-form-string)|:lock:||Medium| +|1052|[campus-bikes](https://leetcode.com/problems/campus-bikes)|:lock:||Medium| +|1053|[minimize-rounding-error-to-meet-target](https://leetcode.com/problems/minimize-rounding-error-to-meet-target)|:lock:||Medium| +|1054|[complement-of-base-10-integer](https://leetcode.com/problems/complement-of-base-10-integer)|||Easy| +|1055|[pairs-of-songs-with-total-durations-divisible-by-60](https://leetcode.com/problems/pairs-of-songs-with-total-durations-divisible-by-60)|||Easy| +|1056|[capacity-to-ship-packages-within-d-days](https://leetcode.com/problems/capacity-to-ship-packages-within-d-days)|||Medium| +|1057|[numbers-with-repeated-digits](https://leetcode.com/problems/numbers-with-repeated-digits)|||Hard| +|1058|[lexicographically-smallest-equivalent-string](https://leetcode.com/problems/lexicographically-smallest-equivalent-string)|:lock:||Medium| +|1059|[missing-element-in-sorted-array](https://leetcode.com/problems/missing-element-in-sorted-array)|:lock:|[:memo:](https://leetcode.com/articles/missing-element-in-sorted-array/)|Medium| +|1060|[longest-repeating-substring](https://leetcode.com/problems/longest-repeating-substring)|:lock:|[:memo:](https://leetcode.com/articles/longest-repeating-substring/)|Medium| +|1061|[number-of-valid-subarrays](https://leetcode.com/problems/number-of-valid-subarrays)|:lock:||Hard| +|1062|[partition-array-into-three-parts-with-equal-sum](https://leetcode.com/problems/partition-array-into-three-parts-with-equal-sum)|||Easy| +|1063|[best-sightseeing-pair](https://leetcode.com/problems/best-sightseeing-pair)|||Medium| +|1064|[smallest-integer-divisible-by-k](https://leetcode.com/problems/smallest-integer-divisible-by-k)|||Medium| +|1065|[binary-string-with-substrings-representing-1-to-n](https://leetcode.com/problems/binary-string-with-substrings-representing-1-to-n)|[Python](https://github.com/bonfy/leetcode/blob/master/solutions/1065-binary-string-with-substrings-representing-1-to-n/binary-string-with-substrings-representing-1-to-n.py)||Medium| +|1066|[fixed-point](https://leetcode.com/problems/fixed-point)|:lock:||Easy| +|1067|[campus-bikes-ii](https://leetcode.com/problems/campus-bikes-ii)|:lock:||Medium| +|1068|[digit-count-in-range](https://leetcode.com/problems/digit-count-in-range)|:lock:||Hard| +|1069|[confusing-number](https://leetcode.com/problems/confusing-number)|:lock:||Easy| +|1070|[convert-to-base-2](https://leetcode.com/problems/convert-to-base-2)|||Medium| +|1071|[binary-prefix-divisible-by-5](https://leetcode.com/problems/binary-prefix-divisible-by-5)|||Easy| +|1072|[next-greater-node-in-linked-list](https://leetcode.com/problems/next-greater-node-in-linked-list)|||Medium| +|1073|[number-of-enclaves](https://leetcode.com/problems/number-of-enclaves)|||Medium| +|1074|[high-five](https://leetcode.com/problems/high-five)|:lock:||Easy| +|1075|[index-pairs-of-a-string](https://leetcode.com/problems/index-pairs-of-a-string)|:lock:||Easy| +|1076|[brace-expansion](https://leetcode.com/problems/brace-expansion)|:lock:||Medium| +|1077|[confusing-number-ii](https://leetcode.com/problems/confusing-number-ii)|:lock:||Hard| +|1078|[remove-outermost-parentheses](https://leetcode.com/problems/remove-outermost-parentheses)|||Easy| +|1079|[sum-of-root-to-leaf-binary-numbers](https://leetcode.com/problems/sum-of-root-to-leaf-binary-numbers)|||Easy| +|1080|[camelcase-matching](https://leetcode.com/problems/camelcase-matching)|||Medium| +|1081|[video-stitching](https://leetcode.com/problems/video-stitching)|||Medium| +|1082|[sum-of-digits-in-the-minimum-number](https://leetcode.com/problems/sum-of-digits-in-the-minimum-number)|:lock:||Easy| +|1083|[two-sum-less-than-k](https://leetcode.com/problems/two-sum-less-than-k)|:lock:||Easy| +|1084|[find-k-length-substrings-with-no-repeated-characters](https://leetcode.com/problems/find-k-length-substrings-with-no-repeated-characters)|:lock:||Medium| +|1085|[the-earliest-moment-when-everyone-become-friends](https://leetcode.com/problems/the-earliest-moment-when-everyone-become-friends)|:lock:||Medium| +|1086|[divisor-game](https://leetcode.com/problems/divisor-game)|||Easy| +|1087|[longest-arithmetic-sequence](https://leetcode.com/problems/longest-arithmetic-sequence)|||Medium| +|1088|[number-of-days-in-a-month](https://leetcode.com/problems/number-of-days-in-a-month)|:lock:||Easy| +|1089|[remove-vowels-from-a-string](https://leetcode.com/problems/remove-vowels-from-a-string)|:lock:||Easy| +|1090|[armstrong-number](https://leetcode.com/problems/armstrong-number)|:lock:||Easy| +|1091|[maximum-average-subtree](https://leetcode.com/problems/maximum-average-subtree)|:lock:||Medium| +|1092|[maximum-difference-between-node-and-ancestor](https://leetcode.com/problems/maximum-difference-between-node-and-ancestor)|||Medium| +|1093|[recover-a-tree-from-preorder-traversal](https://leetcode.com/problems/recover-a-tree-from-preorder-traversal)|||Hard| +|1094|[matrix-cells-in-distance-order](https://leetcode.com/problems/matrix-cells-in-distance-order)|||Easy| +|1095|[two-city-scheduling](https://leetcode.com/problems/two-city-scheduling)||[:memo:](https://leetcode.com/articles/two-city-scheduling/)|Easy| +|1096|[maximum-sum-of-two-non-overlapping-subarrays](https://leetcode.com/problems/maximum-sum-of-two-non-overlapping-subarrays)|||Medium| +|1097|[stream-of-characters](https://leetcode.com/problems/stream-of-characters)|||Hard| +|1098|[largest-unique-number](https://leetcode.com/problems/largest-unique-number)|:lock:||Easy| +|1099|[path-with-maximum-minimum-value](https://leetcode.com/problems/path-with-maximum-minimum-value)|:lock:||Medium| +|1100|[connecting-cities-with-minimum-cost](https://leetcode.com/problems/connecting-cities-with-minimum-cost)|:lock:||Medium| +|1101|[parallel-courses](https://leetcode.com/problems/parallel-courses)|:lock:||Hard| +|1102|[check-if-a-number-is-majority-element-in-a-sorted-array](https://leetcode.com/problems/check-if-a-number-is-majority-element-in-a-sorted-array)|:lock:||Easy| +|1103|[moving-stones-until-consecutive](https://leetcode.com/problems/moving-stones-until-consecutive)|||Easy| +|1104|[coloring-a-border](https://leetcode.com/problems/coloring-a-border)|||Medium| +|1105|[uncrossed-lines](https://leetcode.com/problems/uncrossed-lines)|||Medium| +|1106|[escape-a-large-maze](https://leetcode.com/problems/escape-a-large-maze)|||Hard| +|1107|[minimum-swaps-to-group-all-1s-together](https://leetcode.com/problems/minimum-swaps-to-group-all-1s-together)|:lock:||Medium| +|1108|[analyze-user-website-visit-pattern](https://leetcode.com/problems/analyze-user-website-visit-pattern)|:lock:||Medium| +|1111|[minimum-score-triangulation-of-polygon](https://leetcode.com/problems/minimum-score-triangulation-of-polygon)|||Medium| +|1112|[find-words-that-can-be-formed-by-characters](https://leetcode.com/problems/find-words-that-can-be-formed-by-characters)|||Easy| +|1113|[moving-stones-until-consecutive-ii](https://leetcode.com/problems/moving-stones-until-consecutive-ii)|||Medium| +|1114|[binary-search-tree-to-greater-sum-tree](https://leetcode.com/problems/binary-search-tree-to-greater-sum-tree)|||Medium| +|1115|[valid-boomerang](https://leetcode.com/problems/valid-boomerang)|||Easy| +|1116|[maximum-level-sum-of-a-binary-tree](https://leetcode.com/problems/maximum-level-sum-of-a-binary-tree)|||Medium| +|1117|[as-far-from-land-as-possible](https://leetcode.com/problems/as-far-from-land-as-possible)|||Medium| +|1118|[divide-array-into-increasing-sequences](https://leetcode.com/problems/divide-array-into-increasing-sequences)|:lock:||Hard| +|1119|[robot-bounded-in-circle](https://leetcode.com/problems/robot-bounded-in-circle)|||Medium| +|1120|[flower-planting-with-no-adjacent](https://leetcode.com/problems/flower-planting-with-no-adjacent)|||Easy| +|1121|[partition-array-for-maximum-sum](https://leetcode.com/problems/partition-array-for-maximum-sum)|||Medium| +|1122|[longest-duplicate-substring](https://leetcode.com/problems/longest-duplicate-substring)||[:memo:](https://leetcode.com/articles/longest-duplicate-substring/)|Hard| +|1124|[string-transforms-into-another-string](https://leetcode.com/problems/string-transforms-into-another-string)|:lock:||Hard| +|1127|[last-stone-weight](https://leetcode.com/problems/last-stone-weight)|||Easy| +|1128|[remove-all-adjacent-duplicates-in-string](https://leetcode.com/problems/remove-all-adjacent-duplicates-in-string)||[:memo:](https://leetcode.com/articles/remove-all-adjacent-duplicates-in-string/)|Easy| +|1129|[longest-string-chain](https://leetcode.com/problems/longest-string-chain)|||Medium| +|1130|[last-stone-weight-ii](https://leetcode.com/problems/last-stone-weight-ii)|||Medium| +|1133|[last-substring-in-lexicographical-order](https://leetcode.com/problems/last-substring-in-lexicographical-order)|||Hard| +|1137|[height-checker](https://leetcode.com/problems/height-checker)|||Easy| +|1138|[grumpy-bookstore-owner](https://leetcode.com/problems/grumpy-bookstore-owner)|||Medium| +|1139|[previous-permutation-with-one-swap](https://leetcode.com/problems/previous-permutation-with-one-swap)|||Medium| +|1140|[distant-barcodes](https://leetcode.com/problems/distant-barcodes)|||Medium| +|1145|[number-of-submatrices-that-sum-to-target](https://leetcode.com/problems/number-of-submatrices-that-sum-to-target)|||Hard| +|1146|[greatest-common-divisor-of-strings](https://leetcode.com/problems/greatest-common-divisor-of-strings)|||Easy| +|1147|[flip-columns-for-maximum-number-of-equal-rows](https://leetcode.com/problems/flip-columns-for-maximum-number-of-equal-rows)|||Medium| +|1148|[adding-two-negabinary-numbers](https://leetcode.com/problems/adding-two-negabinary-numbers)|||Medium| +|1156|[occurrences-after-bigram](https://leetcode.com/problems/occurrences-after-bigram)|||Easy| +|1157|[insufficient-nodes-in-root-to-leaf-paths](https://leetcode.com/problems/insufficient-nodes-in-root-to-leaf-paths)|||Medium| +|1159|[smallest-subsequence-of-distinct-characters](https://leetcode.com/problems/smallest-subsequence-of-distinct-characters)|||Medium| +|1160|[letter-tile-possibilities](https://leetcode.com/problems/letter-tile-possibilities)|||Medium| +|1168|[duplicate-zeros](https://leetcode.com/problems/duplicate-zeros)|||Easy| +|1169|[largest-values-from-labels](https://leetcode.com/problems/largest-values-from-labels)|||Medium| +|1170|[shortest-common-supersequence](https://leetcode.com/problems/shortest-common-supersequence)|||Hard| +|1171|[shortest-path-in-binary-matrix](https://leetcode.com/problems/shortest-path-in-binary-matrix)|||Medium| +|1183|[statistics-from-a-large-sample](https://leetcode.com/problems/statistics-from-a-large-sample)|||Medium| +|1184|[car-pooling](https://leetcode.com/problems/car-pooling)|||Medium| +|1185|[find-in-mountain-array](https://leetcode.com/problems/find-in-mountain-array)|||Hard| +|1188|[brace-expansion-ii](https://leetcode.com/problems/brace-expansion-ii)|||Hard| +|1194|[path-in-zigzag-labelled-binary-tree](https://leetcode.com/problems/path-in-zigzag-labelled-binary-tree)|||Medium| +|1195|[distribute-candies-to-people](https://leetcode.com/problems/distribute-candies-to-people)||[:memo:](https://leetcode.com/articles/distribute-candies-to-people/)|Easy| +|1196|[filling-bookcase-shelves](https://leetcode.com/problems/filling-bookcase-shelves)|||Medium| +|1197|[parsing-a-boolean-expression](https://leetcode.com/problems/parsing-a-boolean-expression)|||Hard| +|1205|[defanging-an-ip-address](https://leetcode.com/problems/defanging-an-ip-address)|||Easy| +|1206|[corporate-flight-bookings](https://leetcode.com/problems/corporate-flight-bookings)|||Medium| +|1207|[delete-nodes-and-return-forest](https://leetcode.com/problems/delete-nodes-and-return-forest)|||Medium| +|1208|[maximum-nesting-depth-of-two-valid-parentheses-strings](https://leetcode.com/problems/maximum-nesting-depth-of-two-valid-parentheses-strings)|||Medium| +|1217|[relative-sort-array](https://leetcode.com/problems/relative-sort-array)|||Easy| +|1218|[lowest-common-ancestor-of-deepest-leaves](https://leetcode.com/problems/lowest-common-ancestor-of-deepest-leaves)|||Medium| +|1219|[longest-well-performing-interval](https://leetcode.com/problems/longest-well-performing-interval)|||Medium| +|1220|[smallest-sufficient-team](https://leetcode.com/problems/smallest-sufficient-team)|||Hard| +|1227|[number-of-equivalent-domino-pairs](https://leetcode.com/problems/number-of-equivalent-domino-pairs)|||Easy| +|1228|[minimum-cost-tree-from-leaf-values](https://leetcode.com/problems/minimum-cost-tree-from-leaf-values)|||Medium| +|1229|[shortest-path-with-alternating-colors](https://leetcode.com/problems/shortest-path-with-alternating-colors)|||Medium| +|1230|[maximum-of-absolute-value-expression](https://leetcode.com/problems/maximum-of-absolute-value-expression)|||Medium| +|1236|[n-th-tribonacci-number](https://leetcode.com/problems/n-th-tribonacci-number)||[:memo:](https://leetcode.com/articles/n-th-tribonacci-number/)|Easy| +|1238|[alphabet-board-path](https://leetcode.com/problems/alphabet-board-path)|||Medium| +|1239|[largest-1-bordered-square](https://leetcode.com/problems/largest-1-bordered-square)|||Medium| +|1240|[stone-game-ii](https://leetcode.com/problems/stone-game-ii)|||Medium| +|1247|[decrease-elements-to-make-array-zigzag](https://leetcode.com/problems/decrease-elements-to-make-array-zigzag)|||Medium| +|1248|[binary-tree-coloring-game](https://leetcode.com/problems/binary-tree-coloring-game)|||Medium| +|1249|[snapshot-array](https://leetcode.com/problems/snapshot-array)|||Medium| +|1250|[longest-common-subsequence](https://leetcode.com/problems/longest-common-subsequence)|||Medium| +|1251|[longest-chunked-palindrome-decomposition](https://leetcode.com/problems/longest-chunked-palindrome-decomposition)|||Hard| +|1260|[day-of-the-year](https://leetcode.com/problems/day-of-the-year)|||Easy| +|1261|[swap-for-longest-repeated-character-substring](https://leetcode.com/problems/swap-for-longest-repeated-character-substring)|||Medium| +|1262|[online-majority-element-in-subarray](https://leetcode.com/problems/online-majority-element-in-subarray)|||Hard| +|1263|[number-of-dice-rolls-with-target-sum](https://leetcode.com/problems/number-of-dice-rolls-with-target-sum)|||Medium| diff --git a/README_leetcode_generate.md b/README_leetcode_generate.md index 521cd1a6..46f76183 100644 --- a/README_leetcode_generate.md +++ b/README_leetcode_generate.md @@ -42,9 +42,9 @@ $ pipenv install ## Config: -Edit your own username, password, language and repo in the **config.cfg** file +Edit your own username, password, language and repo in the **config.cfg.example** file and then rename it to **config.cfg**. -driverpath - Please input the path of your chromedriver +driverpath - Set the path of chromedriver. For Windows users, please include **chromedriver.exe** in path. ``` [leetcode] @@ -89,3 +89,4 @@ Python 2 maybe - 2017-01-02 Fix the bug cause by Leetcode change website: `PHPSESSID` change to `LEETCODE_SESSION` - 2017-04-22 Fix the bug cause by Leetcode change website: csrftoken encrypt, submissions change from HTML to JSON - 2018-04-02 Modify Phantomjs to Chromedriver. Add time.sleep when download otherwise would be forbidden by leetcode. +- 2018-09-27 Fix the login bug caused by Leetcode change its login page \ No newline at end of file diff --git a/config.cfg b/config.cfg.example similarity index 100% rename from config.cfg rename to config.cfg.example diff --git a/leetcode_generate.py b/leetcode_generate.py index 3217cdc3..894ceeef 100755 --- a/leetcode_generate.py +++ b/leetcode_generate.py @@ -6,8 +6,8 @@ # Usage: Leetcode solution downloader and auto generate readme # import requests -import configparser import os +import configparser import json import time import datetime @@ -15,12 +15,16 @@ import sys import html +from pathlib import Path from selenium import webdriver from collections import namedtuple, OrderedDict -HOME = os.getcwd() -CONFIG_FILE = os.path.join(HOME, 'config.cfg') -COOKIE_PATH = 'cookies.json' +HOME = Path.cwd() +MAX_DIGIT_LEN = 4 # 1000+ PROBLEMS +SOLUTION_FOLDER_NAME = 'solutions' +SOLUTION_FOLDER = Path.joinpath(HOME, SOLUTION_FOLDER_NAME) +CONFIG_FILE = Path.joinpath(HOME, 'config.cfg') +COOKIE_PATH = Path.joinpath(HOME, 'cookies.json') BASE_URL = 'https://leetcode.com' # If you have proxy, change PROXIES below PROXIES = None @@ -85,8 +89,9 @@ def rep_unicode_in_code(code): def check_and_make_dir(dirname): - if not os.path.exists(dirname): - os.mkdir(dirname) + p = Path(dirname) + if not p.exists(): + p.mkdir(parents=True) ProgLang = namedtuple('ProgLang', ['language', 'ext', 'annotation']) @@ -102,6 +107,8 @@ def check_and_make_dir(dirname): ProgLang('kotlin', 'kt', '//'), ProgLang('swift', 'swift', '//'), ProgLang('golang', 'go', '//'), + ProgLang('scala', 'scala', '//'), + ProgLang('rust', 'rs', '//'), ] ProgLangDict = dict((item.language, item) for item in ProgLangList) CONFIG = get_config_from_file() @@ -202,10 +209,18 @@ def login(self): chrome_options=options, executable_path=executable_path ) driver.get(LOGIN_URL) - driver.find_element_by_id('id_login').send_keys(usr) - driver.find_element_by_id('id_password').send_keys(pwd) + + # Wait for update + time.sleep(10) + + driver.find_element_by_name('login').send_keys(usr) + driver.find_element_by_name('password').send_keys(pwd) # driver.find_element_by_id('id_remember').click() - driver.find_element_by_xpath('//button[@type="submit"]').click() + btns = driver.find_elements_by_tag_name('button') + # print(btns) + submit_btn = btns[1] + submit_btn.click() + time.sleep(5) webdriver_cookies = driver.get_cookies() driver.close() @@ -282,7 +297,7 @@ def _generate_items_from_api(self, json_data): def is_login(self): """ validate if the cookie exists and not overtime """ api_url = self.base_url + '/api/problems/algorithms/' # NOQA - if not os.path.exists(COOKIE_PATH): + if not COOKIE_PATH.exists(): return False with open(COOKIE_PATH, 'r') as f: @@ -302,13 +317,19 @@ def is_login(self): def load_submissions(self): """ load all submissions from leetcode """ # set limit a big num + print('API load submissions request 2 seconds per request') + print('Please wait ...') limit = 20 offset = 0 + last_key = '' while True: - submissions_url = '{}/api/submissions/?format=json&limit={}&offset={}'.format( - self.base_url, limit, offset + print('try to load submissions from ', offset, ' to ', offset+limit) + submissions_url = '{}/api/submissions/?format=json&limit={}&offset={}&last_key={}'.format( + self.base_url, limit, offset, last_key ) + resp = self.session.get(submissions_url, proxies=PROXIES) + # print(submissions_url, ':', resp.status_code) assert resp.status_code == 200 data = resp.json() if 'has_next' not in data.keys(): @@ -317,6 +338,9 @@ def load_submissions(self): self.submissions += data['submissions_dump'] if data['has_next']: offset += limit + last_key = data['last_key'] + # print('last_key:', last_key) + time.sleep(2.5) else: break @@ -443,15 +467,15 @@ def _download_code_by_quiz(self, quiz): ) return - dirname = '{id}-{title}'.format(id=str(qid).zfill(3), title=qtitle) - print('begin download ' + dirname) - check_and_make_dir(dirname) - path = os.path.join(HOME, dirname) + qname = '{id}-{title}'.format(id=str(qid).zfill(MAX_DIGIT_LEN), title=qtitle) + print('begin download ' + qname) + path = Path.joinpath(SOLUTION_FOLDER, qname) + check_and_make_dir(path) for slt in slts: fname = '{title}.{ext}'.format( title=qtitle, ext=self.prolangdict[slt['lang']].ext ) - filename = os.path.join(path, fname) + filename = Path.joinpath(path, fname) content = self._get_code_with_anno(slt) import codecs @@ -530,8 +554,9 @@ def write_readme(self): language = ':lock:' else: if item.solutions: - dirname = '{id}-{title}'.format( - id=str(item.question_id).zfill(3), + dirname = '{folder}/{id}-{title}'.format( + folder=SOLUTION_FOLDER_NAME, + id=str(item.question_id).zfill(MAX_DIGIT_LEN), title=item.question__title_slug, ) language = '' diff --git a/req.txt b/req.txt index b5dc8fdf..e219be2a 100644 --- a/req.txt +++ b/req.txt @@ -4,6 +4,6 @@ cssselect==1.0.3 idna==2.6 lxml==4.2.1 pyquery==1.4.0 -requests==2.18.4 +requests==2.21.0 selenium==3.11.0 -urllib3==1.22 +urllib3==1.24.1 diff --git a/001-two-sum/two-sum.py b/solutions/0001-two-sum/two-sum.py similarity index 96% rename from 001-two-sum/two-sum.py rename to solutions/0001-two-sum/two-sum.py index 3612fda9..99fe37f4 100644 --- a/001-two-sum/two-sum.py +++ b/solutions/0001-two-sum/two-sum.py @@ -14,8 +14,6 @@ # return [0, 1]. # # -#   -# class Solution(object): diff --git a/solutions/0001-two-sum/two-sum.rs b/solutions/0001-two-sum/two-sum.rs new file mode 100644 index 00000000..74a9b3c8 --- /dev/null +++ b/solutions/0001-two-sum/two-sum.rs @@ -0,0 +1,28 @@ +// Given an array of integers, return indices of the two numbers such that they add up to a specific target. +// +// You may assume that each input would have exactly one solution, and you may not use the same element twice. +// +// Example: +// +// +// Given nums = [2, 7, 11, 15], target = 9, +// +// Because nums[0] + nums[1] = 2 + 7 = 9, +// return [0, 1]. +// +// + + +use std::collections::HashMap; + +impl Solution { + pub fn two_sum(nums: &mut Vec, target: i32) -> Vec { + let mut seen = HashMap::new(); + for (i, num) in nums.iter().enumerate() { + if seen.contains_key(num) { + return vec![seen[num] as i32, i as i32]; + } else { seen.insert(target - num, i); } + } + vec![] + } +} diff --git a/002-add-two-numbers/add-two-numbers.py b/solutions/0002-add-two-numbers/add-two-numbers.py similarity index 96% rename from 002-add-two-numbers/add-two-numbers.py rename to solutions/0002-add-two-numbers/add-two-numbers.py index 4ec28d32..dd33f70f 100644 --- a/002-add-two-numbers/add-two-numbers.py +++ b/solutions/0002-add-two-numbers/add-two-numbers.py @@ -5,8 +5,8 @@ # # You may assume the two numbers do not contain any leading zero, except the number 0 itself. # +# Example: # -# Example # # Input: (2 -> 4 -> 3) + (5 -> 6 -> 4) # Output: 7 -> 0 -> 8 diff --git a/003-longest-substring-without-repeating-characters/longest-substring-without-repeating-characters.py b/solutions/0003-longest-substring-without-repeating-characters/longest-substring-without-repeating-characters.py similarity index 59% rename from 003-longest-substring-without-repeating-characters/longest-substring-without-repeating-characters.py rename to solutions/0003-longest-substring-without-repeating-characters/longest-substring-without-repeating-characters.py index 6ccf2436..0c80cf3c 100644 --- a/003-longest-substring-without-repeating-characters/longest-substring-without-repeating-characters.py +++ b/solutions/0003-longest-substring-without-repeating-characters/longest-substring-without-repeating-characters.py @@ -3,13 +3,37 @@ # Given a string, find the length of the longest substring without repeating characters. # -# Examples: # -# Given "abcabcbb", the answer is "abc", which the length is 3. +# Example 1: +# +# +# Input: "abcabcbb" +# Output: 3 +# Explanation: The answer is "abc", with the length of 3. +# +# +# +# Example 2: +# +# +# Input: "bbbbb" +# Output: 1 +# Explanation: The answer is "b", with the length of 1. +# +# +# +# Example 3: +# +# +# Input: "pwwkew" +# Output: 3 +# Explanation: The answer is "wke", with the length of 3. +# Note that the answer must be a substring, "pwke" is a subsequence and not a substring. +# +# +# # -# Given "bbbbb", the answer is "b", with the length of 1. # -# Given "pwwkew", the answer is "wke", with the length of 3. Note that the answer must be a substring, "pwke" is a subsequence and not a substring. class Solution(object): diff --git a/004-median-of-two-sorted-arrays/median-of-two-sorted-arrays.py b/solutions/0004-median-of-two-sorted-arrays/median-of-two-sorted-arrays.py similarity index 90% rename from 004-median-of-two-sorted-arrays/median-of-two-sorted-arrays.py rename to solutions/0004-median-of-two-sorted-arrays/median-of-two-sorted-arrays.py index 3922932a..e9c94c75 100644 --- a/004-median-of-two-sorted-arrays/median-of-two-sorted-arrays.py +++ b/solutions/0004-median-of-two-sorted-arrays/median-of-two-sorted-arrays.py @@ -5,17 +5,20 @@ # # Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). # +# You may assume nums1 and nums2 cannot be both empty. +# # Example 1: # +# # nums1 = [1, 3] # nums2 = [2] # # The median is 2.0 # # -# # Example 2: # +# # nums1 = [1, 2] # nums2 = [3, 4] # diff --git a/005-longest-palindromic-substring/longest-palindromic-substring.py b/solutions/0005-longest-palindromic-substring/longest-palindromic-substring.py similarity index 100% rename from 005-longest-palindromic-substring/longest-palindromic-substring.py rename to solutions/0005-longest-palindromic-substring/longest-palindromic-substring.py diff --git a/006-zigzag-conversion/zigzag-conversion.py b/solutions/0006-zigzag-conversion/zigzag-conversion.py similarity index 100% rename from 006-zigzag-conversion/zigzag-conversion.py rename to solutions/0006-zigzag-conversion/zigzag-conversion.py diff --git a/007-reverse-integer/reverse-integer.py b/solutions/0007-reverse-integer/reverse-integer.py similarity index 100% rename from 007-reverse-integer/reverse-integer.py rename to solutions/0007-reverse-integer/reverse-integer.py diff --git a/008-string-to-integer-atoi/string-to-integer-atoi.py b/solutions/0008-string-to-integer-atoi/string-to-integer-atoi.py similarity index 84% rename from 008-string-to-integer-atoi/string-to-integer-atoi.py rename to solutions/0008-string-to-integer-atoi/string-to-integer-atoi.py index fbec1edd..51c2ea12 100644 --- a/008-string-to-integer-atoi/string-to-integer-atoi.py +++ b/solutions/0008-string-to-integer-atoi/string-to-integer-atoi.py @@ -12,7 +12,11 @@ # If no valid conversion could be performed, a zero value is returned. # # Note: -# Assume we are dealing with an environment which could only store integers within the 32-bit signed integer range: [−231,  231 − 1]. If the numerical value is out of the range of representable values, INT_MAX (231 − 1) or INT_MIN (−231) is returned. +# +# +# Only the space character ' ' is considered as whitespace character. +# Assume we are dealing with an environment which could only store integers within the 32-bit signed integer range: [−231,  231 − 1]. If the numerical value is out of the range of representable values, INT_MAX (231 − 1) or INT_MIN (−231) is returned. +# # # Example 1: # diff --git a/009-palindrome-number/palindrome-number.py b/solutions/0009-palindrome-number/palindrome-number.py similarity index 100% rename from 009-palindrome-number/palindrome-number.py rename to solutions/0009-palindrome-number/palindrome-number.py diff --git a/010-regular-expression-matching/regular-expression-matching.py b/solutions/0010-regular-expression-matching/regular-expression-matching.py similarity index 92% rename from 010-regular-expression-matching/regular-expression-matching.py rename to solutions/0010-regular-expression-matching/regular-expression-matching.py index 718f1511..6b93bbc4 100644 --- a/010-regular-expression-matching/regular-expression-matching.py +++ b/solutions/0010-regular-expression-matching/regular-expression-matching.py @@ -1,69 +1,69 @@ # -*- coding:utf-8 -*- -# Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'. +# Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'. # # -# '.' Matches any single character. -# '*' Matches zero or more of the preceding element. +# '.' Matches any single character. +# '*' Matches zero or more of the preceding element. # # -# The matching should cover the entire input string (not partial). +# The matching should cover the entire input string (not partial). # -# Note: +# Note: # # -# s could be empty and contains only lowercase letters a-z. -# p could be empty and contains only lowercase letters a-z, and characters like . or *. +# s could be empty and contains only lowercase letters a-z. +# p could be empty and contains only lowercase letters a-z, and characters like . or *. # # -# Example 1: +# Example 1: # # -# Input: -# s = "aa" -# p = "a" -# Output: false -# Explanation: "a" does not match the entire string "aa". +# Input: +# s = "aa" +# p = "a" +# Output: false +# Explanation: "a" does not match the entire string "aa". # # -# Example 2: +# Example 2: # # -# Input: -# s = "aa" -# p = "a*" -# Output: true -# Explanation: '*' means zero or more of the precedeng element, 'a'. Therefore, by repeating 'a' once, it becomes "aa". +# Input: +# s = "aa" +# p = "a*" +# Output: true +# Explanation: '*' means zero or more of the preceding element, 'a'. Therefore, by repeating 'a' once, it becomes "aa". # # -# Example 3: +# Example 3: # # -# Input: -# s = "ab" -# p = ".*" -# Output: true -# Explanation: ".*" means "zero or more (*) of any character (.)". +# Input: +# s = "ab" +# p = ".*" +# Output: true +# Explanation: ".*" means "zero or more (*) of any character (.)". # # -# Example 4: +# Example 4: # # -# Input: -# s = "aab" -# p = "c*a*b" -# Output: true -# Explanation: c can be repeated 0 times, a can be repeated 1 time. Therefore it matches "aab". +# Input: +# s = "aab" +# p = "c*a*b" +# Output: true +# Explanation: c can be repeated 0 times, a can be repeated 1 time. Therefore, it matches "aab". # # -# Example 5: +# Example 5: # # -# Input: -# s = "mississippi" -# p = "mis*is*p*." -# Output: false +# Input: +# s = "mississippi" +# p = "mis*is*p*." +# Output: false # # diff --git a/solutions/0011-container-with-most-water/container-with-most-water.py b/solutions/0011-container-with-most-water/container-with-most-water.py new file mode 100644 index 00000000..4689084b --- /dev/null +++ b/solutions/0011-container-with-most-water/container-with-most-water.py @@ -0,0 +1,38 @@ +# -*- coding:utf-8 -*- + + +# Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a container, such that the container contains the most water. +# +# Note: You may not slant the container and n is at least 2. +# +#   +# +# +# +# The above vertical lines are represented by array [1,8,6,2,5,4,8,3,7]. In this case, the max area of water (blue section) the container can contain is 49. +# +#   +# +# Example: +# +# +# Input: [1,8,6,2,5,4,8,3,7] +# Output: 49 +# + + +class Solution(object): + def maxArea(self, height): + """ + :type height: List[int] + :rtype: int + """ + max_area, i, j = 0, 0, len(height) - 1 + while i < j: + max_area = max(max_area, min(height[i], height[j]) * (j - i)) + if height[i] < height[j]: + i += 1 + else: + j -= 1 + return max_area + diff --git a/012-integer-to-roman/integer-to-roman.py b/solutions/0012-integer-to-roman/integer-to-roman.py similarity index 94% rename from 012-integer-to-roman/integer-to-roman.py rename to solutions/0012-integer-to-roman/integer-to-roman.py index a74041f5..eef08edb 100644 --- a/012-integer-to-roman/integer-to-roman.py +++ b/solutions/0012-integer-to-roman/integer-to-roman.py @@ -48,7 +48,7 @@ # # Input: 58 # Output: "LVIII" -# Explanation: C = 100, L = 50, XXX = 30 and III = 3. +# Explanation: L = 50, V = 5, III = 3. # # # Example 5: diff --git a/013-roman-to-integer/roman-to-integer.py b/solutions/0013-roman-to-integer/roman-to-integer.py similarity index 95% rename from 013-roman-to-integer/roman-to-integer.py rename to solutions/0013-roman-to-integer/roman-to-integer.py index af635b25..6c6230da 100644 --- a/013-roman-to-integer/roman-to-integer.py +++ b/solutions/0013-roman-to-integer/roman-to-integer.py @@ -48,7 +48,7 @@ # # Input: "LVIII" # Output: 58 -# Explanation: C = 100, L = 50, XXX = 30 and III = 3. +# Explanation: L = 50, V= 5, III = 3. # # # Example 5: diff --git a/014-longest-common-prefix/longest-common-prefix.py b/solutions/0014-longest-common-prefix/longest-common-prefix.py similarity index 100% rename from 014-longest-common-prefix/longest-common-prefix.py rename to solutions/0014-longest-common-prefix/longest-common-prefix.py diff --git a/015-3sum/3sum.py b/solutions/0015-3sum/3sum.py similarity index 100% rename from 015-3sum/3sum.py rename to solutions/0015-3sum/3sum.py diff --git a/016-3sum-closest/3sum-closest.py b/solutions/0016-3sum-closest/3sum-closest.py similarity index 100% rename from 016-3sum-closest/3sum-closest.py rename to solutions/0016-3sum-closest/3sum-closest.py diff --git a/017-letter-combinations-of-a-phone-number/letter-combinations-of-a-phone-number.py b/solutions/0017-letter-combinations-of-a-phone-number/letter-combinations-of-a-phone-number.py similarity index 100% rename from 017-letter-combinations-of-a-phone-number/letter-combinations-of-a-phone-number.py rename to solutions/0017-letter-combinations-of-a-phone-number/letter-combinations-of-a-phone-number.py diff --git a/018-4sum/4sum.py b/solutions/0018-4sum/4sum.py similarity index 100% rename from 018-4sum/4sum.py rename to solutions/0018-4sum/4sum.py diff --git a/019-remove-nth-node-from-end-of-list/remove-nth-node-from-end-of-list.py b/solutions/0019-remove-nth-node-from-end-of-list/remove-nth-node-from-end-of-list.py similarity index 100% rename from 019-remove-nth-node-from-end-of-list/remove-nth-node-from-end-of-list.py rename to solutions/0019-remove-nth-node-from-end-of-list/remove-nth-node-from-end-of-list.py diff --git a/020-valid-parentheses/valid-parentheses.py b/solutions/0020-valid-parentheses/valid-parentheses.py similarity index 100% rename from 020-valid-parentheses/valid-parentheses.py rename to solutions/0020-valid-parentheses/valid-parentheses.py diff --git a/021-merge-two-sorted-lists/merge-two-sorted-lists.py b/solutions/0021-merge-two-sorted-lists/merge-two-sorted-lists.py similarity index 100% rename from 021-merge-two-sorted-lists/merge-two-sorted-lists.py rename to solutions/0021-merge-two-sorted-lists/merge-two-sorted-lists.py diff --git a/022-generate-parentheses/generate-parentheses.py b/solutions/0022-generate-parentheses/generate-parentheses.py similarity index 100% rename from 022-generate-parentheses/generate-parentheses.py rename to solutions/0022-generate-parentheses/generate-parentheses.py diff --git a/023-merge-k-sorted-lists/merge-k-sorted-lists.py b/solutions/0023-merge-k-sorted-lists/merge-k-sorted-lists.py similarity index 100% rename from 023-merge-k-sorted-lists/merge-k-sorted-lists.py rename to solutions/0023-merge-k-sorted-lists/merge-k-sorted-lists.py diff --git a/024-swap-nodes-in-pairs/swap-nodes-in-pairs.py b/solutions/0024-swap-nodes-in-pairs/swap-nodes-in-pairs.py similarity index 82% rename from 024-swap-nodes-in-pairs/swap-nodes-in-pairs.py rename to solutions/0024-swap-nodes-in-pairs/swap-nodes-in-pairs.py index 49a4c7bd..af75143f 100644 --- a/024-swap-nodes-in-pairs/swap-nodes-in-pairs.py +++ b/solutions/0024-swap-nodes-in-pairs/swap-nodes-in-pairs.py @@ -3,16 +3,14 @@ # Given a linked list, swap every two adjacent nodes and return its head. # -# Example: -# +# You may not modify the values in the list's nodes, only nodes itself may be changed. # -# Given 1->2->3->4, you should return the list as 2->1->4->3. +#   # -# Note: +# Example: # # -# Your algorithm should use only constant extra space. -# You may not modify the values in the list's nodes, only nodes itself may be changed. +# Given 1->2->3->4, you should return the list as 2->1->4->3. # # diff --git a/025-reverse-nodes-in-k-group/reverse-nodes-in-k-group.py b/solutions/0025-reverse-nodes-in-k-group/reverse-nodes-in-k-group.py similarity index 100% rename from 025-reverse-nodes-in-k-group/reverse-nodes-in-k-group.py rename to solutions/0025-reverse-nodes-in-k-group/reverse-nodes-in-k-group.py diff --git a/026-remove-duplicates-from-sorted-array/remove-duplicates-from-sorted-array.py b/solutions/0026-remove-duplicates-from-sorted-array/remove-duplicates-from-sorted-array.py similarity index 100% rename from 026-remove-duplicates-from-sorted-array/remove-duplicates-from-sorted-array.py rename to solutions/0026-remove-duplicates-from-sorted-array/remove-duplicates-from-sorted-array.py diff --git a/027-remove-element/remove-element.py b/solutions/0027-remove-element/remove-element.py similarity index 100% rename from 027-remove-element/remove-element.py rename to solutions/0027-remove-element/remove-element.py diff --git a/028-implement-strstr/implement-strstr.py b/solutions/0028-implement-strstr/implement-strstr.py similarity index 100% rename from 028-implement-strstr/implement-strstr.py rename to solutions/0028-implement-strstr/implement-strstr.py diff --git a/034-search-for-a-range/search-for-a-range.py b/solutions/0034-find-first-and-last-position-of-element-in-sorted-array/find-first-and-last-position-of-element-in-sorted-array.py similarity index 100% rename from 034-search-for-a-range/search-for-a-range.py rename to solutions/0034-find-first-and-last-position-of-element-in-sorted-array/find-first-and-last-position-of-element-in-sorted-array.py diff --git a/035-search-insert-position/search-insert-position.py b/solutions/0035-search-insert-position/search-insert-position.py similarity index 100% rename from 035-search-insert-position/search-insert-position.py rename to solutions/0035-search-insert-position/search-insert-position.py diff --git a/038-count-and-say/count-and-say.py b/solutions/0038-count-and-say/count-and-say.py similarity index 88% rename from 038-count-and-say/count-and-say.py rename to solutions/0038-count-and-say/count-and-say.py index cf05b1b7..499f44fb 100644 --- a/038-count-and-say/count-and-say.py +++ b/solutions/0038-count-and-say/count-and-say.py @@ -3,6 +3,7 @@ # The count-and-say sequence is the sequence of integers with the first five terms as following: # +# # 1. 1 # 2. 11 # 3. 21 @@ -10,33 +11,29 @@ # 5. 111221 # # -# # 1 is read off as "one 1" or 11. # 11 is read off as "two 1s" or 21. # 21 is read off as "one 2, then one 1" or 1211. # -# -# -# Given an integer n, generate the nth term of the count-and-say sequence. -# -# +# Given an integer n where 1 ≤ n ≤ 30, generate the nth term of the count-and-say sequence. # # Note: Each term of the sequence of integers will be represented as a string. # +#   # # Example 1: # +# # Input: 1 # Output: "1" # # -# # Example 2: # +# # Input: 4 # Output: "1211" # -# class Solution(object): diff --git a/039-combination-sum/combination-sum.py b/solutions/0039-combination-sum/combination-sum.py similarity index 100% rename from 039-combination-sum/combination-sum.py rename to solutions/0039-combination-sum/combination-sum.py diff --git a/041-first-missing-positive/first-missing-positive.py b/solutions/0041-first-missing-positive/first-missing-positive.py similarity index 100% rename from 041-first-missing-positive/first-missing-positive.py rename to solutions/0041-first-missing-positive/first-missing-positive.py diff --git a/048-rotate-image/rotate-image.py b/solutions/0048-rotate-image/rotate-image.py similarity index 100% rename from 048-rotate-image/rotate-image.py rename to solutions/0048-rotate-image/rotate-image.py diff --git a/050-powx-n/powx-n.py b/solutions/0050-powx-n/powx-n.py similarity index 100% rename from 050-powx-n/powx-n.py rename to solutions/0050-powx-n/powx-n.py diff --git a/053-maximum-subarray/maximum-subarray.py b/solutions/0053-maximum-subarray/maximum-subarray.py similarity index 100% rename from 053-maximum-subarray/maximum-subarray.py rename to solutions/0053-maximum-subarray/maximum-subarray.py diff --git a/054-spiral-matrix/spiral-matrix.py b/solutions/0054-spiral-matrix/spiral-matrix.py similarity index 100% rename from 054-spiral-matrix/spiral-matrix.py rename to solutions/0054-spiral-matrix/spiral-matrix.py diff --git a/055-jump-game/jump-game.py b/solutions/0055-jump-game/jump-game.py similarity index 100% rename from 055-jump-game/jump-game.py rename to solutions/0055-jump-game/jump-game.py diff --git a/056-merge-intervals/merge-intervals.py b/solutions/0056-merge-intervals/merge-intervals.py similarity index 81% rename from 056-merge-intervals/merge-intervals.py rename to solutions/0056-merge-intervals/merge-intervals.py index c0e8f26b..1090b8cc 100644 --- a/056-merge-intervals/merge-intervals.py +++ b/solutions/0056-merge-intervals/merge-intervals.py @@ -16,7 +16,9 @@ # # Input: [[1,4],[4,5]] # Output: [[1,5]] -# Explanation: Intervals [1,4] and [4,5] are considerred overlapping. +# Explanation: Intervals [1,4] and [4,5] are considered overlapping. +# +# NOTE: input types have been changed on April 15, 2019. Please reset to default code definition to get new method signature. # diff --git a/057-insert-interval/insert-interval.py b/solutions/0057-insert-interval/insert-interval.py similarity index 91% rename from 057-insert-interval/insert-interval.py rename to solutions/0057-insert-interval/insert-interval.py index 939f959d..59ac15a4 100644 --- a/057-insert-interval/insert-interval.py +++ b/solutions/0057-insert-interval/insert-interval.py @@ -19,6 +19,8 @@ # Output: [[1,2],[3,10],[12,16]] # Explanation: Because the new interval [4,8] overlaps with [3,5],[6,7],[8,10]. # +# NOTE: input types have been changed on April 15, 2019. Please reset to default code definition to get new method signature. +# # Definition for an interval. diff --git a/058-length-of-last-word/length-of-last-word.py b/solutions/0058-length-of-last-word/length-of-last-word.py similarity index 95% rename from 058-length-of-last-word/length-of-last-word.py rename to solutions/0058-length-of-last-word/length-of-last-word.py index 27b859ec..44d8d84c 100644 --- a/058-length-of-last-word/length-of-last-word.py +++ b/solutions/0058-length-of-last-word/length-of-last-word.py @@ -9,10 +9,13 @@ # # Example: # +# # Input: "Hello World" # Output: 5 # # +#   +# class Solution(object): diff --git a/066-plus-one/plus-one.py b/solutions/0066-plus-one/plus-one.py similarity index 97% rename from 066-plus-one/plus-one.py rename to solutions/0066-plus-one/plus-one.py index abbfab00..0a8389bc 100644 --- a/066-plus-one/plus-one.py +++ b/solutions/0066-plus-one/plus-one.py @@ -22,7 +22,6 @@ # Output: [4,3,2,2] # Explanation: The array represents the integer 4321. # -# class Solution(object): diff --git a/067-add-binary/add-binary.py b/solutions/0067-add-binary/add-binary.py similarity index 100% rename from 067-add-binary/add-binary.py rename to solutions/0067-add-binary/add-binary.py diff --git a/070-climbing-stairs/climbing-stairs.py b/solutions/0070-climbing-stairs/climbing-stairs.py similarity index 100% rename from 070-climbing-stairs/climbing-stairs.py rename to solutions/0070-climbing-stairs/climbing-stairs.py diff --git a/solutions/0071-simplify-path/simplify-path.py b/solutions/0071-simplify-path/simplify-path.py new file mode 100644 index 00000000..eee0cf35 --- /dev/null +++ b/solutions/0071-simplify-path/simplify-path.py @@ -0,0 +1,77 @@ +# -*- coding:utf-8 -*- + + +# Given an absolute path for a file (Unix-style), simplify it. Or in other words, convert it to the canonical path. +# +# In a UNIX-style file system, a period . refers to the current directory. Furthermore, a double period .. moves the directory up a level. For more information, see: Absolute path vs relative path in Linux/Unix +# +# Note that the returned canonical path must always begin with a slash /, and there must be only a single slash / between two directory names. The last directory name (if it exists) must not end with a trailing /. Also, the canonical path must be the shortest string representing the absolute path. +# +#   +# +# Example 1: +# +# +# Input: "/home/" +# Output: "/home" +# Explanation: Note that there is no trailing slash after the last directory name. +# +# +# Example 2: +# +# +# Input: "/../" +# Output: "/" +# Explanation: Going one level up from the root directory is a no-op, as the root level is the highest level you can go. +# +# +# Example 3: +# +# +# Input: "/home//foo/" +# Output: "/home/foo" +# Explanation: In the canonical path, multiple consecutive slashes are replaced by a single one. +# +# +# Example 4: +# +# +# Input: "/a/./b/../../c/" +# Output: "/c" +# +# +# Example 5: +# +# +# Input: "/a/../../b/../c//.//" +# Output: "/c" +# +# +# Example 6: +# +# +# Input: "/a//b////c/d//././/.." +# Output: "/a/b/c" +# +# + + +class Solution(object): + def simplifyPath(self, path): + """ + :type path: str + :rtype: str + """ + # 思路: + # 1. split / 形成List + # 2. 如果 .. 就 pop 前面的 + # 3. 还要考虑 '///' '/...' + places = [p for p in path.split("/") if p!="." and p!=""] + stack = [] + for p in places: + if p == "..": + if len(stack) > 0: + stack.pop() + else: + stack.append(p) + return "/" + "/".join(stack) diff --git a/073-set-matrix-zeroes/set-matrix-zeroes.py b/solutions/0073-set-matrix-zeroes/set-matrix-zeroes.py similarity index 100% rename from 073-set-matrix-zeroes/set-matrix-zeroes.py rename to solutions/0073-set-matrix-zeroes/set-matrix-zeroes.py diff --git a/075-sort-colors/sort-colors.py b/solutions/0075-sort-colors/sort-colors.py similarity index 100% rename from 075-sort-colors/sort-colors.py rename to solutions/0075-sort-colors/sort-colors.py diff --git a/077-combinations/combinations.py b/solutions/0077-combinations/combinations.py similarity index 100% rename from 077-combinations/combinations.py rename to solutions/0077-combinations/combinations.py diff --git a/078-subsets/subsets.py b/solutions/0078-subsets/subsets.py similarity index 100% rename from 078-subsets/subsets.py rename to solutions/0078-subsets/subsets.py diff --git a/079-word-search/word-search.py b/solutions/0079-word-search/word-search.py similarity index 100% rename from 079-word-search/word-search.py rename to solutions/0079-word-search/word-search.py diff --git a/080-remove-duplicates-from-sorted-array-ii/remove-duplicates-from-sorted-array-ii.py b/solutions/0080-remove-duplicates-from-sorted-array-ii/remove-duplicates-from-sorted-array-ii.py similarity index 100% rename from 080-remove-duplicates-from-sorted-array-ii/remove-duplicates-from-sorted-array-ii.py rename to solutions/0080-remove-duplicates-from-sorted-array-ii/remove-duplicates-from-sorted-array-ii.py diff --git a/083-remove-duplicates-from-sorted-list/remove-duplicates-from-sorted-list.py b/solutions/0083-remove-duplicates-from-sorted-list/remove-duplicates-from-sorted-list.py similarity index 96% rename from 083-remove-duplicates-from-sorted-list/remove-duplicates-from-sorted-list.py rename to solutions/0083-remove-duplicates-from-sorted-list/remove-duplicates-from-sorted-list.py index c750e301..911d096e 100644 --- a/083-remove-duplicates-from-sorted-list/remove-duplicates-from-sorted-list.py +++ b/solutions/0083-remove-duplicates-from-sorted-list/remove-duplicates-from-sorted-list.py @@ -16,6 +16,7 @@ # Input: 1->1->2->3->3 # Output: 1->2->3 # +# # Definition for singly-linked list. diff --git a/086-partition-list/partition-list.py b/solutions/0086-partition-list/partition-list.py similarity index 100% rename from 086-partition-list/partition-list.py rename to solutions/0086-partition-list/partition-list.py diff --git a/088-merge-sorted-array/merge-sorted-array.py b/solutions/0088-merge-sorted-array/merge-sorted-array.py similarity index 100% rename from 088-merge-sorted-array/merge-sorted-array.py rename to solutions/0088-merge-sorted-array/merge-sorted-array.py diff --git a/093-restore-ip-addresses/restore-ip-addresses.py b/solutions/0093-restore-ip-addresses/restore-ip-addresses.py similarity index 100% rename from 093-restore-ip-addresses/restore-ip-addresses.py rename to solutions/0093-restore-ip-addresses/restore-ip-addresses.py diff --git a/094-binary-tree-inorder-traversal/binary-tree-inorder-traversal.py b/solutions/0094-binary-tree-inorder-traversal/binary-tree-inorder-traversal.py similarity index 100% rename from 094-binary-tree-inorder-traversal/binary-tree-inorder-traversal.py rename to solutions/0094-binary-tree-inorder-traversal/binary-tree-inorder-traversal.py diff --git a/097-interleaving-string/interleaving-string.py b/solutions/0097-interleaving-string/interleaving-string.py similarity index 100% rename from 097-interleaving-string/interleaving-string.py rename to solutions/0097-interleaving-string/interleaving-string.py diff --git a/100-same-tree/same-tree.py b/solutions/0100-same-tree/same-tree.py similarity index 100% rename from 100-same-tree/same-tree.py rename to solutions/0100-same-tree/same-tree.py diff --git a/101-symmetric-tree/symmetric-tree.py b/solutions/0101-symmetric-tree/symmetric-tree.py similarity index 91% rename from 101-symmetric-tree/symmetric-tree.py rename to solutions/0101-symmetric-tree/symmetric-tree.py index 80c4d08c..cde0c4b3 100644 --- a/101-symmetric-tree/symmetric-tree.py +++ b/solutions/0101-symmetric-tree/symmetric-tree.py @@ -3,9 +3,9 @@ # Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). # -# # For example, this binary tree [1,2,2,3,4,4,3] is symmetric: # +# # 1 # / \ # 2 2 @@ -13,8 +13,10 @@ # 3 4 4 3 # # +#   +# +# But the following [1,2,2,null,3,null,3] is not: # -# But the following [1,2,2,null,3,null,3] is not: # # 1 # / \ @@ -23,7 +25,7 @@ # 3 3 # # -# +#   # # Note: # Bonus points if you could solve it both recursively and iteratively. diff --git a/104-maximum-depth-of-binary-tree/maximum-depth-of-binary-tree.py b/solutions/0104-maximum-depth-of-binary-tree/maximum-depth-of-binary-tree.py similarity index 100% rename from 104-maximum-depth-of-binary-tree/maximum-depth-of-binary-tree.py rename to solutions/0104-maximum-depth-of-binary-tree/maximum-depth-of-binary-tree.py diff --git a/107-binary-tree-level-order-traversal-ii/binary-tree-level-order-traversal-ii.py b/solutions/0107-binary-tree-level-order-traversal-ii/binary-tree-level-order-traversal-ii.py similarity index 100% rename from 107-binary-tree-level-order-traversal-ii/binary-tree-level-order-traversal-ii.py rename to solutions/0107-binary-tree-level-order-traversal-ii/binary-tree-level-order-traversal-ii.py diff --git a/108-convert-sorted-array-to-binary-search-tree/convert-sorted-array-to-binary-search-tree.py b/solutions/0108-convert-sorted-array-to-binary-search-tree/convert-sorted-array-to-binary-search-tree.py similarity index 100% rename from 108-convert-sorted-array-to-binary-search-tree/convert-sorted-array-to-binary-search-tree.py rename to solutions/0108-convert-sorted-array-to-binary-search-tree/convert-sorted-array-to-binary-search-tree.py diff --git a/111-minimum-depth-of-binary-tree/minimum-depth-of-binary-tree.py b/solutions/0111-minimum-depth-of-binary-tree/minimum-depth-of-binary-tree.py similarity index 100% rename from 111-minimum-depth-of-binary-tree/minimum-depth-of-binary-tree.py rename to solutions/0111-minimum-depth-of-binary-tree/minimum-depth-of-binary-tree.py diff --git a/112-path-sum/path-sum.py b/solutions/0112-path-sum/path-sum.py similarity index 100% rename from 112-path-sum/path-sum.py rename to solutions/0112-path-sum/path-sum.py diff --git a/113-path-sum-ii/path-sum-ii.py b/solutions/0113-path-sum-ii/path-sum-ii.py similarity index 100% rename from 113-path-sum-ii/path-sum-ii.py rename to solutions/0113-path-sum-ii/path-sum-ii.py diff --git a/118-pascals-triangle/pascals-triangle.py b/solutions/0118-pascals-triangle/pascals-triangle.py similarity index 100% rename from 118-pascals-triangle/pascals-triangle.py rename to solutions/0118-pascals-triangle/pascals-triangle.py diff --git a/119-pascals-triangle-ii/pascals-triangle-ii.py b/solutions/0119-pascals-triangle-ii/pascals-triangle-ii.py similarity index 100% rename from 119-pascals-triangle-ii/pascals-triangle-ii.py rename to solutions/0119-pascals-triangle-ii/pascals-triangle-ii.py diff --git a/121-best-time-to-buy-and-sell-stock/best-time-to-buy-and-sell-stock.py b/solutions/0121-best-time-to-buy-and-sell-stock/best-time-to-buy-and-sell-stock.py similarity index 100% rename from 121-best-time-to-buy-and-sell-stock/best-time-to-buy-and-sell-stock.py rename to solutions/0121-best-time-to-buy-and-sell-stock/best-time-to-buy-and-sell-stock.py diff --git a/122-best-time-to-buy-and-sell-stock-ii/best-time-to-buy-and-sell-stock-ii.py b/solutions/0122-best-time-to-buy-and-sell-stock-ii/best-time-to-buy-and-sell-stock-ii.py similarity index 100% rename from 122-best-time-to-buy-and-sell-stock-ii/best-time-to-buy-and-sell-stock-ii.py rename to solutions/0122-best-time-to-buy-and-sell-stock-ii/best-time-to-buy-and-sell-stock-ii.py diff --git a/125-valid-palindrome/valid-palindrome.py b/solutions/0125-valid-palindrome/valid-palindrome.py similarity index 100% rename from 125-valid-palindrome/valid-palindrome.py rename to solutions/0125-valid-palindrome/valid-palindrome.py diff --git a/solutions/0134-gas-station/gas-station.py b/solutions/0134-gas-station/gas-station.py new file mode 100644 index 00000000..72c92997 --- /dev/null +++ b/solutions/0134-gas-station/gas-station.py @@ -0,0 +1,73 @@ +# -*- coding:utf-8 -*- + + +# There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. +# +# You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to its next station (i+1). You begin the journey with an empty tank at one of the gas stations. +# +# Return the starting gas station's index if you can travel around the circuit once in the clockwise direction, otherwise return -1. +# +# Note: +# +# +# If there exists a solution, it is guaranteed to be unique. +# Both input arrays are non-empty and have the same length. +# Each element in the input arrays is a non-negative integer. +# +# +# Example 1: +# +# +# Input: +# gas = [1,2,3,4,5] +# cost = [3,4,5,1,2] +# +# Output: 3 +# +# Explanation: +# Start at station 3 (index 3) and fill up with 4 unit of gas. Your tank = 0 + 4 = 4 +# Travel to station 4. Your tank = 4 - 1 + 5 = 8 +# Travel to station 0. Your tank = 8 - 2 + 1 = 7 +# Travel to station 1. Your tank = 7 - 3 + 2 = 6 +# Travel to station 2. Your tank = 6 - 4 + 3 = 5 +# Travel to station 3. The cost is 5. Your gas is just enough to travel back to station 3. +# Therefore, return 3 as the starting index. +# +# +# Example 2: +# +# +# Input: +# gas = [2,3,4] +# cost = [3,4,3] +# +# Output: -1 +# +# Explanation: +# You can't start at station 0 or 1, as there is not enough gas to travel to the next station. +# Let's start at station 2 and fill up with 4 unit of gas. Your tank = 0 + 4 = 4 +# Travel to station 0. Your tank = 4 - 3 + 2 = 3 +# Travel to station 1. Your tank = 3 - 3 + 3 = 3 +# You cannot travel back to station 2, as it requires 4 unit of gas but you only have 3. +# Therefore, you can't travel around the circuit once no matter where you start. +# +# + + +class Solution(object): + def canCompleteCircuit(self, gas, cost): + """ + :type gas: List[int] + :type cost: List[int] + :rtype: int + """ + if len(gas) == 0 or len(cost) == 0 or sum(gas) < sum(cost): + return -1 + position = 0 + balance = 0 # current tank balance + for i in range(len(gas)): + balance += gas[i] - cost[i] # update balance + if balance < 0: # balance drops to negative, reset the start position + balance = 0 + position = i+1 + return position diff --git a/136-single-number/single-number.py b/solutions/0136-single-number/single-number.py similarity index 59% rename from 136-single-number/single-number.py rename to solutions/0136-single-number/single-number.py index a892cd8f..dcbb5520 100644 --- a/136-single-number/single-number.py +++ b/solutions/0136-single-number/single-number.py @@ -1,12 +1,26 @@ # -*- coding:utf-8 -*- -# Given an array of integers, every element appears twice except for one. Find that single one. -# +# Given a non-empty array of integers, every element appears twice except for one. Find that single one. # # Note: +# # Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? # +# Example 1: +# +# +# Input: [2,2,1] +# Output: 1 +# +# +# Example 2: +# +# +# Input: [4,1,2,1,2] +# Output: 4 +# +# class Solution(object): diff --git a/137-single-number-ii/single-number-ii.py b/solutions/0137-single-number-ii/single-number-ii.py similarity index 61% rename from 137-single-number-ii/single-number-ii.py rename to solutions/0137-single-number-ii/single-number-ii.py index 982a8143..c4954b46 100644 --- a/137-single-number-ii/single-number-ii.py +++ b/solutions/0137-single-number-ii/single-number-ii.py @@ -1,13 +1,24 @@ # -*- coding:utf-8 -*- +# Given a non-empty array of integers, every element appears three times except for one, which appears exactly once. Find that single one. # -# Given an array of integers, every element appears three times except for one, which appears exactly once. Find that single one. +# Note: # +# Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? # +# Example 1: # -# Note: -# Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? +# +# Input: [2,2,3,2] +# Output: 3 +# +# +# Example 2: +# +# +# Input: [0,1,0,1,0,1,99] +# Output: 99 # diff --git a/solutions/0141-linked-list-cycle/linked-list-cycle.py b/solutions/0141-linked-list-cycle/linked-list-cycle.py new file mode 100644 index 00000000..1aee033b --- /dev/null +++ b/solutions/0141-linked-list-cycle/linked-list-cycle.py @@ -0,0 +1,77 @@ +# -*- coding:utf-8 -*- + + +# Given a linked list, determine if it has a cycle in it. +# +# To represent a cycle in the given linked list, we use an integer pos which represents the position (0-indexed) in the linked list where tail connects to. If pos is -1, then there is no cycle in the linked list. +# +#   +# +# +# Example 1: +# +# +# Input: head = [3,2,0,-4], pos = 1 +# Output: true +# Explanation: There is a cycle in the linked list, where tail connects to the second node. +# +# +# +# +# +# +# Example 2: +# +# +# Input: head = [1,2], pos = 0 +# Output: true +# Explanation: There is a cycle in the linked list, where tail connects to the first node. +# +# +# +# +# +# +# Example 3: +# +# +# Input: head = [1], pos = -1 +# Output: false +# Explanation: There is no cycle in the linked list. +# +# +# +# +# +#   +# +# Follow up: +# +# Can you solve it using O(1) (i.e. constant) memory? +# + + +# Definition for singly-linked list. +# class ListNode(object): +# def __init__(self, x): +# self.val = x +# self.next = None + +class Solution(object): + def hasCycle(self, head): + """ + :type head: ListNode + :rtype: bool + """ + if head is None: + return False + cur = head + dct = {} + while cur.next: + if id(cur) in dct: + return True + dct[id(cur)] = cur + cur = cur.next + + return False + diff --git a/solutions/0189-rotate-array/rotate-array.py b/solutions/0189-rotate-array/rotate-array.py new file mode 100644 index 00000000..26f2d296 --- /dev/null +++ b/solutions/0189-rotate-array/rotate-array.py @@ -0,0 +1,45 @@ +# -*- coding:utf-8 -*- + + +# Given an array, rotate the array to the right by k steps, where k is non-negative. +# +# Example 1: +# +# +# Input: [1,2,3,4,5,6,7] and k = 3 +# Output: [5,6,7,1,2,3,4] +# Explanation: +# rotate 1 steps to the right: [7,1,2,3,4,5,6] +# rotate 2 steps to the right: [6,7,1,2,3,4,5] +# rotate 3 steps to the right: [5,6,7,1,2,3,4] +# +# +# Example 2: +# +# +# Input: [-1,-100,3,99] and k = 2 +# Output: [3,99,-1,-100] +# Explanation: +# rotate 1 steps to the right: [99,-1,-100,3] +# rotate 2 steps to the right: [3,99,-1,-100] +# +# +# Note: +# +# +# Try to come up as many solutions as you can, there are at least 3 different ways to solve this problem. +# Could you do it in-place with O(1) extra space? +# + + +class Solution(object): + def rotate(self, nums, k): + """ + :type nums: List[int] + :type k: int + :rtype: void Do not return anything, modify nums in-place instead. + """ + while k>0: + t = nums.pop() + nums.insert(0, t) + k -= 1 diff --git a/206-reverse-linked-list/reverse-linked-list.py b/solutions/0206-reverse-linked-list/reverse-linked-list.py similarity index 85% rename from 206-reverse-linked-list/reverse-linked-list.py rename to solutions/0206-reverse-linked-list/reverse-linked-list.py index 835453b1..bd3621e6 100644 --- a/206-reverse-linked-list/reverse-linked-list.py +++ b/solutions/0206-reverse-linked-list/reverse-linked-list.py @@ -3,9 +3,15 @@ # Reverse a singly linked list. # -# click to show more hints. +# Example: +# +# +# Input: 1->2->3->4->5->NULL +# Output: 5->4->3->2->1->NULL +# +# +# Follow up: # -# Hint: # A linked list can be reversed either iteratively or recursively. Could you implement both? # diff --git a/227-basic-calculator-ii/basic-calculator-ii.py b/solutions/0227-basic-calculator-ii/basic-calculator-ii.py similarity index 79% rename from 227-basic-calculator-ii/basic-calculator-ii.py rename to solutions/0227-basic-calculator-ii/basic-calculator-ii.py index 8f7b9817..139ae4eb 100644 --- a/227-basic-calculator-ii/basic-calculator-ii.py +++ b/solutions/0227-basic-calculator-ii/basic-calculator-ii.py @@ -5,21 +5,33 @@ # # The expression string contains only non-negative integers, +, -, *, / operators and empty spaces . The integer division should truncate toward zero. # -# You may assume that the given expression is always valid. +# Example 1: # -# Some examples: # -# "3+2*2" = 7 -# " 3/2 " = 1 -# " 3+5 / 2 " = 5 +# Input: "3+2*2" +# Output: 7 # # +# Example 2: # # -# Note: Do not use the eval built-in library function. +# Input: " 3/2 " +# Output: 1 +# +# Example 3: +# +# +# Input: " 3+5 / 2 " +# Output: 5 +# +# +# Note: +# +# +# You may assume that the given expression is always valid. +# Do not use the eval built-in library function. # # -# Credits:Special thanks to @ts for adding this problem and creating all test cases. class Solution(object): diff --git a/solutions/0237-delete-node-in-a-linked-list/delete-node-in-a-linked-list.py b/solutions/0237-delete-node-in-a-linked-list/delete-node-in-a-linked-list.py new file mode 100644 index 00000000..2679bf7a --- /dev/null +++ b/solutions/0237-delete-node-in-a-linked-list/delete-node-in-a-linked-list.py @@ -0,0 +1,54 @@ +# -*- coding:utf-8 -*- + + +# Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. +# +# Given linked list -- head = [4,5,1,9], which looks like following: +# +# +# +#   +# +# Example 1: +# +# +# Input: head = [4,5,1,9], node = 5 +# Output: [4,1,9] +# Explanation: You are given the second node with value 5, the linked list should become 4 -> 1 -> 9 after calling your function. +# +# +# Example 2: +# +# +# Input: head = [4,5,1,9], node = 1 +# Output: [4,5,9] +# Explanation: You are given the third node with value 1, the linked list should become 4 -> 5 -> 9 after calling your function. +# +# +#   +# +# Note: +# +# +# The linked list will have at least two elements. +# All of the nodes' values will be unique. +# The given node will not be the tail and it will always be a valid node of the linked list. +# Do not return anything from your function. +# +# + + +# Definition for singly-linked list. +# class ListNode(object): +# def __init__(self, x): +# self.val = x +# self.next = None + +class Solution(object): + def deleteNode(self, node): + """ + :type node: ListNode + :rtype: void Do not return anything, modify node in-place instead. + """ + node.val = node.next.val + node.next = node.next.next diff --git a/240-search-a-2d-matrix-ii/search-a-2d-matrix-ii.py b/solutions/0240-search-a-2d-matrix-ii/search-a-2d-matrix-ii.py similarity index 76% rename from 240-search-a-2d-matrix-ii/search-a-2d-matrix-ii.py rename to solutions/0240-search-a-2d-matrix-ii/search-a-2d-matrix-ii.py index 86821378..e53d5eb2 100644 --- a/240-search-a-2d-matrix-ii/search-a-2d-matrix-ii.py +++ b/solutions/0240-search-a-2d-matrix-ii/search-a-2d-matrix-ii.py @@ -4,14 +4,11 @@ # Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: # # +# Integers in each row are sorted in ascending from left to right. +# Integers in each column are sorted in ascending from top to bottom. # -# Integers in each row are sorted in ascending from left to right. -# Integers in each column are sorted in ascending from top to bottom. # -# -# -# -# For example, +# Example: # # Consider the following matrix: # @@ -25,8 +22,10 @@ # ] # # -# Given target = 5, return true. -# Given target = 20, return false. +# Given target = 5, return true. +# +# Given target = 20, return false. +# class Solution(object): diff --git a/242-valid-anagram/valid-anagram.py b/solutions/0242-valid-anagram/valid-anagram.py similarity index 71% rename from 242-valid-anagram/valid-anagram.py rename to solutions/0242-valid-anagram/valid-anagram.py index 30714008..3d0505df 100644 --- a/242-valid-anagram/valid-anagram.py +++ b/solutions/0242-valid-anagram/valid-anagram.py @@ -1,11 +1,21 @@ # -*- coding:utf-8 -*- -# Given two strings s and t, write a function to determine if t is an anagram of s. +# Given two strings s and t , write a function to determine if t is an anagram of s. +# +# Example 1: +# +# +# Input: s = "anagram", t = "nagaram" +# Output: true +# +# +# Example 2: +# +# +# Input: s = "rat", t = "car" +# Output: false # -# For example, -# s = "anagram", t = "nagaram", return true. -# s = "rat", t = "car", return false. # # Note: # You may assume the string contains only lowercase alphabets. diff --git a/263-ugly-number/ugly-number.py b/solutions/0263-ugly-number/ugly-number.py similarity index 56% rename from 263-ugly-number/ugly-number.py rename to solutions/0263-ugly-number/ugly-number.py index 4eb62c0a..866384c1 100644 --- a/263-ugly-number/ugly-number.py +++ b/solutions/0263-ugly-number/ugly-number.py @@ -3,18 +3,36 @@ # Write a program to check whether a given number is an ugly number. # -# Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly since it includes another prime factor 7. +# Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. # -# Note: +# Example 1: # # -# 1 is typically treated as an ugly number. -# Input is within the 32-bit signed integer range. +# Input: 6 +# Output: true +# Explanation: 6 = 2 × 3 +# +# Example 2: +# +# +# Input: 8 +# Output: true +# Explanation: 8 = 2 × 2 × 2 +# # +# Example 3: # # -# Credits: -# Special thanks to @jianchao.li.fighter for adding this problem and creating all test cases. +# Input: 14 +# Output: false +# Explanation: 14 is not ugly since it includes another prime factor 7. +# +# +# Note: +# +# +# 1 is typically treated as an ugly number. +# Input is within the 32-bit signed integer range: [−231,  231 − 1]. # diff --git a/264-ugly-number-ii/ugly-number-ii.py b/solutions/0264-ugly-number-ii/ugly-number-ii.py similarity index 68% rename from 264-ugly-number-ii/ugly-number-ii.py rename to solutions/0264-ugly-number-ii/ugly-number-ii.py index d32266de..2c75af74 100644 --- a/264-ugly-number-ii/ugly-number-ii.py +++ b/solutions/0264-ugly-number-ii/ugly-number-ii.py @@ -1,19 +1,23 @@ # -*- coding:utf-8 -*- -# # Write a program to find the n-th ugly number. # +# Ugly numbers are positive numbers whose prime factors only include 2, 3, 5.  # +# Example: # -# Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the first 10 ugly numbers. # +# Input: n = 10 +# Output: 12 +# Explanation: 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the first 10 ugly numbers. # +# Note:   # -# Note that 1 is typically treated as an ugly number, and n does not exceed 1690. # +# 1 is typically treated as an ugly number. +# n does not exceed 1690. # -# Credits:Special thanks to @jianchao.li.fighter for adding this problem and creating all test cases. class Solution(object): diff --git a/274-h-index/h-index.py b/solutions/0274-h-index/h-index.py similarity index 57% rename from 274-h-index/h-index.py rename to solutions/0274-h-index/h-index.py index 3fb74923..bc1eaf5d 100644 --- a/274-h-index/h-index.py +++ b/solutions/0274-h-index/h-index.py @@ -1,23 +1,22 @@ # -*- coding:utf-8 -*- -# # Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index. # -# -# # According to the definition of h-index on Wikipedia: "A scientist has index h if h of his/her N papers have at least h citations each, and the other N − h papers have no more than h citations each." # +# Example: # # -# For example, given citations = [3, 0, 6, 1, 5], which means the researcher has 5 papers in total and each of them had received 3, 0, 6, 1, 5 citations respectively. Since the researcher has 3 papers with at least 3 citations each and the remaining two with no more than 3 citations each, his h-index is 3. -# -# -# -# Note: If there are several possible values for h, the maximum one is taken as the h-index. +# Input: citations = [3,0,6,1,5] +# Output: 3 +# Explanation: [3,0,6,1,5] means the researcher has 5 papers in total and each of them had +# received 3, 0, 6, 1, 5 citations respectively. +#   Since the researcher has 3 papers with at least 3 citations each and the remaining +#   two with no more than 3 citations each, her h-index is 3. # +# Note: If there are several possible values for h, the maximum one is taken as the h-index. # -# Credits:Special thanks to @jianchao.li.fighter for adding this problem and creating all test cases. class Solution(object): diff --git a/solutions/0275-h-index-ii/h-index-ii.py b/solutions/0275-h-index-ii/h-index-ii.py new file mode 100644 index 00000000..ec763670 --- /dev/null +++ b/solutions/0275-h-index-ii/h-index-ii.py @@ -0,0 +1,46 @@ +# -*- coding:utf-8 -*- + + +# Given an array of citations sorted in ascending order (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index. +# +# According to the definition of h-index on Wikipedia: "A scientist has index h if h of his/her N papers have at least h citations each, and the other N − h papers have no more than h citations each." +# +# Example: +# +# +# Input: citations = [0,1,3,5,6] +# Output: 3 +# Explanation: [0,1,3,5,6] means the researcher has 5 papers in total and each of them had +# received 0, 1, 3, 5, 6 citations respectively. +#   Since the researcher has 3 papers with at least 3 citations each and the remaining +#   two with no more than 3 citations each, her h-index is 3. +# +# Note: +# +# If there are several possible values for h, the maximum one is taken as the h-index. +# +# Follow up: +# +# +# This is a follow up problem to H-Index, where citations is now guaranteed to be sorted in ascending order. +# Could you solve it in logarithmic time complexity? +# +# + + +class Solution(object): + def hIndex(self, citations): + """ + :type citations: List[int] + :rtype: int + """ + n = len(citations) + l, r = 0, n-1 + + while l <= r: + mid = (l+r)/2 + if citations[mid] >= n-mid: + r = mid - 1 + else: + l = mid + 1 + return n-l diff --git a/solutions/0313-super-ugly-number/super-ugly-number.py b/solutions/0313-super-ugly-number/super-ugly-number.py new file mode 100644 index 00000000..143b9661 --- /dev/null +++ b/solutions/0313-super-ugly-number/super-ugly-number.py @@ -0,0 +1,43 @@ +# -*- coding:utf-8 -*- + + +# Write a program to find the nth super ugly number. +# +# Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes of size k. +# +# Example: +# +# +# Input: n = 12, primes = [2,7,13,19] +# Output: 32 +# Explanation: [1,2,4,7,8,13,14,16,19,26,28,32] is the sequence of the first 12 +# super ugly numbers given primes = [2,7,13,19] of size 4. +# +# Note: +# +# +# 1 is a super ugly number for any given primes. +# The given numbers in primes are in ascending order. +# 0 < k ≤ 100, 0 < n ≤ 106, 0 < primes[i] < 1000. +# The nth super ugly number is guaranteed to fit in a 32-bit signed integer. +# +# + + +class Solution(object): + def nthSuperUglyNumber(self, n, primes): + """ + :type n: int + :type primes: List[int] + :rtype: int + """ + uglies = [1] + def gen(prime): + for ugly in uglies: + yield ugly * prime + merged = heapq.merge(*map(gen, primes)) + while len(uglies) < n: + ugly = next(merged) + if ugly != uglies[-1]: + uglies.append(ugly) + return uglies[-1] diff --git a/solutions/0324-wiggle-sort-ii/wiggle-sort-ii.py b/solutions/0324-wiggle-sort-ii/wiggle-sort-ii.py new file mode 100644 index 00000000..5c7a8ba3 --- /dev/null +++ b/solutions/0324-wiggle-sort-ii/wiggle-sort-ii.py @@ -0,0 +1,33 @@ +# -*- coding:utf-8 -*- + + +# Given an unsorted array nums, reorder it such that nums[0] < nums[1] > nums[2] < nums[3].... +# +# Example 1: +# +# +# Input: nums = [1, 5, 1, 1, 6, 4] +# Output: One possible answer is [1, 4, 1, 5, 1, 6]. +# +# Example 2: +# +# +# Input: nums = [1, 3, 2, 2, 3, 1] +# Output: One possible answer is [2, 3, 1, 3, 1, 2]. +# +# Note: +# You may assume all input has valid answer. +# +# Follow Up: +# Can you do it in O(n) time and/or in-place with O(1) extra space? + + +class Solution(object): + def wiggleSort(self, nums): + """ + :type nums: List[int] + :rtype: void Do not return anything, modify nums in-place instead. + """ + nums.sort() + half = len(nums[::2]) + nums[::2], nums[1::2] = nums[:half][::-1], nums[half:][::-1] diff --git a/solutions/0335-self-crossing/self-crossing.py b/solutions/0335-self-crossing/self-crossing.py new file mode 100644 index 00000000..b371585f --- /dev/null +++ b/solutions/0335-self-crossing/self-crossing.py @@ -0,0 +1,66 @@ +# -*- coding:utf-8 -*- + + +# You are given an array x of n positive numbers. You start at point (0,0) and moves x[0] metres to the north, then x[1] metres to the west, x[2] metres to the south, x[3] metres to the east and so on. In other words, after each move your direction changes counter-clockwise. +# +# Write a one-pass algorithm with O(1) extra space to determine, if your path crosses itself, or not. +# +#   +# +# Example 1: +# +# +# ┌───┐ +# │   │ +# └───┼──> +#     │ +# +# Input: [2,1,1,2] +# Output: true +# +# +# Example 2: +# +# +# ┌──────┐ +# │      │ +# │ +# │ +# └────────────> +# +# Input: [1,2,3,4] +# Output: false +# +# +# Example 3: +# +# +# ┌───┐ +# │   │ +# └───┼> +# +# Input: [1,1,1,1] +# Output: true +# +# + + +class Solution(object): + def isSelfCrossing(self, x): + """ + :type x: List[int] + :rtype: bool + """ + n = len(x) + x.append(0.5) # let x[-1] = 0.5 + if n < 4: return False + grow = x[2] > x[0] + + for i in range(3,n): + if not grow and x[i] >= x[i-2]: return True + if grow and x[i] <= x[i-2]: + grow = False + if x[i] + x[i-4] >= x[i-2]: + x[i-1] -= x[i-3] + return False + diff --git a/347-top-k-frequent-elements/top-k-frequent-elements.py b/solutions/0347-top-k-frequent-elements/top-k-frequent-elements.py similarity index 65% rename from 347-top-k-frequent-elements/top-k-frequent-elements.py rename to solutions/0347-top-k-frequent-elements/top-k-frequent-elements.py index b767057e..d204a98f 100644 --- a/347-top-k-frequent-elements/top-k-frequent-elements.py +++ b/solutions/0347-top-k-frequent-elements/top-k-frequent-elements.py @@ -1,17 +1,29 @@ # -*- coding:utf-8 -*- -# # Given a non-empty array of integers, return the k most frequent elements. # -# For example, -# Given [1,1,1,2,2,3] and k = 2, return [1,2]. +# Example 1: +# +# +# Input: nums = [1,1,1,2,2,3], k = 2 +# Output: [1,2] +# +# +# +# Example 2: +# +# +# Input: nums = [1], k = 1 +# Output: [1] # # # Note: # -# You may assume k is always valid, 1 ≤ k ≤ number of unique elements. -# Your algorithm's time complexity must be better than O(n log n), where n is the array's size. +# +# You may assume k is always valid, 1 ≤ k ≤ number of unique elements. +# Your algorithm's time complexity must be better than O(n log n), where n is the array's size. +# # diff --git a/405-convert-a-number-to-hexadecimal/convert-a-number-to-hexadecimal.py b/solutions/0405-convert-a-number-to-hexadecimal/convert-a-number-to-hexadecimal.py similarity index 100% rename from 405-convert-a-number-to-hexadecimal/convert-a-number-to-hexadecimal.py rename to solutions/0405-convert-a-number-to-hexadecimal/convert-a-number-to-hexadecimal.py diff --git a/420-strong-password-checker/strong-password-checker.py b/solutions/0420-strong-password-checker/strong-password-checker.py similarity index 100% rename from 420-strong-password-checker/strong-password-checker.py rename to solutions/0420-strong-password-checker/strong-password-checker.py diff --git a/438-find-all-anagrams-in-a-string/find-all-anagrams-in-a-string.py b/solutions/0438-find-all-anagrams-in-a-string/find-all-anagrams-in-a-string.py similarity index 100% rename from 438-find-all-anagrams-in-a-string/find-all-anagrams-in-a-string.py rename to solutions/0438-find-all-anagrams-in-a-string/find-all-anagrams-in-a-string.py diff --git a/454-4sum-ii/4sum-ii.py b/solutions/0454-4sum-ii/4sum-ii.py similarity index 96% rename from 454-4sum-ii/4sum-ii.py rename to solutions/0454-4sum-ii/4sum-ii.py index 00a7a0fb..2ed581f0 100644 --- a/454-4sum-ii/4sum-ii.py +++ b/solutions/0454-4sum-ii/4sum-ii.py @@ -7,6 +7,7 @@ # # Example: # +# # Input: # A = [ 1, 2] # B = [-2,-1] @@ -22,6 +23,8 @@ # 2. (1, 1, 0, 0) -> A[1] + B[1] + C[0] + D[0] = 2 + (-1) + (-1) + 0 = 0 # # +#   +# class Solution(object): diff --git a/455-assign-cookies/assign-cookies.py b/solutions/0455-assign-cookies/assign-cookies.py similarity index 100% rename from 455-assign-cookies/assign-cookies.py rename to solutions/0455-assign-cookies/assign-cookies.py diff --git a/solutions/0458-poor-pigs/poor-pigs.py b/solutions/0458-poor-pigs/poor-pigs.py new file mode 100644 index 00000000..09031712 --- /dev/null +++ b/solutions/0458-poor-pigs/poor-pigs.py @@ -0,0 +1,39 @@ +# -*- coding:utf-8 -*- + + +# There are 1000 buckets, one and only one of them is poisonous, while the rest are filled with water. They all look identical. If a pig drinks the poison it will die within 15 minutes. What is the minimum amount of pigs you need to figure out which bucket is poisonous within one hour? +# +# Answer this question, and write an algorithm for the general case. +# +#   +# +# General case: +# +# If there are n buckets and a pig drinking poison will die within m minutes, how many pigs (x) you need to figure out the poisonous bucket within p minutes? There is exactly one bucket with poison. +# +#   +# +# Note: +# +# +# A pig can be allowed to drink simultaneously on as many buckets as one would like, and the feeding takes no time. +# After a pig has instantly finished drinking buckets, there has to be a cool down time of m minutes. During this time, only observation is allowed and no feedings at all. +# Any given bucket can be sampled an infinite number of times (by an unlimited number of pigs). +# + + +class Solution(object): + def poorPigs(self, buckets, minutesToDie, minutesToTest): + """ + :type buckets: int + :type minutesToDie: int + :type minutesToTest: int + :rtype: int + """ + # corner case + if buckets == 1: + return 0 + if minutesToTest // minutesToDie <= 1: + return buckets - 1 + # general case: just get the n in n^(test_times + 1) = buckets + return int(math.ceil(math.log(buckets, (minutesToTest // minutesToDie) + 1))) diff --git a/461-hamming-distance/hamming-distance.py b/solutions/0461-hamming-distance/hamming-distance.py similarity index 100% rename from 461-hamming-distance/hamming-distance.py rename to solutions/0461-hamming-distance/hamming-distance.py diff --git a/485-max-consecutive-ones/max-consecutive-ones.py b/solutions/0485-max-consecutive-ones/max-consecutive-ones.py similarity index 100% rename from 485-max-consecutive-ones/max-consecutive-ones.py rename to solutions/0485-max-consecutive-ones/max-consecutive-ones.py diff --git a/506-relative-ranks/relative-ranks.py b/solutions/0506-relative-ranks/relative-ranks.py similarity index 100% rename from 506-relative-ranks/relative-ranks.py rename to solutions/0506-relative-ranks/relative-ranks.py diff --git a/526-beautiful-arrangement/beautiful-arrangement.py b/solutions/0526-beautiful-arrangement/beautiful-arrangement.py similarity index 85% rename from 526-beautiful-arrangement/beautiful-arrangement.py rename to solutions/0526-beautiful-arrangement/beautiful-arrangement.py index 45b234dd..c3fe78cf 100644 --- a/526-beautiful-arrangement/beautiful-arrangement.py +++ b/solutions/0526-beautiful-arrangement/beautiful-arrangement.py @@ -1,36 +1,46 @@ # -*- coding:utf-8 -*- -# # Suppose you have N integers from 1 to N. We define a beautiful arrangement as an array that is constructed by these N numbers successfully if one of the following is true for the ith position (1 <= i <= N) in this array: # -# The number at the ith position is divisible by i. -# i is divisible by the number at the ith position. # +# The number at the ith position is divisible by i. +# i is divisible by the number at the ith position. # # +#   # # Now given N, how many beautiful arrangements can you construct? # -# # Example 1: # +# # Input: 2 # Output: 2 # Explanation: +# # The first beautiful arrangement is [1, 2]: +# # Number at the 1st position (i=1) is 1, and 1 is divisible by i (i=1). +# # Number at the 2nd position (i=2) is 2, and 2 is divisible by i (i=2). +# # The second beautiful arrangement is [2, 1]: +# # Number at the 1st position (i=1) is 2, and 2 is divisible by i (i=1). +# # Number at the 2nd position (i=2) is 1, and i (i=2) is divisible by 1. # # +#   # # Note: # -# N is a positive integer and will not exceed 15. # +# N is a positive integer and will not exceed 15. +# +# +#   # diff --git a/solutions/1065-binary-string-with-substrings-representing-1-to-n/binary-string-with-substrings-representing-1-to-n.py b/solutions/1065-binary-string-with-substrings-representing-1-to-n/binary-string-with-substrings-representing-1-to-n.py new file mode 100644 index 00000000..09a95f28 --- /dev/null +++ b/solutions/1065-binary-string-with-substrings-representing-1-to-n/binary-string-with-substrings-representing-1-to-n.py @@ -0,0 +1,45 @@ +# -*- coding:utf-8 -*- + + +# Given a binary string S (a string consisting only of '0' and '1's) and a positive integer N, return true if and only if for every integer X from 1 to N, the binary representation of X is a substring of S. +# +#   +# +# Example 1: +# +# +# Input: S = "0110", N = 3 +# Output: true +# +# +# Example 2: +# +# +# Input: S = "0110", N = 4 +# Output: false +# +# +#   +# +# Note: +# +# +# 1 <= S.length <= 1000 +# 1 <= N <= 10^9 +# +# + + +class Solution(object): + def queryString(self, S, N): + """ + :type S: str + :type N: int + :rtype: bool + """ + for i in range(1,N + 1): + target = bin(i) + if str(target)[2:] not in S: + return False + + return True