Skip to content

About

⚡ Daily LeetCode Problem Solutions in Python 3.12 — 244+ sub-millisecond optimized solutions spanning Easy, Medium & Hard with formal Big-O complexity proofs, 8 algorithmic patterns, and automated LeetSync CI/CD tracking.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1,363 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Daily LeetCode — High-Performance Algorithmic Solutions

LeetCode Python Problems Solved Automation Contributions Welcome License: MIT

A curated repository of 244+ daily LeetCode solutions engineered with Python 3.12, strict Big-O complexity proofs, top-percentile runtime optimizations, and automated LeetSync synchronization.


📌 Technical Overview & Engineering Standards

This repository serves as a systematic, continuous algorithmic practice vault designed for Tier-1 and FAANG technical interviews. Every solution in this repository adheres to high software engineering standards:

  • ⚡ Sub-Millisecond Execution: Solutions target 0ms (99th–100th percentile) runtime by leveraging optimal data structures (collections.deque, heapq, bisect, bitwise manipulation).
  • ⏱️ Formal Complexity Bounds: Every algorithm is designed to meet strict upper-bound asymptotic time complexity ($O(1)$, $O(\log N)$, or $O(N)$) and minimal auxiliary space overhead.
  • 🛡️ Edge Case Resilience: Explicit boundary testing for empty sets, null pointers, integer overflows, duplicate elements, and extreme constraints.
  • 🤖 Automated Synchronization: Integrated with LeetSync for automated bi-directional commit logging from live LeetCode submissions directly to GitHub.

📊 Summary & Progress Metrics

