|
1 | | -# LeetCode-in-Python |
2 | | -LeeteCode-in-Python is a GitHub repo with Python solutions to LeetCode problems. It offers clean, efficient, and well-documented code for interview prep, competitive programming, and mastering algorithms. Solutions are categorized by difficulty and include explanations for clarity. Regularly updated, it emphasizes Pythonic practices. |
| 1 | +# LeetCode Python Solutions |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +This repository contains Python solutions for various LeetCode problems. Each problem is organized in its own directory under the `Solution/` folder, with a `readme.md` file providing the problem description, examples, constraints, and solutions in multiple programming languages. |
| 6 | + |
| 7 | +## 🌟 Why Use This Repository? |
| 8 | + |
| 9 | +#### **"Success is the sum of small efforts, repeated day in and day out."** — Robert Collier |
| 10 | + |
| 11 | +This repository is designed to help you: |
| 12 | + |
| 13 | +- **Master Problem-Solving**: Tackle a wide range of LeetCode problems with clear and concise solutions. |
| 14 | +- **Learn Efficiently**: Understand optimized approaches and advanced techniques. |
| 15 | +- **Stay Motivated**: Progress step by step, and see your skills grow with every solved problem. |
| 16 | +- **Collaborate and Contribute**: Join a community of learners and developers to share knowledge and improve together. |
| 17 | + |
| 18 | +Whether you're preparing for coding interviews, enhancing your algorithmic skills, or just exploring the joy of problem-solving, this repository is your companion on the journey to success. |
| 19 | + |
| 20 | +--- |
| 21 | + |
| 22 | +## 📑 Table of Contents |
| 23 | + |
| 24 | +- [🚀 Features](#-features) |
| 25 | +- [📂 Repository Structure](#-repository-structure) |
| 26 | +- [🛠️ How to Use](#️-how-to-use) |
| 27 | +- [🌟 Highlights](#-highlights) |
| 28 | +- [🤝 Contributing](#-contributing) |
| 29 | + - [Steps to Contribute](#steps-to-contribute) |
| 30 | + - [Contribution Graph](#contribution-graph) |
| 31 | +- [📜 License](#-license) |
| 32 | +- [📊 Statistics](#-statistics) |
| 33 | +- [📌 Quick Links](#-quick-links) |
| 34 | +- [Index of LeetCode Python Solutions](#index-of-leetcode-python-solutions) |
| 35 | + |
| 36 | +## 🚀 Features |
| 37 | + |
| 38 | +- **Comprehensive Solutions**: Includes Python solutions for a wide range of LeetCode problems. |
| 39 | +- **Multi-Language Support**: Problem descriptions and solutions are available in multiple programming languages. |
| 40 | +- **Organized Structure**: Each problem is neatly organized in its own directory with a dedicated `readme.md` file. |
| 41 | +- **Interactive and Informative**: Easy-to-navigate structure with detailed explanations and examples. |
| 42 | + |
| 43 | +## 📂 Repository Structure |
| 44 | + |
| 45 | +```mermaid |
| 46 | +graph TD |
| 47 | + A[Root Directory] --> B[LICENSE] |
| 48 | + A --> C[README.md] |
| 49 | + A --> D[.gitattribute] |
| 50 | + A --> E[Solution/] |
| 51 | + A --> E12[gitignore] |
| 52 | + A --> E14[workflow] |
| 53 | + E --> F[LeetCode Qutions] |
| 54 | + F --> |follow instructions| F1[README.md] |
| 55 | + G[Readme.md] |
| 56 | + F --> |Edit For Contribute| G1[Solutions.py] |
| 57 | +``` |
| 58 | + |
| 59 | +## 🛠️ How to Use |
| 60 | + |
| 61 | +1. Navigate to the `Solution/` folder. |
| 62 | +2. Find the directory corresponding to the problem you are interested in (e.g., `104. Maximum Depth of Binary Tree`). |
| 63 | +3. Open the `readme.md` file for the problem description, examples, and solutions. |
| 64 | +4. Review the Python solution in the `.py` file. |
| 65 | + |
| 66 | +## 🌟 Highlights |
| 67 | + |
| 68 | +- **Beginner-Friendly**: Solutions are written in a clear and concise manner, making them easy to understand. |
| 69 | +- **Advanced Techniques**: Includes optimized solutions for complex problems. |
| 70 | +- **Regular Updates**: The repository is continuously updated with new problems and solutions. |
| 71 | + |
| 72 | +## 🤝 Contributing |
| 73 | + |
| 74 | +Contributions are welcome! If you have a better solution or additional test cases, feel free to submit a pull request. |
| 75 | + |
| 76 | +### Steps to Contribute |
| 77 | + |
| 78 | +1. Fork the repository. |
| 79 | +2. Create a new branch for your changes. |
| 80 | +3. Add your solution or update an existing one. |
| 81 | +4. Commit your changes with a descriptive message. |
| 82 | +5. Submit a pull request. |
| 83 | + |
| 84 | +### Contribution Graph |
| 85 | + |
| 86 | +```mermaid |
| 87 | +graph TD |
| 88 | + A[Contributors] --> B[Add New Solutions] |
| 89 | + A --> C[Fix Bugs in Existing Solutions] |
| 90 | + A --> D[Improve Documentation] |
| 91 | + A --> E[Add Test Cases] |
| 92 | + B --> F[Python Solutions] |
| 93 | + B --> G[Multi-Language Support] |
| 94 | + C --> H[Code Optimization] |
| 95 | + D --> I[Update README.md] |
| 96 | + D --> J[Add Problem Descriptions] |
| 97 | + E --> K[Edge Cases] |
| 98 | + E --> L[Performance Tests] |
| 99 | +``` |
| 100 | + |
| 101 | +### Contribution Graph |
| 102 | + |
| 103 | +```mermaid |
| 104 | +graph TB; |
| 105 | + A[Contributors] --> B[Fork] |
| 106 | + B --> C[Clone in your system] |
| 107 | + C --> D[Create Branch] |
| 108 | + D --> E[Add Solution or Update Existing One] |
| 109 | + E --> F[Commit Changes] |
| 110 | + F --> G[Push Changes] |
| 111 | + E --> L[Add Performance] |
| 112 | + L --> M[Add Test Cases] |
| 113 | + M --> N[Add Edge Cases] |
| 114 | + N --> O[ Performance Tests] -->H |
| 115 | + G --> H[Create Pull Request] |
| 116 | + H --> I[Merge Pull Request] |
| 117 | + I --> J[Add Reviewer of owner] |
| 118 | + J --> K[Add lebels] |
| 119 | + |
| 120 | +``` |
| 121 | + |
| 122 | +## 📜 License |
| 123 | + |
| 124 | +This repository is licensed under the MIT License. See the `LICENSE` file for more details. |
| 125 | + |
| 126 | +--- |
| 127 | + |
| 128 | +## 📊 Statistics |
| 129 | + |
| 130 | +- **Total Problems Solved**: 100+ (and counting!) |
| 131 | +- **Languages Supported**: Python, Java, C++, Go, TypeScript |
| 132 | +- **Difficulty Levels**: Easy, Medium, Hard |
| 133 | + |
| 134 | +--- |
| 135 | + |
| 136 | +## 📌 Quick Links |
| 137 | + |
| 138 | +- [LeetCode Website](https://leetcode.com/) |
| 139 | +- [Contribute to this Repo](https://github.com/your-repo-link) |
| 140 | +- [MIT License](LICENSE) |
| 141 | + |
| 142 | +--- |
| 143 | + |
| 144 | + |
| 145 | + |
| 146 | +## Index of LeetCode Python Solutions |
| 147 | + |
| 148 | +This index provides a quick overview of all the problems and solutions available in this repository. Each problem is organized under the `Solution/` folder, and older solutions are stored in the `privious/` folder. |
| 149 | + |
| 150 | +## 📂 Solution Directory |
| 151 | + |
| 152 | +### Problems by ID |
| 153 | + |
| 154 | +- [**1004. Max Consecutive Ones III**](Solution/1004.%20Max%20Consecutive%20Ones%20III/readme.md) |
| 155 | +- [**104. Maximum Depth of Binary Tree**](Solution/104.%20Maximum%20Depth%20of%20Binary%20Tree/readme.md) |
| 156 | +- [**11. Container With Most Water**](Solution/11.%20Container%20With%20Most%20Water/readme.md) |
| 157 | +- [**1161. Maximum Level Sum of a Binary Tree**](Solution/1161.%20Maximum%20Level%20Sum%20of%20a%20Binary%20Tree/readme.md) |
| 158 | +- [**1207. Unique Number of Occurrences**](Solution/1207.%20Unique%20Number%20of%20Occurrences/readme.md) |
| 159 | +- [**1372. Longest ZigZag Path in a Binary Tree**](Solution/1372.%20Longest%20ZigZag%20Path%20in%20a%20Binary%20Tree/readme.md) |
| 160 | +- [**1448. Count Good Nodes in Binary Tree**](Solution/1448.%20Count%20Good%20Nodes%20in%20Binary%20Tree/readme.md) |
| 161 | +- [**1456. Maximum Number of Vowels in a Substring of Given Length**](Solution/1456.%20Maximum%20Number%20of%20Vowels%20in%20a%20Substring%20of%20Given%20Length/readme.md) |
| 162 | +- [**1466. Reorder Routes to Make All Paths Lead to the City Zero**](Solution/1466.%20Reorder%20Routes%20to%20Make%20All%20Paths%20Lead%20to%20the%20City%20Zero/readme.md) |
| 163 | +- [**1493. Longest Subarray of 1's After Deleting One Element**](Solution/1493.%20Longest%20Subarray%20of%201's%20After%20Deleting%20One%20Element/readme.md) |
| 164 | +- [**151. Reverse Words in a String**](Solution/151.%20Reverse%20Words%20in%20a%20String/readme.md) |
| 165 | +- [**1657. Determine if Two Strings Are Close**](Solution/1657.%20Determine%20if%20Two%20Strings%20Are%20Close/readme.md) |
| 166 | +- [**1679. Max Number of K-Sum Pairs**](Solution/1679.%20Max%20Number%20of%20K-Sum%20Pairs/readme.md) |
| 167 | +- [**1732. Find the Highest Altitude**](Solution/1732.%20Find%20the%20Highest%20Altitude/readme.md) |
| 168 | +- [**1926. Nearest Exit from Entrance in Maze**](Solution/1926.%20Nearest%20Exit%20from%20Entrance%20in%20Maze/readme.md) |
| 169 | +- [**199. Binary Tree Right Side View**](Solution/199.%20Binary%20Tree%20Right%20Side%20View/readme.md) |
| 170 | +- [**206. Reverse Linked List**](Solution/206.%20Reverse%20Linked%20List/readme.md) |
| 171 | +- [**2095. Delete the Middle Node of a Linked List**](Solution/2095.%20Delete%20the%20Middle%20Node%20of%20a%20Linked%20List/readme.md) |
| 172 | +- [**2130. Maximum Twin Sum of a Linked List**](Solution/2130.%20Maximum%20Twin%20Sum%20of%20a%20Linked%20List/readme.md) |
| 173 | +- [**215. Kth Largest Element in an Array**](Solution/215.%20Kth%20Largest%20Element%20in%20an%20Array/readme.md) |
| 174 | +- [**2215. Find the Difference of Two Arrays**](Solution/2215.%20Find%20the%20Difference%20of%20Two%20Arrays/readme.md) |
| 175 | +- [**2336. Smallest Number in Infinite Set**](Solution/2336.%20Smallest%20Number%20in%20Infinite%20Set/readme.md) |
| 176 | +- [**2352. Equal Row and Column Pairs**](Solution/2352.%20Equal%20Row%20and%20Column%20Pairs/readme.md) |
| 177 | +- [**236. Lowest Common Ancestor of a Binary Tree**](Solution/236.%20Lowest%20Common%20Ancestor%20of%20a%20Binary%20Tree/readme.md) |
| 178 | +- [**238. Product of Array Except Self**](Solution/238.%20Product%20of%20Array%20Except%20Self/readme.md) |
| 179 | +- [**2390. Removing Stars From a String**](Solution/2390.%20Removing%20Stars%20From%20a%20String/readme.md) |
| 180 | +- [**2462. Total Cost to Hire K Workers**](Solution/2462.%20Total%20Cost%20to%20Hire%20K%20Workers/readme.md) |
| 181 | +- [**2542. Maximum Subsequence Score**](Solution/2542.%20Maximum%20Subsequence%20Score/readme.md) |
| 182 | +- [**283. Move Zeroes**](Solution/283.%20Move%20Zeroes/readme.md) |
| 183 | +- [**328. Odd Even Linked List**](Solution/328.%20Odd%20Even%20Linked%20List/readme.md) |
| 184 | +- [**334. Increasing Triplet Subsequence**](Solution/334.%20Increasing%20Triplet%20Subsequence/readme.md) |
| 185 | +- [**345. Reverse Vowels of a String**](Solution/345.%20Reverse%20Vowels%20of%20a%20String/readme.md) |
| 186 | +- [**374. Guess Number Higher or Lower**](Solution/374.%20Guess%20Number%20Higher%20or%20Lower/readme.md) |
| 187 | +- [**392. Is Subsequence**](Solution/392.%20Is%20Subsequence/readme.md) |
| 188 | +- [**394. Decode String**](Solution/394.%20Decode%20String/readme.md) |
| 189 | +- [**399. Evaluate Division**](Solution/399.%20Evaluate%20Division/readme.md) |
| 190 | +- [**437. Path Sum III**](Solution/437.%20Path%20Sum%20III/readme.md) |
| 191 | +- [**443. String Compression**](Solution/443.%20String%20Compression/readme.md) |
| 192 | +- [**450. Delete Node in a BST**](Solution/450.%20Delete%20Node%20in%20a%20BST/readme.md) |
| 193 | +- [**547. Number of Provinces**](Solution/547.%20Number%20of%20Provinces/readme.md) |
| 194 | +- [**643. Maximum Average Subarray I**](Solution/643.%20Maximum%20Average%20Subarray%20I/readme.md) |
| 195 | +- [**649. Dota2 Senate**](Solution/649.%20Dota2%20Senate/readme.md) |
| 196 | +- [**700. Search in a Binary Search Tree**](Solution/700.%20Search%20in%20a%20Binary%20Search%20Tree/readme.md) |
| 197 | +- [**724. Find Pivot Index**](Solution/724.%20Find%20Pivot%20Index/readme.md) |
| 198 | +- [**735. Asteroid Collision**](Solution/735.%20Asteroid%20Collision/readme.md) |
| 199 | +- [**841. Keys and Rooms**](Solution/841.%20Keys%20and%20Rooms/readme.md) |
| 200 | + |
| 201 | +## 📂 Previous Solutions Directory |
| 202 | + |
| 203 | +### Problems by ID |
| 204 | + |
| 205 | +- [**2115. Find All Possible Recipes from Given Supplies**](privious/2115.%20Find%20All%20Possible%20Recipes%20from%20Given%20Supplies.py) |
| 206 | +- [**2206. Divide Array Into Equal Pairs**](privious/2206.%20Divide%20Array%20Into%20Equal%20Pairs.py) |
| 207 | +- [**2226. Maximum Candies Allocated to K Children**](privious/2226.%20Maximum%20Candies%20Allocated%20to%20K%20Children.py) |
| 208 | +- [**2560. House Robber IV**](privious/2560.%20House%20Robber%20IV.py) |
| 209 | +- [**2594. Minimum Time to Repair Cars**](privious/2594.%20Minimum%20Time%20to%20Repair%20Cars.py) |
| 210 | +- [**3356. Zero Array Transformation II**](privious/3356.%20Zero%20Array%20Transformation%20II.py) |
| 211 | + |
| 212 | +--- |
| 213 | + |
| 214 | +For detailed problem descriptions and solutions, navigate to the respective directories. |
| 215 | + |
0 commit comments