An open API service indexing awesome lists of open source software.

https://github.com/matnoble/leetcode

leetcode python3 solutions
https://github.com/matnoble/leetcode

algorithms leetcode leetcode-python3-solutions

Last synced: 12 months ago
JSON representation

leetcode python3 solutions

Awesome Lists containing this project

README

          

## Leetcode Python3 solutions
> [![](https://img.shields.io/badge/Author-MatNoble-orange)]((https://matnoble.me)) ![png](https://img.shields.io/badge/language-Python%203-blue) ![](https://img.shields.io/badge/LeetCode-232%2F2021-brightgreen) ![](https://img.shields.io/badge/%E5%89%91%E6%8C%87offer-43%2F75-green)

- [剑指 Offer](./剑指offer/README.md)
- [LeetCode 题解及思路](https://matnoble.github.io/tags/%E7%BC%96%E7%A8%8B%E5%88%B7%E9%A2%98/)

---
### Tips

Advising add the extension of [HTML5 Outliner](https://chrome.google.com/webstore/detail/html5-outliner/afoibpobokebhgfnknfndkgemglggomo) to your Chrome to view a table of contents.
Advicing add

---

### Recursion

[Basic](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/Data%20Structures%20and%20Algorithms/recursion.py)

#### Reverse Linked Lists

| Question Number| Official Website Link | Solution's Link |
|:-:|-|-|
| 025 | [reverse nodes in k group](https://leetcode-cn.com/problems/reverse-nodes-in-k-group/) | [hard](https://github.com/MatNoble/leetcode/blob/main/Data%20Structures%20and%20Algorithms/reverse-linked-list.py) |
| 092 | [reverse linked list II](https://leetcode-cn.com/problems/reverse-linked-list-ii/) | [medium](https://github.com/MatNoble/leetcode/blob/main/Data%20Structures%20and%20Algorithms/reverse-linked-list.py) |
|206| [reverse linked list](https://leetcode-cn.com/problems/reverse-linked-list/) | [easy](https://github.com/MatNoble/leetcode/blob/main/Data%20Structures%20and%20Algorithms/reverse-linked-list.py) |
|234|[palindrome linked list](https://leetcode-cn.com/problems/palindrome-linked-list/)|[easy](https://github.com/MatNoble/leetcode/blob/main/Data%20Structures%20and%20Algorithms/palindrome_linked_list.py)|

#### Binary Tree
| Question Number| Official Website Link | Solution's Link |
|:-:|-|-|
|105| [construct binary tree from preorder and inorder traversal](https://leetcode-cn.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/) | [medium](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/105.py) |
|106|[construct binary tree from inorder and postorder traversal](https://leetcode-cn.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/) | [medium](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/106.py) |
|654| [maximum binary tree](https://leetcode-cn.com/problems/maximum-binary-tree/) | [medium](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/654.py) |

---

### Math

1. [Binary Exponentiation](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/050.py)

---

### Two Pointers

| Question Number| Official Website Link | Solution's Link |
|:-:|-|-|
|005| [longest palindromic substring](https://leetcode-cn.com/problems/longest-palindromic-substring/) | [medium](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/005.py) |
|011| [container with most water](https://leetcode-cn.com/problems/container-with-most-water/) | [medium](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/011.py) |
| 026 | [remove duplicates from sorted array](https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/) | [easy](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/026.py) |
| 042 | [trapping rain water](https://leetcode-cn.com/problems/trapping-rain-water/) | [hard](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/042.py) |
|076|[minimum window substring](https://leetcode-cn.com/problems/minimum-window-substring/)|[hard](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/076.py)|
| 141 | [linked list cycle](https://leetcode-cn.com/problems/linked-list-cycle/) | [easy](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/141.py) |
| 142 | [linked list cycle ii](https://leetcode-cn.com/problems/linked-list-cycle-ii/) | [medium](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/142.py) |
|189|[rotate array](https://leetcode-cn.com/problems/rotate-array/)| [medium](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/026.py)|
| 283 | [move zeros](https://leetcode-cn.com/problems/move-zeroes/) | [easy](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/283.py)|
| 287 | [find the duplicate number](https://leetcode-cn.com/problems/find-the-duplicate-number/) | [medium](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/287.py)|
| 344 | [reverse string](https://leetcode-cn.com/problems/reverse-string/) | [easy](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/344.py) |

#### Sliding Window

| Question Number| Official Website Link | Solution's Link |
|:-:|-|-|
|239|[sliding window maximum](https://leetcode-cn.com/problems/sliding-window-maximum/)|[hard](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/239.py)|

---

### Binary Search

| Question Number| Official Website Link | Solution's Link |
|:-:|-|-|
|033|[search in rotated sorted array i](https://leetcode-cn.com/problems/search-in-rotated-sorted-array-i/)|[medium](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/033.py)|
|034|[find first and last position of element in sorted array](https://leetcode-cn.com/problems/find-first-and-last-position-of-element-in-sorted-array/)|[medium](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/034.py)|
|069|[sqrtx](https://leetcode-cn.com/problems/sqrtx/)|[easy](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/069.py)|
|074|[search a 2d matrix](https://leetcode-cn.com/problems/search-a-2d-matrix/)|[medium](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/074.py)|
|081|[search in rotated sorted array ii](https://leetcode-cn.com/problems/search-in-rotated-sorted-array-ii/)|[medium](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/081.py)|
|153|[find minimum in rotated sorted array](https://leetcode-cn.com/problems/find-minimum-in-rotated-sorted-array/)|[medium](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/153.py)|
|240|[search a 2d matrix ii](https://leetcode-cn.com/problems/search-a-2d-matrix-ii/)|[medium](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/240.py)|
|540|[single element in a sorted array](https://leetcode-cn.com/problems/single-element-in-a-sorted-array/)|[medium](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/540.py)|
|704|[binary-search](https://leetcode-cn.com/problems/binary-search/)|[easy](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/704.py)|
|744|[find smallest letter greater than target](https://leetcode-cn.com/problems/find-smallest-letter-greater-than-target/submissions/)|[easy](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/744.py)|
|852|[peak index in a mountain array](https://leetcode-cn.com/problems/peak-index-in-a-mountain-array/)|[easy](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/852.py)|
|875|[koko eating bananas](https://leetcode-cn.com/problems/koko-eating-bananas/)|[medium](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/875.py)|
|1011|[capacity to ship packages within d days](https://leetcode-cn.com/problems/capacity-to-ship-packages-within-d-days/)|[medium](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/1011.py)|

---

### Stack

| Question Number| Official Website Link | Solution's Link |
|:-:|-|-|
|020|[valid parentheses](https://leetcode-cn.com/problems/valid-parentheses/)|[easy](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/020.py)|
|496|[next greater element i](https://leetcode-cn.com/problems/next-greater-element-i/)|[easy](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/496.py)|
|503|[next greater element ii](https://leetcode-cn.com/problems/next-greater-element-ii/)|[medium](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/503.py)|
|735|[asteroid collision](https://leetcode-cn.com/problems/asteroid-collision/)|[medium](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/735.py)|
|739|[daily temperatures](https://leetcode-cn.com/problems/daily-temperatures/)|[medium](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/739.py)|

---

### Hash Map

| Question Number| Official Website Link | Solution's Link |
|:-:|-|-|
|001|[Two Sum](https://leetcode-cn.com/problems/two-sum/)|[easy](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/001.py)|
|003|[longest substring without repeating characters](https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/)|[medium](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/003.py)|
|560|[subarray sum equals k](https://leetcode-cn.com/problems/subarray-sum-equals-k/)|[medium](https://github.com/MatNoble/leetcode/blob/main/LeetCodeSolutions/560.py)|