Difficulty Level Problems Solved Distribution Status Badge
🟢 Easy 58 23.8% ![](https://img.shields.io/badge/-Easy_58-brightgreen)
🟡 Medium 140 57.4% ![](https://img.shields.io/badge/-Medium_140-orange)
🔴 Hard 46 18.9% ![](https://img.shields.io/badge/-Hard_46-red)
🏆 Total Solved 244 100% ![](https://img.shields.io/badge/-244_Total-blue)

🧩 Point-to-Point Algorithmic Classification Matrix

The 244 solved problems in this repository span the following core computational paradigms:

Algorithmic Domain Key Underlying Principles Representative Solved Problems
⚡ Arrays, Hashing & Two Pointers Fast element lookup in $O(1)$, frequency counters, bidirectional inward convergence. #1 Two Sum, #11 Container With Most Water, #15 3Sum, #75 Sort Colors, #88 Merge Sorted Array, #118 Pascal's Triangle, #119 Pascal's Triangle II, #121 Best Time to Buy and Sell Stock, #122 Best Time to Buy and Sell Stock II, #125 Valid Palindrome, #128 Longest Consecutive Sequence, #153 Find Minimum in Rotated Sorted Array
🪟 Sliding Window & Substrings Dynamic subarray resizing, frequency map state tracking, character boundary optimization. #3 Longest Substring, #76 Minimum Window Substring, #1208 Max Nesting Depth, #1298 Reverse Substrings Between Parentheses
🔗 Linked Lists & Pointer Arithmetic Sentinel dummy heads, in-place node reversals, fast & slow tortoise-hare pointers. #2 Add Two Numbers, #61 Rotate List, #82 Remove Duplicates II, #86 Partition List, #92 Reverse Linked List II, #109 Sorted List to BST, #138 Copy List with Random Pointer, #141 Linked List Cycle, #142 Linked List Cycle II, #143 Reorder List, #146 LRU Cache, #148 Sort List, #206 Reverse Linked List
🌲 Binary Trees & Heaps DFS/BFS tree traversals, BST validation, min/max heap priority queues, path sums. #94 Inorder Traversal, #98 Validate BST, #100 Same Tree, #101 Symmetric Tree, #102 Level Order Traversal, #103 Zigzag Level Order, #105 Tree from Preorder & Inorder, #106 Tree from Inorder & Postorder, #108 Sorted Array to BST, #110 Balanced Binary Tree, #111 Min Depth, #112 Path Sum, #113 Path Sum II, #114 Flatten Binary Tree, #124 Binary Tree Max Path Sum, #129 Sum Root to Leaf
🔄 Backtracking & Recursion State-space exploration, branch pruning, constraint validation, combinatorial generation. #39 Combination Sum, #46 Permutations, #51 N-Queens, #77 Combinations, #78 Subsets, #90 Subsets II, #93 Restore IP Addresses, #131 Palindrome Partitioning, #301 Remove Invalid Parentheses
📈 Dynamic Programming Memoization, bottom-up tabulation, optimal substructure, DAG transitions. #53 Maximum Subarray, #62 Unique Paths, #64 Min Path Sum, #72 Edit Distance, #87 Scramble String, #91 Decode Ways, #97 Interleaving String, #115 Distinct Subsequences, #120 Triangle, #123 Best Time to Buy and Sell Stock III, #139 Word Break, #152 Maximum Product Subarray, #198 House Robber
🌐 Graph Theory & Grid Traversal Breadth-First Search (BFS), Depth-First Search (DFS), topological sort, binary lifting, grid components. #79 Word Search, #127 Word Ladder, #130 Surrounded Regions, #133 Clone Graph, #200 Number of Islands, #2349 Valid Parentheses Path, #2582 Minimum Score Path, #3852 Path Existence Queries II
🔢 Math, Bitwise, Stacks & Parentheses Monotonic stacks, bitwise FSM, parenthesis matching, Gray codes, greedy gas stations. #7 Reverse Integer, #20 Valid Parentheses, #43 Multiply Strings, #67 Add Binary, #89 Gray Code, #134 Gas Station, #135 Candy, #136 Single Number, #137 Single Number II, #150 Evaluate Reverse Polish Notation, #155 Min Stack, #886 Score of Parentheses, #957 Minimum Add to Make Parentheses Valid, #1078 Remove Outermost Parentheses, #1737 Max Nesting Depth, #4248 Count Commas II

🎯 Point-to-Point Problem-Solving Standards (The 5-Step Rubric)

Every solution follows a rigorous engineering standard:

  1. Input Boundary Validation: Explicit verification of array length limits ($N=0, N=1$), negative numbers, and boundary conditions.
  2. Invariant Discovery: Uncovering sorted order, prefix sum relationships, monotonic sequences, or frequency constraints.
  3. Data Structure Optimization: Replacing $O(N)$ searches with $O(1)$ Hash Maps, $O(\log N)$ Binary Search, or $O(1)$ Double-Ended Queues (collections.deque).
  4. Pruning & Early Termination: Halting backtracking branches immediately when candidate paths exceed current optimal bounds.
  5. Time & Space Documentation: Each code file contains formal Big-O asymptotic complexity analysis in its docstring.

🔄 Automated LeetSync Pipeline

┌───────────────────────────┐      ┌───────────────────────────┐      ┌───────────────────────────┐
│     LeetCode Platform     │ ──►  │      LeetSync Engine      │ ──►  │      GitHub Repository    │
│ Accepted Submission (0ms) │      │ Automated Code Packaging  │      │ Clean Commit with Metrics │
└───────────────────────────┘      └───────────────────────────┘      └───────────────────────────┘
  • When a problem is marked Accepted on LeetCode, LeetSync automatically extracts the solution, execution speed, and memory usage.
  • The solution is packaged into a self-contained problem directory with complete markdown problem statement and clean .py implementation.
  • Automatically commits with author attribution (Modi Preyal <modipreyal@gmail.com>), contributing directly to the GitHub activity streak.

📂 Repository Directory Structure

daily-leetcode/
├── 1-two-sum/
│   ├── README.md                              # Problem statement, examples & constraints
│   └── two-sum.py                             # Optimal Python 3.12 implementation
├── 124-binary-tree-maximum-path-sum/
│   ├── README.md
│   └── binary-tree-maximum-path-sum.py
├── 138-copy-list-with-random-pointer/
│   ├── README.md
│   └── copy-list-with-random-pointer.py
├── 139-word-break/
│   ├── README.md
│   └── word-break.py
├── 155-min-stack/
│   ├── README.md
│   └── min-stack.py
├── 301-remove-invalid-parentheses/
│   ├── README.md
│   └── remove-invalid-parentheses.py
├── 886-score-of-parentheses/
│   ├── README.md
│   └── score-of-parentheses.py
├── 957-minimum-add-to-make-parentheses-valid/
│   ├── README.md
│   └── minimum-add-to-make-parentheses-valid.py
├── 1078-remove-outermost-parentheses/
│   ├── README.md
│   └── remove-outermost-parentheses.py
├── CONTRIBUTING.md                            # Guidelines for community contributions
└── README.md                                  # Complete repository documentation & catalog

📝 Complete Problem Catalog (244 Solved)

# Problem Title Difficulty Language Solution File
1 Two Sum Easy Python 3.12 two-sum.py
2 Add Two Numbers Medium Python 3.12 add-two-numbers.py
3 Longest Substring Without Repeating Characters Medium Python 3.12 longest-substring-without-repeating-characters.py
4 Median of Two Sorted Arrays Hard Python 3.12 median-of-two-sorted-arrays.py
5 Longest Palindromic Substring Medium Python 3.12 longest-palindromic-substring.py
6 Zigzag Conversion Medium Python 3.12 zigzag-conversion.py
7 Reverse Integer Medium Python 3.12 reverse-integer.py
9 Palindrome Number Easy Python 3.12 palindrome-number.py
10 Regular Expression Matching Hard Python 3.12 regular-expression-matching.py
11 Container With Most Water Medium Python 3.12 container-with-most-water.py
12 Integer to Roman Medium Python 3.12 integer-to-roman.py
13 Roman to Integer Easy Python 3.12 roman-to-integer.py
14 Longest Common Prefix Easy Python 3.12 longest-common-prefix.py
15 3Sum Medium Python 3.12 3sum.py
16 3Sum Closest Medium Python 3.12 3sum-closest.py
17 Letter Combinations of a Phone Number Medium Python 3.12 letter-combinations-of-a-phone-number.py
18 4Sum Medium Python 3.12 4sum.py
19 Remove Nth Node From End of List Medium Python 3.12 remove-nth-node-from-end-of-list.py
20 Valid Parentheses Easy Python 3.12 valid-parentheses.py
21 Merge Two Sorted Lists Easy Python 3.12 merge-two-sorted-lists.py
22 Generate Parentheses Medium Python 3.12 generate-parentheses.py
23 Merge k Sorted Lists Hard Python 3.12 merge-k-sorted-lists.py
24 Swap Nodes in Pairs Medium Python 3.12 swap-nodes-in-pairs.py
25 Reverse Nodes in k-Group Hard Python 3.12 reverse-nodes-in-k-group.py
26 Remove Duplicates from Sorted Array Easy Python 3.12 remove-duplicates-from-sorted-array.py
27 Remove Element Easy Python 3.12 remove-element.py
28 Find the Index of the First Occurrence in a String Easy Python 3.12 find-the-index-of-the-first-occurrence-in-a-string.py
29 Divide Two Integers Medium Python 3.12 divide-two-integers.py
30 Substring with Concatenation of All Words Hard Python 3.12 substring-with-concatenation-of-all-words.py
31 Next Permutation Medium Python 3.12 next-permutation.py
32 Longest Valid Parentheses Hard Python 3.12 longest-valid-parentheses.py
33 Search in Rotated Sorted Array Medium Python 3.12 search-in-rotated-sorted-array.py
34 Find First and Last Position of Element in Sorted Array Medium Python 3.12 find-first-and-last-position-of-element-in-sorted-array.py
35 Search Insert Position Easy Python 3.12 search-insert-position.py
36 Valid Sudoku Medium Python 3.12 valid-sudoku.py
37 Sudoku Solver Hard Python 3.12 sudoku-solver.py
38 Count and Say Medium Python 3.12 count-and-say.py
39 Combination Sum Medium Python 3.12 combination-sum.py
40 Combination Sum II Medium Python 3.12 combination-sum-ii.py
41 First Missing Positive Hard Python 3.12 first-missing-positive.py
42 Trapping Rain Water Hard Python 3.12 trapping-rain-water.py
43 Multiply Strings Medium Python 3.12 multiply-strings.py
44 Wildcard Matching Hard Python 3.12 wildcard-matching.py
45 Jump Game II Medium Python 3.12 jump-game-ii.py
46 Permutations Medium Python 3.12 permutations.py
47 Permutations II Medium Python 3.12 permutations-ii.py
48 Rotate Image Medium Python 3.12 rotate-image.py
49 Group Anagrams Medium Python 3.12 group-anagrams.py
50 Pow(x, n) Medium Python 3.12 powx-n.py
51 N-Queens Hard Python 3.12 n-queens.py
52 N-Queens II Hard Python 3.12 n-queens-ii.py
53 Maximum Subarray Medium Python 3.12 maximum-subarray.py
54 Spiral Matrix Medium Python 3.12 spiral-matrix.py
55 Jump Game Medium Python 3.12 jump-game.py
56 Merge Intervals Medium Python 3.12 merge-intervals.py
57 Insert Interval Medium Python 3.12 insert-interval.py
58 Length of Last Word Easy Python 3.12 length-of-last-word.py
59 Spiral Matrix II Medium Python 3.12 spiral-matrix-ii.py
60 Permutation Sequence Hard Python 3.12 permutation-sequence.py
61 Rotate List Medium Python 3.12 rotate-list.py
62 Unique Paths Medium Python 3.12 unique-paths.py
63 Unique Paths II Medium Python 3.12 unique-paths-ii.py
64 Minimum Path Sum Medium Python 3.12 minimum-path-sum.py
65 Valid Number Hard Python 3.12 valid-number.py
66 Plus One Easy Python 3.12 plus-one.py
67 Add Binary Easy Python 3.12 add-binary.py
68 Text Justification Hard Python 3.12 text-justification.py
69 Sqrt(x) Easy Python 3.12 sqrtx.py
70 Climbing Stairs Easy Python 3.12 climbing-stairs.py
71 Simplify Path Medium Python 3.12 simplify-path.py
72 Edit Distance Medium Python 3.12 edit-distance.py
73 Set Matrix Zeroes Medium Python 3.12 set-matrix-zeroes.py
74 Search a 2D Matrix Medium Python 3.12 search-a-2d-matrix.py
75 Sort Colors Medium Python 3.12 sort-colors.py
76 Minimum Window Substring Hard Python 3.12 minimum-window-substring.py
77 Combinations Medium Python 3.12 combinations.py
78 Subsets Medium Python 3.12 subsets.py
79 Word Search Medium Python 3.12 word-search.py
80 Remove Duplicates from Sorted Array II Medium Python 3.12 remove-duplicates-from-sorted-array-ii.py
81 Search in Rotated Sorted Array II Medium Python 3.12 search-in-rotated-sorted-array-ii.py
82 Remove Duplicates from Sorted List II Medium Python 3.12 remove-duplicates-from-sorted-list-ii.py
83 Remove Duplicates from Sorted List Easy Python 3.12 remove-duplicates-from-sorted-list.py
84 Largest Rectangle in Histogram Hard Python 3.12 largest-rectangle-in-histogram.py
85 Maximal Rectangle Hard Python 3.12 maximal-rectangle.py
86 Partition List Medium Python 3.12 partition-list.py
87 Scramble String Hard Python 3.12 scramble-string.py
88 Merge Sorted Array Easy Python 3.12 merge-sorted-array.py
89 Gray Code Medium Python 3.12 gray-code.py
90 Subsets II Medium Python 3.12 subsets-ii.py
91 Decode Ways Medium Python 3.12 decode-ways.py
92 Reverse Linked List II Medium Python 3.12 reverse-linked-list-ii.py
93 Restore IP Addresses Medium Python 3.12 restore-ip-addresses.py
94 Binary Tree Inorder Traversal Easy Python 3.12 binary-tree-inorder-traversal.py
95 Unique Binary Search Trees II Medium Python 3.12 unique-binary-search-trees-ii.py
96 Unique Binary Search Trees Medium Python 3.12 unique-binary-search-trees.py
97 Interleaving String Medium Python 3.12 interleaving-string.py
98 Validate Binary Search Tree Medium Python 3.12 validate-binary-search-tree.py
99 Recover Binary Search Tree Medium Python 3.12 recover-binary-search-tree.py
100 Same Tree Easy Python 3.12 same-tree.py
101 Symmetric Tree Easy Python 3.12 symmetric-tree.py
102 Binary Tree Level Order Traversal Medium Python 3.12 binary-tree-level-order-traversal.py
103 Binary Tree Zigzag Level Order Traversal Medium Python 3.12 binary-tree-zigzag-level-order-traversal.py
104 Maximum Depth of Binary Tree Easy Python 3.12 maximum-depth-of-binary-tree.py
105 Construct Binary Tree from Preorder and Inorder Traversal Medium Python 3.12 construct-binary-tree-from-preorder-and-inorder-traversal.py
106 Construct Binary Tree from Inorder and Postorder Traversal Medium Python 3.12 construct-binary-tree-from-inorder-and-postorder-traversal.py
107 Binary Tree Level Order Traversal II Medium Python 3.12 binary-tree-level-order-traversal-ii.py
108 Convert Sorted Array to Binary Search Tree Easy Python 3.12 convert-sorted-array-to-binary-search-tree.py
109 Convert Sorted List to Binary Search Tree Medium Python 3.12 convert-sorted-list-to-binary-search-tree.py
110 Balanced Binary Tree Easy Python 3.12 balanced-binary-tree.py
111 Minimum Depth of Binary Tree Easy Python 3.12 minimum-depth-of-binary-tree.py
112 Path Sum Easy Python 3.12 path-sum.py
113 Path Sum II Medium Python 3.12 path-sum-ii.py
114 Flatten Binary Tree to Linked List Medium Python 3.12 flatten-binary-tree-to-linked-list.py
115 Distinct Subsequences Hard Python 3.12 distinct-subsequences.py
116 Populating Next Right Pointers in Each Node Medium Python 3.12 populating-next-right-pointers-in-each-node.py
117 Populating Next Right Pointers in Each Node II Medium Python 3.12 populating-next-right-pointers-in-each-node-ii.py
118 Pascal's Triangle Easy Python 3.12 pascals-triangle.py
119 Pascal's Triangle II Easy Python 3.12 pascals-triangle-ii.py
120 Triangle Medium Python 3.12 triangle.py
121 Best Time to Buy and Sell Stock Easy Python 3.12 best-time-to-buy-and-sell-stock.py
122 Best Time to Buy and Sell Stock II Medium Python 3.12 best-time-to-buy-and-sell-stock-ii.py
123 Best Time to Buy and Sell Stock III Hard Python 3.12 best-time-to-buy-and-sell-stock-iii.py
124 Binary Tree Maximum Path Sum Hard Python 3.12 binary-tree-maximum-path-sum.py
125 Valid Palindrome Easy Python 3.12 valid-palindrome.py
127 Word Ladder Hard Python 3.12 word-ladder.py
128 Longest Consecutive Sequence Medium Python 3.12 longest-consecutive-sequence.py
129 Sum Root to Leaf Numbers Medium Python 3.12 sum-root-to-leaf-numbers.py
130 Surrounded Regions Medium Python 3.12 surrounded-regions.py
131 Palindrome Partitioning Medium Python 3.12 palindrome-partitioning.py
133 Clone Graph Medium Python 3.12 clone-graph.py
134 Gas Station Medium Python 3.12 gas-station.py
135 Candy Hard Python 3.12 candy.py
136 Single Number Easy Python 3.12 single-number.py
137 Single Number II Medium Python 3.12 single-number-ii.py
138 Copy List with Random Pointer Medium Python 3.12 copy-list-with-random-pointer.py
139 Word Break Medium Python 3.12 word-break.py
141 Linked List Cycle Easy Python 3.12 linked-list-cycle.py
142 Linked List Cycle II Medium Python 3.12 linked-list-cycle-ii.py
143 Reorder List Medium Python 3.12 reorder-list.py
146 LRU Cache Medium Python 3.12 lru-cache.py
148 Sort List Medium Python 3.12 sort-list.py
150 Evaluate Reverse Polish Notation Medium Python 3.12 evaluate-reverse-polish-notation.py
152 Maximum Product Subarray Medium Python 3.12 maximum-product-subarray.py
153 Find Minimum in Rotated Sorted Array Medium Python 3.12 find-minimum-in-rotated-sorted-array.py
155 Min Stack Medium Python 3.12 min-stack.py
198 House Robber Medium Python 3.12 house-robber.py
200 Number of Islands Medium Python 3.12 number-of-islands.py
206 Reverse Linked List Easy Python 3.12 reverse-linked-list.py
287 Find the Duplicate Number Medium Python 3.12 find-the-duplicate-number.py
301 Remove Invalid Parentheses Hard Python 3.12 remove-invalid-parentheses.py
628 Maximum Product of Three Numbers Easy Python 3.12 maximum-product-of-three-numbers.py
678 Valid Parenthesis String Medium Python 3.12 valid-parenthesis-string.py
864 Image Overlap Medium Python 3.12 image-overlap.py
866 Rectangle Overlap Easy Python 3.12 rectangle-overlap.py
886 Score of Parentheses Medium Python 3.12 score-of-parentheses.py
909 Stone Game Medium Python 3.12 stone-game.py
957 Minimum Add to Make Parentheses Valid Medium Python 3.12 minimum-add-to-make-parentheses-valid.py
977 Distinct Subsequences II Hard Python 3.12 distinct-subsequences-ii.py
1078 Remove Outermost Parentheses Easy Python 3.12 remove-outermost-parentheses.py
1159 Smallest Subsequence of Distinct Characters Medium Python 3.12 smallest-subsequence-of-distinct-characters.py
1188 Brace Expansion II Hard Python 3.12 brace-expansion-ii.py
1208 Maximum Nesting Depth of Two Valid Parentheses Strings Medium Python 3.12 maximum-nesting-depth-of-two-valid-parentheses-strings.py
1212 Sequential Digits Medium Python 3.12 sequential-digits.py
1240 Stone Game II Medium Python 3.12 stone-game-ii.py
1256 Rank Transform of an Array Easy Python 3.12 rank-transform-of-an-array.py
1298 Reverse Substrings Between Each Pair of Parentheses Medium Python 3.12 reverse-substrings-between-each-pair-of-parentheses.py
1386 Shift 2D Grid Easy Python 3.12 shift-2d-grid.py
1487 Cinema Seat Allocation Medium Python 3.12 cinema-seat-allocation.py
1501 Circle and Rectangle Overlapping Medium Python 3.12 circle-and-rectangle-overlapping.py
1522 Stone Game III Hard Python 3.12 stone-game-iii.py
1573 Find Two Non-overlapping Sub-arrays Each With Target Sum Medium Python 3.12 find-two-non-overlapping-sub-arrays-each-with-target-sum.py
1574 Maximum Product of Two Elements in an Array Easy Python 3.12 maximum-product-of-two-elements-in-an-array.py
1617 Stone Game IV Hard Python 3.12 stone-game-iv.py
1644 Maximum Number of Non-Overlapping Substrings Hard Python 3.12 maximum-number-of-non-overlapping-substrings.py
1685 Stone Game V Hard Python 3.12 stone-game-v.py
1725 Number of Sets of K Non-Overlapping Line Segments Medium Python 3.12 number-of-sets-of-k-non-overlapping-line-segments.py
1737 Maximum Nesting Depth of the Parentheses Easy Python 3.12 maximum-nesting-depth-of-the-parentheses.py
1776 Minimum Operations to Reduce X to Zero Medium Python 3.12 minimum-operations-to-reduce-x-to-zero.py
1934 Evaluate the Bracket Pairs of a String Medium Python 3.12 evaluate-the-bracket-pairs-of-a-string.py
2002 Stone Game VIII Hard Python 3.12 stone-game-viii.py
2039 Sum Game Medium Python 3.12 sum-game.py
2106 Find Greatest Common Divisor of Array Easy Python 3.12 find-greatest-common-divisor-of-array.py
2156 Stone Game IX Medium Python 3.12 stone-game-ix.py
2182 Find the Minimum and Maximum Number of Nodes Between Critical Points Medium Python 3.12 find-the-minimum-and-maximum-number-of-nodes-between-critical-points.py
2212 Removing Minimum and Maximum From Array Medium Python 3.12 removing-minimum-and-maximum-from-array.py
2319 Longest Substring of One Repeating Character Hard Python 3.12 longest-substring-of-one-repeating-character.py
2347 Count Nodes Equal to Average of Subtree Medium Python 3.12 count-nodes-equal-to-average-of-subtree.py
2349 Check if There Is a Valid Parentheses String Path Hard Python 3.12 check-if-there-is-a-valid-parentheses-string-path.py
2559 Maximum Number of Non-overlapping Palindrome Substrings Hard Python 3.12 maximum-number-of-non-overlapping-palindrome-substrings.py
2582 Minimum Score of a Path Between Two Cities Medium Python 3.12 minimum-score-of-a-path-between-two-cities.py
2793 Count the Number of Complete Components Medium Python 3.12 count-the-number-of-complete-components.py
2914 Find the Safest Path in a Grid Medium Python 3.12 find-the-safest-path-in-a-grid.py
3150 Shortest and Lexicographically Smallest Beautiful String Medium Python 3.12 shortest-and-lexicographically-smallest-beautiful-string.py
3219 Make Lexicographically Smallest Array by Swapping Elements Medium Python 3.12 make-lexicographically-smallest-array-by-swapping-elements.py
3225 Length of Longest Subarray With at Most K Frequency Medium Python 3.12 length-of-longest-subarray-with-at-most-k-frequency.py
3236 Smallest Missing Integer Greater Than Sequential Prefix Sum Easy Python 3.12 smallest-missing-integer-greater-than-sequential-prefix-sum.py
3275 Minimum Number of Pushes to Type Word I Easy Python 3.12 minimum-number-of-pushes-to-type-word-i.py
3276 Minimum Number of Pushes to Type Word II Medium Python 3.12 minimum-number-of-pushes-to-type-word-ii.py
3349 Maximum Length Substring With Two Occurrences Easy Python 3.12 maximum-length-substring-with-two-occurrences.py
3375 Kth Smallest Amount With Single Denomination Combination Hard Python 3.12 kth-smallest-amount-with-single-denomination-combination.py
3558 Find a Safe Walk Through a Grid Medium Python 3.12 find-a-safe-walk-through-a-grid.py
3561 Remove Methods From Project Medium Python 3.12 remove-methods-from-project.py
3562 Maximum Score of Non-overlapping Intervals Hard Python 3.12 maximum-score-of-non-overlapping-intervals.py
3583 Sorted GCD Pair Queries Hard Python 3.12 sorted-gcd-pair-queries.py
3584 Find the Lexicographically Smallest Valid Sequence Medium Python 3.12 find-the-lexicographically-smallest-valid-sequence.py
3608 Find the Number of Subsequences With Equal GCD Hard Python 3.12 find-the-number-of-subsequences-with-equal-gcd.py
3626 Smallest Divisible Digit Product I Easy Python 3.12 smallest-divisible-digit-product-i.py
3635 Smallest Divisible Digit Product II Hard Python 3.12 smallest-divisible-digit-product-ii.py
3705 Find the Largest Almost Missing Integer Easy Python 3.12 find-the-largest-almost-missing-integer.py
3799 Unique 3-Digit Even Numbers Easy Python 3.12 unique-3-digit-even-numbers.py
3804 Maximize Active Section with Trade II Hard Python 3.12 maximize-active-section-with-trade-ii.py
3805 Maximize Active Section with Trade I Medium Python 3.12 maximize-active-section-with-trade-i.py
3811 Reverse Degree of a String Easy Python 3.12 reverse-degree-of-a-string.py
3812 Smallest Palindromic Rearrangement I Medium Python 3.12 smallest-palindromic-rearrangement-i.py
3813 Smallest Palindromic Rearrangement II Hard Python 3.12 smallest-palindromic-rearrangement-ii.py
3820 Number of Unique XOR Triplets II Medium Python 3.12 number-of-unique-xor-triplets-ii.py
3824 Number of Unique XOR Triplets I Medium Python 3.12 number-of-unique-xor-triplets-i.py
3831 Find X Value of Array I Medium Python 3.12 find-x-value-of-array-i.py
3838 Path Existence Queries in a Graph I Medium Python 3.12 path-existence-queries-in-a-graph-i.py
3840 Find X Value of Array II Hard Python 3.12 find-x-value-of-array-ii.py
3852 Path Existence Queries in a Graph II Hard Python 3.12 path-existence-queries-in-a-graph-ii.py
3859 Maximum Product of Two Digits Easy Python 3.12 maximum-product-of-two-digits.py
3869 Smallest Index With Digit Sum Equal to Index Easy Python 3.12 smallest-index-with-digit-sum-equal-to-index.py
3870 Minimum Moves to Clean the Classroom Medium Python 3.12 minimum-moves-to-clean-the-classroom.py
3918 Check Divisibility by Digit Sum and Product Easy Python 3.12 check-divisibility-by-digit-sum-and-product.py
3995 GCD of Odd and Even Sums Easy Python 3.12 gcd-of-odd-and-even-sums.py
4020 Lexicographically Smallest Permutation Greater Than Target Medium Python 3.12 lexicographically-smallest-permutation-greater-than-target.py
4033 Longest Subsequence With Non-Zero Bitwise XOR Medium Python 3.12 longest-subsequence-with-non-zero-bitwise-xor.py
4037 Lexicographically Smallest Palindromic Permutation Greater Than Target Hard Python 3.12 lexicographically-smallest-palindromic-permutation-greater-than-target.py
4080 Smallest Missing Multiple of K Easy Python 3.12 smallest-missing-multiple-of-k.py
4107 Find Missing Elements Easy Python 3.12 find-missing-elements.py
4135 Concatenate Non-Zero Digits and Multiply by Sum I Easy Python 3.12 concatenate-non-zero-digits-and-multiply-by-sum-i.py
4136 Concatenate Non-Zero Digits and Multiply by Sum II Medium Python 3.12 concatenate-non-zero-digits-and-multiply-by-sum-ii.py
4203 Count of Unfinished Tasks After Each Shift Medium Python 3.12 count-of-unfinished-tasks-after-each-shift.py
4242 Sum of GCD of Formed Pairs Medium Python 3.12 sum-of-gcd-of-formed-pairs.py
4245 Count Commas in Range Easy Python 3.12 count-commas-in-range.py
4248 Count Commas in Range II Medium Python 3.12 count-commas-in-range-ii.py
4256 Construct Uniform Parity Array I Easy Python 3.12 construct-uniform-parity-array-i.py
4258 Construct Uniform Parity Array II Medium Python 3.12 construct-uniform-parity-array-ii.py
4284 Smallest Stable Index I Easy Python 3.12 smallest-stable-index-i.py
4285 Smallest Stable Index II Medium Python 3.12 smallest-stable-index-ii.py
4323 Count Subarrays With Even Odd Ratio I Medium Python 3.12 count-subarrays-with-even-odd-ratio-i.py
4324 Count Subarrays With Even Odd Ratio II Hard Python 3.12 count-subarrays-with-even-odd-ratio-ii.py
4371 Maximize Pair Strength Using GCD Easy Python 3.12 maximize-pair-strength-using-gcd.py

🧪 Local Execution & Testing Guide

Prerequisites

  • Python 3.10+ (Python 3.12 recommended)

Run Any Solution Locally:

# Clone the repository
git clone https://github.com/preyal2/daily-leetcode.git
cd daily-leetcode

# Example 1: Run LeetCode 124 Binary Tree Maximum Path Sum
python -c "
from importlib import import_module
mod = import_module('124-binary-tree-maximum-path-sum.binary-tree-maximum-path-sum')
sol = mod.Solution()
TreeNode = mod.TreeNode
root = TreeNode(-10, TreeNode(9), TreeNode(20, TreeNode(15), TreeNode(7)))
print('Max Path Sum:', sol.maxPathSum(root))
"

# Example 2: Run LeetCode 155 Min Stack
python -c "
from importlib import import_module
mod = import_module('155-min-stack.min-stack')
MinStack = mod.MinStack
st = MinStack()
st.push(-2)
st.push(0)
st.push(-3)
print('Min Stack getMin():', st.getMin())
st.pop()
print('Top:', st.top())
print('Min Stack getMin():', st.getMin())
"

# Example 3: Run LeetCode 957 (921) Minimum Add to Make Parentheses Valid
python -c "
from importlib import import_module
mod = import_module('957-minimum-add-to-make-parentheses-valid.minimum-add-to-make-parentheses-valid')
sol = mod.Solution()
print('Min Add required:', sol.minAddToMakeValid('())'))
"

🤝 Contributing

Contributions, optimizations, and multi-language ports (Java, C++, TypeScript, Go) are welcome! Please refer to the CONTRIBUTING.md guide for PR instructions.


👨‍💻 Author

Modi Preyal

About

⚡ Daily LeetCode Problem Solutions in Python 3.12 — 244+ sub-millisecond optimized solutions spanning Easy, Medium & Hard with formal Big-O complexity proofs, 8 algorithmic patterns, and automated LeetSync CI/CD tracking.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages