kamyu104/LeetCode-Solutions

Là một dự án backend, kamyu104/LeetCode-Solutions đã đạt 6.1k sao trên GitHub, ngôn ngữ C++. 🏋️ Python / Modern C++ Solutions of All 4100 LeetCode Problems (Weekly Update)
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Snapshot
Cộng tác viên hàng đầu
Xem cộng tác viên hàng đầu
LeetCode
- R.I.P. to my old Leetcode repository, where there were
5.7k+stars and2.2k+forks (ever the top 3 in the field). - Since free questions may be even mistakenly taken down by some companies, only solutions will be post on now.
- There are new LeetCode questions every week. I'll keep updating for full summary and better solutions.
- For more problem solutions, you can see my LintCode, GoogleKickStart, GoogleCodeJamIO repositories.
- For more challenging problem solutions, you can also see my GoogleCodeJam, MetaHackerCup repositories.
- Hope you enjoy the journey of learning data structures and algorithms.
- Notes: "🔒" means your subscription of LeetCode premium membership is required for reading the question.
Solutions
- 0001 - 1000
- 1001 - 2000
- 2001 - 3000
- 3001 - Latest
Algorithms
- Bit Manipulation
- Array
- String
- Linked List
- Stack
- Queue
- Binary Heap
- Tree
- Hash Table
- Math
- Sort
- Two Pointers
- Recursion
- Binary Search
- Binary Search Tree
- Breadth-First Search
- Depth-First Search
- Backtracking
- Dynamic Programming
- Greedy
- Graph
- Geometry
- Simulation
- Constructive Algorithms
- Design
JavaScript
- JS
Database
- SQL
Pandas
- PD
Reference
- Links
Bit Manipulation
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3064 | Guess the Number Using Bitwise Questions I | C++ Python | O(logn) | O(1) | Medium | 🔒 | Bit Manipulation |
| 3094 | Guess the Number Using Bitwise Questions II | C++ Python | O(logr) | O(1) | Medium | 🔒 | Bit Manipulation |
| 3125 | Maximum Number That Makes Result of Bitwise AND Zero | C++ Python | O(1) | O(1) | Medium | 🔒 | Bit Manipulation |
| 3133 | Minimum Array End | C++ Python | O(logn) | O(1) | Medium | Bit Manipulation | |
| 3199 | Count Triplets with Even XOR Set Bits I | C++ Python | O(nlogr) | O(1) | Easy | 🔒 | Brute Force, Bit Manipulation, Parity |
| 3215 | Count Triplets with Even XOR Set Bits II | C++ Python | O(nlogr) | O(1) | Medium | 🔒 | Bit Manipulation, Parity |
| 3226 | Number of Bit Changes to Make Two Integers Equal | C++ Python | O(logn) | O(1) | Easy | Bit Manipulation | |
| 3289 | The Two Sneaky Numbers of Digitville | C++ Python | O(n) | O(1) | Easy | Bit Manipulation | |
| 3304 | Find the K-th Character in String Game I | C++ Python | O(n) | O(1) | Easy | Bitmasks | |
| 3307 | Find the K-th Character in String Game II | C++ Python | O(1) | O(1) | Hard | Bitmasks | |
| 3314 | Construct the Minimum Bitwise Array I | C++ Python | O(n) | O(1) | Easy | Bit Manipulation | |
| 3315 | Construct the Minimum Bitwise Array II | C++ Python | O(n) | O(1) | Medium | Bit Manipulation | |
| 3344 | Maximum Sized Array | C++ Python | precompute: O(max_s^(1/5) * log(max_s)) runtime: O(log(max_s)) | O(max_s^(1/5)) | Medium | 🔒 | Precompute, Bitmasks, Combinatorics, Binary Search |
| 3370 | Smallest Number With All Set Bits | C++ Python | O(1) | O(1) | Easy | Bit Manipulation | |
| 3566 | Partition Array into Two Equal Product Subsets | C++ Python | O(n * 2^n) | O(1) | Medium | Bitmasks | |
| 3632 | Subarrays with XOR at Least K | C++ Python | O(nlogr) | O(t) | Hard | 🔒 | Bitmasks, Prefix Sum, Trie |
| 3646 | Next Special Palindrome Number | C++ Python | precompute: O(9 * 2^9 + 16 * p + plogp) runtime: O(logp) | O(p) | Hard | Precompute, Bitmasks, Sort, Binary Search | |
| 3702 | Longest Subsequence With Non-Zero Bitwise XOR | C++ Python | O(n) | O(1) | Medium | Bitmasks | |
| 3750 | Minimum Number of Flips to Reverse Binary String | C++ Python | O(logn) | O(1) | Easy | Bitmasks | |
| 3766 | Minimum Operations to Make Binary Palindrome | C++ Python | precompute: O(sqrt(r) * logr) runtime: O(r) | O(r) | Medium | Precompute, Bitmasks, Two Pointers | |
| 3769 | Sort Integers by Binary Reflection | C++ Python | O(nlogr + nlogn) | O(n) | Easy | Sort, Bitmasks | |
| 3782 | Last Remaining Integer After Alternating Deletion Operations | C++ Python | O(1) | O(1) | Hard | Bitmasks, Simulation | |
| 3827 | Count Monobit Integers | C++ Python | O(logn) | O(1) | Easy | Bitmasks | |
| 3950 | Exactly One Consecutive Set Bits Pair | C++ Python | O(1) | O(1) | Easy | Bit Manipulation | |
| 4005 | Minimum Operations to Make Array Equal III | C++ Python | O(nlogr) | O(n) | Hard | 🔒 | Freq Table, Bit Manipulation |
| 4092 | Binary Digit Score | C++ Python | O(1) | O(1) | Easy | Bit Manipulation |
Array
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3009 | Maximum Number of Intersections on the Chart | C++ Python | O(nlogn) | O(n) | Hard | 🔒 | Sort, Line Sweep, Coordinate Compression |
| 3010 | Divide an Array Into Subarrays With Minimum Cost I | C++ Python | O(n) | O(1) | Easy | Array, Quick Select | |
| 3015 | Count the Number of Houses at a Certain Distance I | C++ Python | O(n) | O(n) | Medium | Math, Prefix Sum, Difference Array | |
| 3017 | Count the Number of Houses at a Certain Distance II | C++ Python | O(n) | O(1) | Hard | Math, Prefix Sum, Difference Array | |
| 3026 | Maximum Good Subarray Sum | C++ Python | O(n) | O(n) | Medium | Prefix Sum | |
| 3028 | Ant on the Boundary | C++ Python | O(n) | O(1) | Easy | Prefix Sum | |
| 3030 | Find the Grid of Region Average | C++ Python | O(m * n) | O(m * n) | Medium | Array | |
| 3033 | Modify the Matrix | C++ Python | O(m * n) | O(1) | Easy | Array | |
| 3038 | Maximum Number of Operations With the Same Score I | C++ Python | O(n) | O(1) | Easy | Array | |
| 3065 | Minimum Operations to Exceed Threshold Value I | C++ Python | O(n) | O(1) | Easy | Array | |
| 3069 | Distribute Elements Into Two Arrays I | C++ Python | O(n) | O(n) | Easy | Array | |
| 3070 | Count Submatrices with Top-Left Element and Sum Less Than k | C++ Python | O(n * m) | O(1) | Medium | Array, Prefix Sum | |
| 3071 | Minimum Operations to Write the Letter Y on a Grid | C++ Python | O(n^2) | O(1) | Medium | Array | |
| 3079 | Find the Sum of Encrypted Integers | C++ Python | O(nlogr) | O(1) | Easy | Array | |
| 3096 | Minimum Levels to Gain More Points | C++ Python | O(n) | O(n) | Medium | Prefix Sum | |
| 3105 | Longest Strictly Increasing or Strictly Decreasing Subarray | C++ Python | O(n) | O(1) | Easy | Array | |
| 3127 | Make a Square with the Same Color | C++ Python | O((n - w + 1)^2 * w^2) | O(1) | Easy | Array | |
| 3131 | Find the Integer Added to Array I | C++ Python | O(n) | O(1) | Easy | Array | |
| 3142 | Check if Grid Satisfies Conditions | C++ Python | O(m * n) | O(1) | Easy | Array | |
| 3147 | Taking Maximum Energy From the Mystic Dungeon | C++ Python | O(n) | O(1) | Medium | Array | |
| 3151 | Special Array I | C++ Python | O(n) | O(1) | Easy | Array | |
| 3152 | Special Array II | C++ Python | O(n + q) | O(n) | Medium | Prefix Sum | |
| 3153 | Sum of Digit Differences of All Pairs | C++ Python | O(nlogr) | O(10 * logr) | Medium | Prefix Sum | |
| 3159 | Find Occurrences of an Element in an Array | C++ Python | O(n + q) | O(n) | Medium | Array | |
| 3173 | Bitwise OR of Adjacent Elements | C++ Python | O(n) | O(1) | Easy | 🔒 | Array |
| 3187 | Peaks in Array | C++ Python | O(n + qlogn) | O(n) | Hard | BIT, Fenwick Tree | |
| 3195 | Find the Minimum Area to Cover All Ones I | C++ Python | O(n * m) | O(1) | Medium | Array | |
| 3224 | Minimum Array Changes to Make Differences Equal | C++ Python | O(n + k) | O(k) | Medium | Prefix Sum, Difference Array | |
| 3279 | Maximum Total Area Occupied by Pistons | C++ Python | O(h) | O(h) | Hard | 🔒 | Line Sweep, Difference Array |
| 3285 | Find Indices of Stable Mountains | C++ Python | O(n) | O(1) | Easy | Array | |
| 3300 | Minimum Element After Replacement With Digit Sum | C++ Python | O(nlogr) | O(1) | Easy | Array | |
| 3330 | Find the Original Typed String I | C++ Python | O(n) | O(1) | Easy | Array | |
| 3334 | Find the Maximum Factor Score of Array | C++ Python | O(nlogr) | O(n) | Medium | Prefix Sum | |
| 3349 | Adjacent Increasing Subarrays Detection I | C++ Python | O(n) | O(1) | Easy | Array | |
| 3350 | Adjacent Increasing Subarrays Detection II | C++ Python | O(n) | O(1) | Medium | Array | |
| 3353 | Minimum Total Operations | C++ Python | O(n) | O(1) | Easy | 🔒 | Array |
| 3354 | Make Array Elements Equal to Zero | C++ Python | O(n) | O(n) | Easy | CodeChef Starters 146 - Bouncing Ball | Prefix Sum |
| 3355 | Zero Array Transformation I | C++ Python | O(n + q) | O(n) | Medium | Line Sweep | |
| 3361 | Shift Distance Between Two Strings | C++ Python | O(n + 26) | O(26) | Medium | Prefix Sum | |
| 3379 | Transformed Array | C++ Python | O(n) | O(1) | Easy | Array | |
| 3380 | Maximum Area Rectangle With Point Constraints I | C++ Python | O(nlogn) | O(n) | Medium | Sort, Brute Force, BIT, Fenwick Tree, Hash Table | |
| 3382 | Maximum Area Rectangle With Point Constraints II | C++ Python | O(nlogn) | O(n) | Hard | Sort, BIT, Fenwick Tree, Hash Table | |
| 3386 | Button with Longest Push Time | C++ Python | O(n) | O(1) | Easy | Array | |
| 3392 | Count Subarrays of Length Three With a Condition | C++ Python | O(n) | O(1) | Easy | Array | |
| 3400 | Maximum Number of Matching Indices After Right Shifts | C++ Python | O(n^2) | O(1) | Medium | 🔒 | Brute Force |
| 3417 | Zigzag Grid Traversal With Skip | C++ Python | O(n * m) | O(1) | Easy | Array | |
| 3423 | Maximum Difference Between Adjacent Elements in a Circular Array | C++ Python | O(n) | O(1) | Easy | Array | |
| 3427 | Sum of Variable Length Subarrays | C++ Python | O(n) | O(n) | Easy | Difference Array | |
| 3432 | Count Partitions with Even Sum Difference | C++ Python | O(n) | O(1) | Easy | Prefix Sum | |
| 3440 | Reschedule Meetings for Maximum Free Time II | C++ Python | O(n) | O(1) | Medium | Array | |
| 3446 | Sort Matrix by Diagonals | C++ Python | O(n^2 * logn) | O(n^2) | Medium | Array, Sort | |
| 3452 | Sum of Good Numbers | C++ Python | O(n) | O(1) | Easy | Array | |
| 3467 | Transform Array by Parity | C++ Python | O(n) | O(1) | Easy | Array | |
| 3502 | Minimum Cost to Reach Every Position | C++ Python | O(n) | O(1) | Easy | Prefix Sum | |
| 3514 | Number of Unique XOR Triplets II | C++ Python | O(nlogn) | O(n) | Medium | Fast Walsh–Hadamard Transform, FWHT, Fast Subset Transform, FST, Hash Table | |
| 3531 | Count Covered Buildings | C++ Python | O(n) | O(n) | Medium | Array | |
| 3537 | Fill a Special Grid | C++ Python | O(4^n) | O(1) | Medium | Divide and Conquer, Array | |
| 3540 | Minimum Time to Visit All Houses | C++ Python | O(n + q) | O(n) | Medium | 🔒 | Prefix Sum |
| 3546 | Equal Sum Grid Partition I | C++ Python | O(m * n) | O(1) | Medium | Array | |
| 3548 | Equal Sum Grid Partition II | C++ Python | O(m * n) | O(m * n) | Hard | Array, Hash Table | |
| 3549 | Multiply Two Polynomials | C++ Python | O((n + m) * log(n + m)) | O(n + m) | Hard | 🔒 | Fast Fourier Transform, FFT |
| 3550 | Smallest Index With Digit Sum Equal to Index | C++ Python | O(nlogr) | O(1) | Easy | Array | |
| 3569 | Maximize Count of Distinct Primes After Split | C++ Python | O(r + nlogn + qlogn) | O(r + n) | Medium | Number Theory, BST, Sorted List, Segment Tree | |
| 3637 | Trionic Array I | C++ Python | O(n) | O(1) | Easy | Array | |
| 3643 | Flip Square Submatrix Vertically | C++ Python | O(k^2) | O(1) | Easy | Array | |
| 3653 | XOR After Range Multiplication Queries I | C++ Python | O(qlogm + (q + n) * sqrt(n)) | O(n * sqrt(n)) | Medium | Sqrt Decomposition, Difference Array, Fast Exponentiation, Simulation | |
| 3655 | XOR After Range Multiplication Queries II | C++ Python | O(qlogm + (q + n) * sqrt(n)) | O(n * sqrt(n)) | Hard | Sqrt Decomposition, Difference Array, Fast Exponentiation | |
| 3674 | Minimum Operations to Equalize Array | C++ Python | O(n) | O(1) | Easy | Array | |
| 3683 | Earliest Time to Finish One Task | C++ Python | O(n) | O(1) | Easy | Array | |
| 3687 | Library Late Fee Calculator | C++ Python | O(n) | O(1) | Easy | 🔒 | Array |
| 3688 | Bitwise OR of Even Numbers in an Array | C++ Python | O(n) | O(1) | Easy | Array | |
| 3696 | Maximum Distance Between Unequal Words in Array I | C++ Python | O(n * l) | O(1) | Easy | 🔒 | Array |
| 3700 | Number of ZigZag Arrays II | C++ Python | O((r - l)^3 * logn) | O((r - l)^2) | Hard | Matrix Exponentiation | |
| 3701 | Compute Alternating Sum | C++ Python | O(n) | O(1) | Easy | Array | |
| 3706 | Maximum Distance Between Unequal Words in Array II | C++ Python | O(n * l) | O(1) | Medium | 🔒 | Array |
| 3707 | Equal Score Substrings | C++ Python | O(n) | O(1) | Easy | Array, Prefix Sum | |
| 3708 | Longest Fibonacci Subarray | C++ Python | O(n) | O(1) | Medium | Array | |
| 3719 | Longest Balanced Subarray I | C++ Python | O(nlogn) | O(n) | Medium | Brute Force, Segment Tree, Binary Search, Prefix Sum | |
| 3721 | Longest Balanced Subarray II | C++ Python | O(nlogn) | O(n) | Hard | Segment Tree, Binary Search, Prefix Sum | |
| 3736 | Minimum Moves to Equal Array Elements III | C++ Python | O(n) | O(1) | Easy | Array | |
| 3737 | Count Subarrays With Majority Element I | C++ Python | O(n) | O(n) | Medium | Freq Table, Prefix Sum | |
| 3738 | Longest Non-Decreasing Subarray After Replacing at Most One Element | C++ Python | O(n) | O(n) | Medium | Array, Prefix Sum | |
| 3739 | Count Subarrays With Majority Element II | C++ Python | O(n) | O(n) | Hard | Freq Table, Prefix Sum | |
| 3751 | Total Waviness of Numbers in Range I | C++ Python | O(nlogn) | O(logn) | Medium | Brute Force | |
| 3756 | Concatenate Non-Zero Digits and Multiply by Sum II | C++ Python | O(n) | O(n) | Medium | Prefix Sum | |
| 3762 | Minimum Operations to Equalize Subarrays | C++ Python | O((n + q) * logn) | O(nlogn) | Hard | Prefix Sum, Coordinate Compression, Persistent Segment Tree, Binary Search | |
| 3774 | Absolute Difference Between Maximum and Minimum K Elements | C++ Python | O(n) | O(1) | Easy | Sort, Quick Select | |
| 3788 | Maximum Score of a Split | C++ Python | O(n) | O(1) | Medium | Prefix Sum | |
| 3809 | Best Reachable Tower | C++ Python | O(n) | O(1) | Medium | Array | |
| 3814 | Maximum Capacity Within Budget | C++ Python | O(n + b) | O(b) | Medium | Hash Table, Prefix Sum, Sort, Mono Stack, Binary Search | |
| 3818 | Minimum Prefix Removal to Make Array Strictly Increasing | C++ Python | O(n) | O(1) | Medium | Array | |
| 3819 | Rotate Non Negative Elements | C++ Python | O(n) | O(n) | Medium | Array | |
| 3833 | Count Dominant Indices | C++ Python | O(n) | O(1) | Easy | Array | |
| 3861 | Minimum Capacity Box | C++ Python | O(n) | O(1) | Easy | Array | |
| 3862 | Find the Smallest Balanced Index | C++ Python | O(n) | O(1) | Medium | Prefix Sum | |
| 3865 | Reverse K Subarrays | C++ Python | O(n) | O(1) | Medium | 🔒 | Array |
| 3880 | Minimum Absolute Difference Between Two Values | C++ Python | O(n) | O(1) | Easy | Array | |
| 3886 | Sum of Sortable Integers | C++ Python | O(nlog(logn)) | O(n) | Hard | Prefix Sum, Number Theory | |
| 3898 | Find the Degree of Each Vertex | C++ Python | O(n * m) | O(1) | Easy | Array | |
| 3903 | Smallest Stable Index I | C++ Python | O(n) | O(n) | Easy | Prefix Sum | |
| 3904 | Smallest Stable Index II | C++ Python | O(n) | O(n) | Medium | Prefix Sum | |
| 3907 | Count Smaller Elements With Opposite Parity | C++ Python | O(nlogn) | O(n) | Medium | 🔒 | Sort, Coordinate Compression, BIT, Fenwick Tree |
| 3909 | Compare Sums of Bitonic Parts | C++ Python | O(n) | O(1) | Medium | Array | |
| 3912 | Valid Elements in an Array | C++ Python | O(n) | O(n) | Medium | Prefix Sum | |
| 3915 | Maximum Sum of Alternating Subsequence With Distance at Least K | C++ Python | O(nlogn) | O(n) | Hard | Sort, Coordinate Compression, BIT, Fenwick Tree, Sliding Window, DP | |
| 3918 | Sum of Primes Between Number and Its Reverse | C++ Python | precompute: O(r) runtime: O(1) | O(r) | Medium | Number Theory, Linear Sieve of Eratosthenes, Prefix Sum | |
| 3925 | Concatenate Array With Reverse | C++ Python | O(n) | O(1) | Easy | Array | |
| 3933 | Largest Local Values in a Matrix II | C++ Python | O(n * m * logn * logm) | O(n * m * logn * logm) | Medium | RMQ, 2D Sparse Table | |
| 3936 | Minimum Swaps to Move Zeros to End | C++ Python | O(n) | O(1) | Easy | Array | |
| 3938 | Maximum Path Intersection Sum in a Grid | C++ Python | O(n * m) | O(1) | Medium | Array, Kadane's Algorithm | |
| 3940 | Limit Occurrences in Sorted Array | C++ Python | O(n) | O(1) | Easy | Array, Inplace | |
| 3942 | Minimum Operations to Sort a Permutation | C++ Python | O(n) | O(1) | Medium | Array | |
| 3943 | Number of Pairs After Increment | C++ Python | O(n + m + q * sqrt(m * n)) | O(n + m) | Hard | Freq Table, Sqrt Decomposition | |
| 3951 | Minimum Energy to Maintain Brightness | C++ Python | O(nlogn) | O(1) | Medium | Sort, Line Sweep | |
| 3951 | Minimum Energy to Maintain Brightness | C++ Python | O(nlogn) | O(1) | Medium | Sort, Line Sweep | |
| 3963 | Create Grid With Exactly One Path | C++ Python | O(m * n) | O(1) | Easy | Array | |
| 3978 | Unique Middle Element | C++ Python | O(n) | O(1) | Easy | Array | |
| 3979 | Maximum Valid Pair Sum | C++ Python | O(n) | O(n) | Medium | Prefix Sum | |
| 3982 | Sum of Integers with Maximum Digit Range | C++ Python | O(nlogr) | O(1) | Easy | Array | |
| 3985 | Palindromic Subarray Sum | C++ Python | O(n) | O(n) | Hard | Prefix Sum, Manacher's Algorithm | |
| 3998 | Transform Binary String Using Subsequence Sort | C++ Python | O(n * m) | O(n) | Hard | Prefix Sum | |
| 4006 | Count Valid Prefixes | C++ Python | O(n) | O(1) | Easy | Prefix Sum | |
| 4010 | Maximize Pair Strength Using GCD | C++ Python | O(n^2 * logr) | O(1) | Easy | Brute Force, Sort, Pruning | |
| 4011 | Count Subarrays With Even Odd Ratio I | C++ Python | O(nlogn) | O(n) | Medium | Prefix Sum, Sort, Coordinate Compression, BIT, Fenwick Tree, Brute Force | |
| 4012 | Count of Unfinished Tasks After Each Shift | C++ Python | O(n + mlogn) | O(n) | Medium | Prefix Sum, Binary Search | |
| 4013 | Count Subarrays With Even Odd Ratio II | C++ Python | O(nlogn) | O(n) | Hard | Prefix Sum, Sort, Coordinate Compression, BIT, Fenwick Tree | |
| 4017 | Peaks in Array II | C++ Python | O(nlogn + qlogn) | O(n) | Hard | BIT, Fenwick Tree | |
| 4020 | Elevator Requests I | C++ Python | O(m) | O(1) | Easy | Array | |
| 4021 | Minimum Operations to Make a Rotated Palindrome I | C++ Python | O(nlogn) | O(n) | Medium | Brute Force, NTT | |
| 4024 | Nearest Available Drone | C++ Python | O(n) | O(1) | Easy | Array | |
| 4028 | Minimum Operations to Make a Rotated Palindrome II | C++ Python | O(nlogn) | O(n) | Hard | 🔒 | NTT |
| 4051 | Count Subarrays with Distant Sums | C++ Python | O(nlogn) | O(n) | Hard | Prefix Sum, Sorted List, Ordered Set, BIT, Fenwick Tree | |
| 4052 | Cyclically Shift Rows and Columns | C++ Python | O(n^2) | O(1) | Easy | Array, Inplace | |
| 4056 | Number of Intersecting Interval Pairs I | C++ Python | O(nlogn) | O(n) | Easy | Brute Force, Sort, Line Sweep | |
| 4057 | Number of Intersecting Interval Pairs II | C++ Python | O(nlogn) | O(n) | Medium | Sort, Line Sweep | |
| 4058 | Maximum Pulse Value After One Subarray Rotation | C++ Python | O(n) | O(1) | Medium | Prefix Sum, Hash Table | |
| 4062 | Transform Array Using Pair Operations | C++ Python | O(n) | O(1) | Medium | Array | |
| 4063 | Longest Subarray Divisible by K with At Most One Negation I | C++ Python | O(n + k^2) | O(k) | Medium | Prefix Sum, Hash Table, Brute Force | |
| 4064 | Longest Subarray Divisible by K with At Most One Negation II | C++ Python | O(n + k^2) | O(k) | Hard | Prefix Sum, Hash Table | |
| 4073 | Count Good Strings | C++ Python | O(logr) | O(1) | Hard | Matrix Fast Exponentiation | |
| 4083 | Minimum Deletions to Make Array Sharp | C++ Python | O(n) | O(1) | Easy | Array | |
| 4088 | Difference Between Peaks and Valleys | C++ Python | O(n) | O(1) | Easy | Array | |
| 4097 | Minimum Value of Merged Integers | C++ Python | O(nlogr) | O(1) | Easy | Array | |
| 4099 | Minimum Operations to Sort With Locked Indices | C++ Python | O(nlogn) | O(n) | Medium | Sorted List, Ordered Set, BIT, Fenwick Tree |
String
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3019 | Number of Changing Keys | C++ Python | O(n) | O(1) | Easy | String | |
| 3023 | Find Pattern in Infinite Stream I | C++ Python | O(p + n) | O(p) | Medium | 🔒 | String, KMP Algorithm |
| 3029 | Minimum Time to Revert Word to Initial State I | C++ Python | O(n) | O(n) | Medium | String, Z-Function, Brute Force | |
| 3031 | Minimum Time to Revert Word to Initial State II | C++ Python | O(n) | O(n) | Hard | String, Z-Function | |
| 3034 | Number of Subarrays That Match a Pattern I | C++ Python | O(n) | O(m) | Medium | Brute Force, String, KMP Algorithm | |
| 3036 | Number of Subarrays That Match a Pattern II | C++ Python | O(n) | O(m) | Hard | String, KMP Algorithm | |
| 3037 | Find Pattern in Infinite Stream II | C++ Python | O(p + n) | O(p) | Hard | 🔒 | String, KMP Algorithm |
| 3042 | Count Prefix and Suffix Pairs I | C++ Python | O(n * l) | O(t) | Easy | Trie, Brute Force | |
| 3043 | Find the Length of the Longest Common Prefix | C++ Python | O((n + m) * l) | O(t) | Medium | Trie, Hash Table | |
| 3045 | Count Prefix and Suffix Pairs II | C++ Python | O(n * l) | O(t) | Hard | Trie | |
| 3076 | Shortest Uncommon Substring in an Array | C++ Python | O(n * l^2) | O(t) | Medium | Trie | |
| 3093 | Longest Common Suffix Queries | C++ Python | O((n + q) * l) | O(t) | Hard | Trie | |
| 3110 | Score of a String | C++ Python | O(n) | O(1) | Easy | String | |
| 3136 | Valid Word | C++ Python | O(n) | O(1) | Easy | String | |
| 3163 | String Compression III | C++ Python | O(n) | O(1) | Medium | String | |
| 3210 | Find the Encrypted String | C++ Python | O(n) | O(1) | Medium | String | |
| 3271 | Hash Divided String | C++ Python | O(n) | O(1) | Medium | String | |
| 3280 | Convert Date to Binary | C++ Python | O(1) | O(1) | Easy | String | |
| 3303 | Find the Occurrence of First Almost Equal Substring | C++ Python | O(n + m) | O(n + m) | Hard | Z-Function | |
| 3324 | Find the Sequence of Strings Appeared on the Screen | C++ Python | O(n^2) | O(1) | Medium | String | |
| 3340 | Check Balanced String | C++ Python | O(n) | O(1) | Easy | String | |
| 3407 | Substring Matching Pattern | C++ Python | O(n + m) | O(m) | Easy | String, KMP Algorithm | |
| 3455 | Shortest Matching Substring | C++ Python | O(n + m) | O(n + m) | Hard | String, KMP Algorithm, Two Pointers | |
| 3456 | Find Special Substring of Length K | C++ Python | O(n) | O(1) | Easy | String | |
| 3491 | Phone Number Prefix | C++ Python | O(l * nlogn) | O(1) | Easy | 🔒 | Trie, Sort |
| 3498 | Reverse Degree of a String | C++ Python | O(n) | O(1) | Easy | String | |
| 3529 | Count Cells in Overlapping Horizontal and Vertical Substrings | C++ Python | O(n * m) | O(n * m) | Medium | Z-Function | |
| 3571 | Find the Shortest Superstring II | C++ Python | O(n + m) | O(n + m) | Easy | 🔒 | KMP Algorithm |
| 3582 | Generate Tag for Video Caption | C++ Python | O(n) | O(1) | Easy | String | |
| 3598 | Longest Common Prefix Between Adjacent Strings After Removals | C++ Python | O(n * l) | O(n) | Medium | LCP, Prefix Sum | |
| 3606 | Coupon Code Validator | C++ Python | O(l * nlogn) | O(n * l) | Easy | Hash Table, Sort | |
| 3744 | Find Kth Character in Expanded String | C++ Python | O(n) | O(1) | Medium | 🔒 | String |
| 3746 | Minimum String Length After Balanced Removals | C++ Python | O(n) | O(1) | Medium | String | |
| 3748 | Count Stable Subarrays | C++ Python | O(n + q) | O(n) | Hard | Prefix Sum | |
| 3758 | Convert Number Words to Digits | C++ Python | O(n) | O(1) | Medium | 🔒 | String |
| 3775 | Reverse Words With Same Vowel Count | C++ Python | O(n) | O(1) | Medium | String, Inplace | |
| 3777 | Minimum Deletions to Make Alternating Substring | C++ Python | O((n + q) * logn) | O(n) | Hard | BIT, Fenwick Tree | |
| 3794 | Reverse String Prefix | C++ Python | O(n) | O(1) | Easy | String | |
| 3813 | Vowel-Consonant Score | C++ Python | O(n) | O(1) | Easy | String | |
| 3823 | Reverse Letters Then Special Characters in a String | C++ Python | O(n) | O(1) | Easy | String | |
| 3838 | Weighted Word Mapping | C++ Python | O(n * l) | O(1) | Easy | String | |
| 3856 | Trim Trailing Vowels | C++ Python | O(n) | O(1) | Easy | String | |
| 3860 | Unique Email Groups | C++ Python | O(n * l) | O(n * l) | Medium | 🔒 | String, Hash Table |
| 3884 | First Matching Character From Both Ends | C++ Python | O(n) | O(1) | Medium | String | |
| 3931 | Check Adjacent Digit Differences | C++ Python | O(n) | O(1) | Easy | String | |
| 3941 | Password Strength | C++ Python | O(n) | O(1) | Medium | String, Hash Table | |
| 3986 | Number of Elapsed Seconds Between Two Times | C++ Python | O(1) | O(1) | Easy | String | |
| 3999 | Minimum Number of String Groups Through Transformations | C++ Python | O(n * l) | O(n * l) | Hard | Hash Table, String | |
| 4030 | Check ASCII Palindromic | C++ Python | O(n) | O(1) | Easy | String, Bitmasks | |
| 4043 | Count Rotations With Exactly K Equal Adjacent Pairs | C++ Python | O(n) | O(1) | Easy | String | |
| 4070 | Minimum Rotations to Dial a Number I | C++ Python | O(n) | O(1) | Easy | String | |
| 4071 | Minimum Rotations to Dial a Number II | C++ Python | O(n) | O(1) | Medium | String |
Linked List
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3062 | Winner of the Linked List Game | C++ Python | O(n) | O(1) | Easy | 🔒 | Linked List |
| 3063 | Linked List Frequency | C++ Python | O(n) | O(1) | Medium | 🔒 | Linked List |
| 3217 | Delete Nodes From Linked List Present in Array | C++ Python | O(n) | O(m) | Medium | Hash Table, Linked List | |
| 3263 | Convert Doubly Linked List to Array I | C++ Python | O(n) | O(1) | Easy | 🔒 | Linked List |
| 3294 | Convert Doubly Linked List to Array II | C++ Python | O(n) | O(1) | Medium | 🔒 | Linked List |
Stack
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3113 | Find the Number of Subarrays Where Boundary Elements Are Maximum | C++ Python | O(n) | O(n) | Hard | Mono Stack, Combinatorics | |
| 3174 | Clear Digits | C++ Python | O(n) | O(1) | Easy | Stack, Two Pointers | |
| 3676 | Count Bowl Subarrays | C++ Python | O(n) | O(n) | Medium | Mono Stack | |
| 3703 | Remove K-Balanced Substrings | C++ Python | O(n) | O(n) | Medium | Stack | |
| 3749 | Evaluate Valid Expressions | C++ Python | O(n) | O(n) | Hard | 🔒 | Stack |
| 3834 | Merge Adjacent Equal Elements | C++ Python | O(n) | O(1) | Medium | Stack, Simulation | |
| 3878 | Count Good Subarrays | C++ Python | O(n) | O(n) | Hard | Combinatorics, Mono Stack | |
| 4054 | Count Shadow Pairs I | C++ Python | O(n) | O(n) | Medium | Freq Table, Mono Stack | |
| 4055 | Count Shadow Pairs II | C++ Python | O(nlogn) | O(n) | Hard | Coordinate Compression, Merge Sort, Mono Stack |
Queue
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|
Binary Heap
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3066 | Minimum Operations to Exceed Threshold Value II | C++ Python | O(nlogn) | O(n) | Medium | Simulation, Heap | |
| 3080 | Mark Elements on Array by Performing Queries | C++ Python | O(q + nlogn) | O(n) | Medium | Hash Table, Heap | |
| 3092 | Most Frequent IDs | C++ Python | O(nlogn) | O(n) | Medium | Heap, BST, Sorted List | |
| 3256 | Maximum Value Sum by Placing Three Rooks I | C++ Python | O(m * n) | O(m + n) | Hard | Heap, Brute Force | |
| 3257 | Maximum Value Sum by Placing Three Rooks II | C++ Python | O(m * n) | O(m + n) | Hard | Heap, Brute Force | |
| 3275 | K-th Nearest Obstacle Queries | C++ Python | O(qlogk) | O(k) | Medium | Heap | |
| 3684 | Maximize Sum of At Most K Distinct Elements | C++ Python | O(nlogk) | O(k) | Easy | Heap, Sort | |
| 3691 | Maximum Total Subarray Value II | C++ Python | O((n + k) * logn) | O(n) | Hard | Heap, Sort, Two Pointers, RMQ, Sparse Table, Segment Tree | |
| 3781 | Maximum Score After Binary Swaps | C++ Python | O(nlogn) | O(n) | Medium | Heap | |
| 3962 | Maximum Subarray Sum After at Most K Swaps | C++ Python | O(n^2 * logk) | O(n) | Hard | Prefix Sum, Heap, DP | |
| 4004 | Minimum Moves to Balance Circular Array II | C++ Python | O(n^2 * logn) | O(n) | Hard | 🔒, variant of Codeforces Round #13 C | L1 Isotonic Regression, Heap, Greedy, Graph, Min-Cost Max-Flow, MCMF, Successive Shortest Path, SSP, Dijkstra's Algorithm, Johnson Potential |
Tree
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3109 | Find the Index of Permutation | C++ Python | O(nlogn) | O(n) | Medium | 🔒, variant of Count of Smaller Numbers After Self | BIT, Fenwick Tree, Combinatorics |
| 3515 | Shortest Path in a Weighted Tree | C++ Python | O(nlogn) | O(n) | Hard | BIT, Fenwick Tree, DFS | |
| 3553 | Minimum Weighted Subgraph With the Required Paths II | C++ Python | O(n + q) | O(n + q) | Hard | Tree, DFS, Tarjan's Offline LCA Algorithm | |
| 3558 | Number of Ways to Assign Edge Weights I | C++ Python | O(n) | O(n) | Medium | Tree, BFS, Combinatorics | |
| 3559 | Number of Ways to Assign Edge Weights II | C++ Python | O(n + q) | O(n + q) | Medium | Tree, DFS, Tarjan's Offline LCA Algorithm, Combinatorics | |
| 3585 | Find Weighted Median Node in Tree | C++ Python | O(n + qlogh) | O(n + q) | Hard | Tree, DFS, Tarjan's Offline LCA Algorithm, Binary Search, Prefix Sum | |
| 3715 | Sum of Perfect Square Ancestors | C++ Python | precompute: O(r) runtime: O(nlogx) | O(r + n) | Hard | Tree, Number Theory, Linear Sieve of Eratosthenes, Freq Table, DFS | |
| 3841 | Palindromic Path Queries in a Tree | C++ Python | O((n + q) * logn) | O(n) | Hard | DFS, HLD, Heavy-Light Decomposition, LCA, Binary Lifting, BIT, Fenwick Tree | |
| 3879 | Maximum Distinct Path Sum in a Binary Tree | C++ Python | O(n^2) | O(n) | Medium | DFS, BFS | |
| 3973 | Distinct Gate Paths to LCA | C++ Python | O(nlogn + qlogn) | O(nlogn) | Hard | 🔒 | DFS, LCA, Binary Lifting |
| 3997 | Count Dominant Nodes in a Binary Tree | C++ Python | O(n) | O(h) | Medium | DFS | |
| 4100 | Minimum Cost Path With Even XOR Parity | C++ Python | O(n) | O(n) | Hard | Hash Table, DFS, Tree DP |
Hash Table
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3005 | Count Elements With Maximum Frequency | C++ Python | O(n) | O(n) | Easy | Freq Table | |
| 3039 | Apply Operations to Make String Empty | C++ Python | O(n) | O(1) | Medium | Freq Table | |
| 3044 | Most Frequent Prime | C++ Python | precompute: O(10^MAX_N_M) runtime: O(n * m * (n + m)) | O(10^MAX_N_M + n * m * (n + m)) | Medium | Number Theory, Linear Sieve of Eratosthenes, Freq Table | |
| 3046 | Split the Array | C++ Python | O(n) | O(n) | Easy | Freq Table | |
| 3078 | Match Alphanumerical Pattern in Matrix I | C++ Python | O(n * m * r * c) | O(1) | Medium | 🔒 | Brute Force, Hash Table |
| 3083 | Existence of a Substring in a String and Its Reverse | C++ Python | O(n) | O(min(n, 26^2)) | Easy | Hash Table | |
| 3120 | Count the Number of Special Characters I | C++ Python | O(n + 26) | O(26) | Easy | Hash Table | |
| 3121 | Count the Number of Special Characters II | C++ Python | O(n + 26) | O(26) | Medium | Hash Table | |
| 3137 | Minimum Number of Operations to Make Word K-Periodic | C++ Python | O(n) | O(n) | Medium | Freq Table | |
| 3138 | Minimum Length of Anagram Concatenation | C++ Python | O(sqrt(n) * n + 26 * nlogn) | O(26) | Medium | Number Theory, Freq Table | |
| 3143 | Maximum Points Inside the Square | C++ Python | O(n + 26) | O(26) | Medium | Hash Table | |
| 3146 | Permutation Difference between Two Strings | C++ Python | O(n + 26) | O(26) | Easy | Hash Table | |
| 3158 | Find the XOR of Numbers Which Appear Twice | C++ Python | O(n) | O(n) | Easy | Hash Table | |
| 3160 | Find the Number of Distinct Colors Among the Balls | C++ Python | O(q) | O(q) | Medium | Freq Table | |
| 3167 | Better Compression of String | C++ Python | O(n + 26) | O(26) | Medium | 🔒 | Freq Table, Counting Sort |
| 3184 | Count Pairs That Form a Complete Day I | C++ Python | O(n + 24) | O(24) | Easy | Freq Table | |
| 3185 | Count Pairs That Form a Complete Day II | C++ Python | O(n + 24) | O(24) | Medium | Freq Table | |
| 3223 | Minimum Length of String After Operations | C++ Python | O(n + 26) | O(26) | Medium | Freq Table | |
| 3237 | Alt and Tab Simulation | C++ Python | O(n) | O(n) | Medium | 🔒 | Hash Table |
| 3238 | Find the Number of Winning Players | C++ Python | O(p) | O(min(n * c, p) | Easy | Freq Table | |
| 3245 | Alternating Groups III | C++ Python | O(nlogn + qlogn) | O(n) | Hard | BST, Sorted List, Freq Table, BIT, Fenwick Tree | |
| 3295 | Report Spam Message | C++ Python | O(n + m) | O(m) | Medium | Hash Table | |
| 3365 | Rearrange K Substrings to Form Target String | C++ Python | O(n) | O(n) | Medium | Freq Table | |
| 3371 | Identify the Largest Outlier in an Array | C++ Python | O(n) | O(n) | Medium | Freq Table | |
| 3396 | Minimum Number of Operations to Make Elements in Array Distinct | C++ Python | O(n + r) | O(r) | Easy | Freq Table | |
| 3404 | Count Special Subsequences | C++ Python | O(n^2) | O(n^2) | Medium | Freq Table, Number Theory | |
| 3438 | Find Valid Pair of Adjacent Digits in String | C++ Python | O(n) | O(1) | Easy | Freq Table | |
| 3442 | Maximum Difference Between Even and Odd Frequency I | C++ Python | O(n + 26) | O(26) | Easy | Freq Table | |
| 3450 | Maximum Students on a Single Bench | C++ Python | O(n) | O(n) | Easy | 🔒 | Hash Table, Unordered Set |
| 3471 | Find the Largest Almost Missing Integer | C++ Python | O(n) | O(n) | Easy | Freq Table | |
| 3487 | Maximum Unique Subarray Sum After Deletion | C++ Python | O(n) | O(n) | Easy | Hash Table | |
| 3488 | Closest Equal Element Queries | C++ Python | O(n) | O(n) | Medium | Hash Table | |
| 3527 | Find the Most Common Response | C++ Python | O(n * l) | O(n * l) | Medium | Hash Table, Freq Table | |
| 3541 | Find Most Frequent Vowel and Consonant | C++ Python | O(n + 26) | O(26) | Easy | Freq Table | |
| 3572 | Maximize Y‑Sum by Picking a Triplet of Distinct X‑Values | C++ Python | O(n) | O(n) | Medium | Hash Table, Quick Select | |
| 3581 | Count Odd Letters from Number | C++ Python | O(logn) | O(26) | Easy | 🔒 | Freq Table |
| 3591 | Check if Any Element Has Prime Frequency | C++ Python | precompute: O(MAX_N) runtime: O(n) | O(MAX_N) | Easy | Freq Table, Number Theory, Linear Sieve of Eratosthenes | |
| 3636 | Threshold Majority Queries | C++ Python | O(nlogn + qlogq + (n + q) * sqrt(n) * logn) | O(q + n) | Hard | Sort, Coordinate Compression, Sqrt Decomposition, Mo's Algorithm, Freq Table, Sorted List, BST | |
| 3662 | Filter Characters by Frequency | C++ Python | O(n + 26) | O(26) | Easy | 🔒 | Freq Table |
| 3663 | Find The Least Frequent Digit | C++ Python | O(logn + 10) | O(10) | Easy | Freq Table | |
| 3668 | Restore Finishing Order | C++ Python | O(n + min(8, n)) | O(min(8, n)) | Easy | Hash Table | |
| 3678 | Smallest Absent Positive Greater Than Average | C++ Python | O(n) | O(n) | Easy | Hash Table | |
| 3682 | Minimum Index Sum of Common Elements | C++ Python | O(n + m) | O(n) | Medium | 🔒 | Hash Table |
| 3692 | Majority Frequency Characters | C++ Python | O(n + 26) | O(26) | Easy | Freq Table | |
| 3694 | Distinct Points Reachable After Substring Removal | C++ Python | O(n) | O(n) | Medium | Hash Table | |
| 3712 | Sum of Elements With Frequency Divisible by K | C++ Python | O(n) | O(n) | Easy | Freq Table | |
| 3713 | Longest Balanced Substring I | C++ Python | O(n * (a + n)) | O(a) | Medium | Freq Table | |
| 3714 | Longest Balanced Substring II | C++ Python | O(n) | O(n) | Medium | Hash Table, Prefix Sum | |
| 3718 | Smallest Missing Multiple of K | C++ Python | O(n) | O(n) | Easy | Hash Table | |
| 3728 | Stable Subarrays With Equal Boundary and Interior Sum | C++ Python | O(n) | O(n) | Medium | Freq Table, Prefix Sum | |
| 3729 | Count Distinct Subarrays Divisible by K in Sorted Array | C++ Python | O(n) | O(min(n, k)) | Hard | Freq Table, Prefix Sum | |
| 3755 | Find Maximum Balanced XOR Subarray Length | C++ Python | O(n) | O(n) | Medium | Hash Table, Prefix Sum | |
| 3760 | Maximum Substrings With Distinct Start | C++ Python | O(n + 26) | O(26) | Medium | Hash Table | |
| 3761 | Minimum Absolute Distance Between Mirror Pairs | C++ Python | O(nlogr) | O(n) | Medium | Hash Table | |
| 3773 | Maximum Number of Equal Length Runs | C++ Python | O(n) | O(sqrt(n)) | Medium | 🔒 | Freq Table |
| 3779 | Minimum Number of Operations to Have Distinct Elements | C++ Python | O(n) | O(n) | Medium | Hash Table | |
| 3784 | Minimum Deletion Cost to Make All Characters Equal | C++ Python | O(n + 26) | O(26) | Medium | Freq Table | |
| 3803 | Count Residue Prefixes | C++ Python | O(n + 26) | O(26) | Easy | Hash Table | |
| 3804 | Number of Centered Subarrays | C++ Python | O(n^2) | O(n) | Medium | Hash Table | |
| 3805 | Count Caesar Cipher Pairs | C++ Python | O(n * m) | O(n * m) | Medium | Freq Table | |
| 3810 | Minimum Operations to Reach Target Array | C++ Python | O(n) | O(n) | Medium | Hash Table | |
| 3837 | Delayed Count of Equal Elements | C++ Python | O(n) | O(n) | Medium | 🔒 | Freq Table |
| 3839 | Number of Prefix Connected Groups | C++ Python | O(n * k) | O(n * k) | Medium | Freq Table | |
| 3842 | Toggle Light Bulbs | C++ Python | O(n + r) | O(r) | Easy | Freq Table, Sort | |
| 3843 | First Element with Unique Frequency | C++ Python | O(n) | O(n) | Medium | Freq Table | |
| 3846 | Total Distance to Type a String Using One Finger | C++ Python | O(n) | O(n) | Medium | 🔒 | Hash Table |
| 3848 | Check Digitorial Permutation | C++ Python | O(logn + 10) | O(10) | Medium | Freq Table | |
| 3852 | Smallest Pair With Different Frequencies | C++ Python | O(n) | O(n) | Easy | Freq Table | |
| 3866 | First Unique Even Element | C++ Python | O(n) | O(n) | Easy | Freq Table | |
| 3889 | Mirror Frequency Distance | C++ Python | O(n + 36) | O(36) | Medium | Freq Table | |
| 3890 | Integers With Multiple Sum of Two Cubes | C++ Python | O(n^(2/3) * logn) | O(n^(2/3)) | Medium | Brute Force, Freq Table, Sort | |
| 3900 | Longest Balanced Substring After One Swap | C++ Python | O(n) | O(n) | Medium | variant of Contiguous Array | Hash Table |
| 3901 | Good Subsequence Queries | C++ Python | precompute: O(rlog(logr)) runtime: O(r + n + q) | O(rlog(logr) + n) | Medium | Number Theory, Freq Table | |
| 3913 | Sort Vowels by Frequency | C++ Python | O(n) | O(1) | Medium | Freq Table, Sort | |
| 3917 | Count Indices With Opposite Parity | C++ Python | O(n) | O(1) | Easy | Freq Table | |
| 3921 | Score Validator | C++ Python | O(n) | O(1) | Easy | Freq Table | |
| 3926 | Count Valid Word Occurrences | C++ Python | O(n) | O(n) | Medium | Freq Table | |
| 3945 | Digit Frequency Score | C++ Python | O(logn) | O(1) | Easy | Freq Table | |
| 3960 | Frequency Balance Subarray | C++ Python | O(n^2) | O(n) | Medium | Sort, Coordinate Compression, Freq Table | |
| 4007 | Widest Possible Fence | C++ Python | O(n + c^2) | O(c^2) | Medium | Freq Table | |
| 4038 | Count Integers Appearing in a Single Block | C++ Python | O(n) | O(n) | Easy | Freq Table | |
| 4048 | Count Values With Equally Spaced Occurrences I | C++ Python | O(n) | O(n) | Easy | Hash Table | |
| 4049 | Count Values With Equally Spaced Occurrences II | C++ Python | O(n) | O(n) | Medium | Hash Table | |
| 4066 | Maximum Equal Adjacent Pairs After at Most One Replacement | C++ Python | O(n) | O(n) | Medium | Freq Table | |
| 4074 | Maximum Product Pair With Target Sum | C++ Python | O(n) | O(n) | Easy | Hash Table | |
| 4090 | Count Magical Substring Pairs I | C++ Python | O(26 * n) | O(n) | Medium | Hash Table, Prefix Sum, Brute Force, Bitmasks | |
| 4091 | Count Magical Substring Pairs II | C++ Python | O(26 * n) | O(n) | Hard | Hash Table, Prefix Sum | |
| 4094 | Count Frequency Staircase Subarrays I | C++ Python | O(n * sqrt(n)) | O(n) | Medium | Hash Table, Brute Force, Freq Table | |
| 4095 | Count Frequency Staircase Subarrays II | C++ Python | O(n * sqrt(n)) | O(n) | Hard | Hash Table |
Math
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3001 | Minimum Moves to Capture The Queen | C++ Python | O(1) | O(1) | Medium | Math | |
| 3007 | Maximum Number That Sum of the Prices Is Less Than or Equal to K | C++ Python | O(max(logk, x) * log((logk) / x)) | O((logk) / x) | Medium | Bit Manipulation, Binary Search, Combinatorics | |
| 3021 | Alice and Bob Playing Flower Game | C++ Python | O(1) | O(1) | Medium | Combinatorics | |
| 3024 | Type of Triangle II | C++ Python | O(1) | O(1) | Easy | Math | |
| 3032 | Count Numbers With Unique Digits II | C++ Python | O(logb) | O(1) | Easy | 🔒, variant of Count Numbers With Unique Digits | Brute Force, Hash Table, Bitmasks, Combinatorics |
| 3047 | Find the Largest Area of Square Inside Two Rectangles | C++ Python | O(n^2) | O(1) | Meidum | Brute Force, Math | |
| 3084 | Count Substrings Starting and Ending with Given Character | C++ Python | O(n) | O(1) | Meidum | Combinatorics | |
| 3091 | Apply Operations to Make Sum of Array Greater Than or Equal to k | C++ Python | O(logn) | O(1) | Meidum | Codeforces Round #674 C | Math |
| 3099 | Harshad Number | C++ Python | O(logx) | O(1) | Easy | Math | |
| 3102 | Minimize Manhattan Distances | C++ Python | O(n) | O(1) | Hard | Math | |
| 3115 | Maximum Prime Difference | C++ Python | O(r + n) | O(r) | Medium | Array, Number Theory, Linear Sieve of Eratosthenes | |
| 3128 | Right Triangles | C++ Python | O(n * m) | O(min(n, m)) | Medium | Array, Combinatorics, Freq Table | |
| 3154 | Find Number of Ways to Reach the K-th Stair | C++ Python | O(logk) | O(logk) | Hard | Combinatorics | |
| 3155 | Maximum Number of Upgradable Servers | C++ Python | O(n) | O(1) | Medium | 🔒 | Math |
| 3162 | Find the Number of Good Pairs I | C++ Python | O(rlogr + n + m) | O(r) | Easy | Brute Force, Number Theory, Freq Table | |
| 3164 | Find the Number of Good Pairs II | C++ Python | O(rlogr + n + m) | O(r) | Medium | Number Theory, Freq Table | |
| 3178 | Find the Child Who Has the Ball After K Seconds | C++ Python | O(1) | O(1) | Easy | Math | |
| 3179 | Find the N-th Value After K Seconds | C++ Python | O(n + k) | O(n + k) | Medium | Prefix Sum, Combinatorics | |
| 3183 | The Number of Ways to Make the Sum | C++ Python | O(1) | O(1) | Medium | 🔒 | Math, DP |
| 3190 | Find Minimum Operations to Make All Elements Divisible by Three | C++ Python | O(n) | O(1) | Easy | Math | |
| 3200 | Maximum Height of a Triangle | C++ Python | O(logn) | O(1) | Easy | Simulation, Math | |
| 3222 | Find the Winning Player in Coin Game | C++ Python | O(1) | O(1) | Easy | Math | |
| 3227 | Vowels Game in a String | C++ Python | O(n) | O(1) | Medium | Math | |
| 3232 | Find if Digit Game Can Be Won | C++ Python | O(n) | O(1) | Easy | Brute Force, Game Theory | |
| 3247 | Number of Subsequences with Odd Sum | C++ Python | O(n) | O(1) | Medium | 🔒 | Combinatorics, Fast Exponentiation, DP |
| 3250 | Find the Count of Monotonic Pairs I | C++ Python | O(n + r) | O(n + r) | Hard | Combinatorics, Stars and Bars, DP, Prefix Sum | |
| 3251 | Find the Count of Monotonic Pairs II | C++ Python | O(n + r) | O(n + r) | Hard | Combinatorics, Stars and Bars, DP, Prefix Sum | |
| 3270 | Find the Key of the Numbers | C++ Python | O(d) | O(1) | Easy | Math | |
| 3272 | Find the Count of Good Integers | C++ Python | O(n + 10 * 10^((n + 1)/2)) | O(n + 10 * (10 * nHr(10, n/2))) | Hard | Combinatorics, Freq Table | |
| 3274 | Check if Two Chessboard Squares Have the Same Color | C++ Python | O(1) | O(1) | Easy | Math, Parity | |
| 3284 | Sum of Consecutive Subarrays | C++ Python | O(n) | O(1) | Medium | 🔒 | Combinatorics |
| 3299 | Sum of Consecutive Subsequences | C++ Python | O(n) | O(n) | Hard | 🔒 | Combinatorics, Prefix Sum, DP |
| 3312 | Sorted GCD Pair Queries | C++ Python | O(rlogr + qlogr) | O(r) | Hard | Number Theory, Freq Table, Prefix Sum, Binary Search | |
| 3317 | Find the Number of Possible Ways for an Event | C++ Python | precompute: O(max_n^2 + max_y * min(max_n, max_x)) runtime: O(min(n, x)) | O(max_n^2 + max_y * min(max_n, max_x)) | Hard | DP, Combinatorics | |
| 3326 | Minimum Division Operations to Make Array Non Decreasing | C++ Python | precompute: O(r) runtime: O(n) | O(r) | Medium | Greedy, Number Theory, Linear Sieve of Eratosthenes | |
| 3339 | Find the Number of K-Even Arrays | C++ Python | O(n) | O(n) | Medium | 🔒 | DP, Stars and Bars, Combinatorics |
| 3345 | Smallest Divisible Digit Product I | C++ Python | O(logn) | O(1) | Easy | Brute Force | |
| 3348 | Smallest Divisible Digit Product II | C++ Python | O(n + logt) | O(1) | Hard | Freq Table, Greedy, Prefix Sum, Number Theory | |
| 3360 | Stone Removal Game | C++ Python | O(1) | O(1) | Easy | Math | |
| 3395 | Subsequences with a Unique Middle Mode I | C++ Python | O(n) | O(n) | Hard | Freq Table, Prefix Sum, Combinatorics | |
| 3405 | Count the Number of Arrays with K Matching Adjacent Elements | C++ Python | O(n + logm) | O(n) | Hard | Combinatorics, Fast Exponentiation | |
| 3411 | Maximum Subarray With Equal Products | C++ Python | precompute: O(r * log(logr)) runtime: O(n * log(logr)) | O(r * log(logr)) | Easy | Number Theory, Linear Sieve of Eratosthenes, Hash Table | |
| 3416 | Subsequences with a Unique Middle Mode II | C++ Python | O(n) | O(n) | Hard | 🔒 | Freq Table, Prefix Sum, Combinatorics |
| 3426 | Manhattan Distances of All Arrangements of Pieces | C++ Python | precompute: O(max(m * n)) runtime: O(1) | O(max(m * n)) | Hard | Combinatorics | |
| 3428 | Maximum and Minimum Sums of at Most Size K Subsequences | C++ Python | O(nlogn) | O(n) | Medium | Sort, Combinatorics, Two Pointers, Sliding Window | |
| 3447 | Assign Elements to Groups with Constraints | C++ Python | O(m + r * logn) | O(r) | Medium | Hash Table, Number Theory | |
| 3448 | Count Substrings Divisible By Last Digit | C++ Python | O(d * n) | O(d) | Hard | DP, Case Works, Math, Freq Table | |
| 3461 | Check If Digits Are Equal in String After Operations I | C++ Python | O(nlogn) | O(1) | Easy | Fast Exponentiation, Luca's Theorem, Simulation | |
| 3463 | Check If Digits Are Equal in String After Operations II | C++ Python | O(nlogn) | O(1) | Hard | Fast Exponentiation, Lucas's Theorem | |
| 3470 | Permutations IV | C++ Python | O(n^2) | O(n) | Hard | Combinatorics | |
| 3483 | Unique 3-Digit Even Numbers | C++ Python | O(n) | O(1) | Easy | Freq Table, Combinatorics | |
| 3492 | Maximum Containers on a Ship | C++ Python | O(1) | O(1) | Easy | Math | |
| 3512 | Minimum Operations to Make Array Sum Divisible by K | C++ Python | O(n) | O(1) | Easy | Math | |
| 3513 | Number of Unique XOR Triplets I | C++ Python | O(logn) | O(1) | Medium | Bit Manipulation, Math | |
| 3516 | Find Closest Person | C++ Python | O(1) | O(1) | Easy | Math | |
| 3519 | Count Numbers with Non-Decreasing Digits | C++ Python | O(n^2) | O(n) | Hard | Math, Stars and Bars, Combinatorics | |
| 3556 | Sum of Largest Prime Substrings | C++ Python | O(n^2 * sqrt(r)) | O(n^2) | Medium | Number Theory, Quick Select | |
| 3560 | Find Minimum Log Transportation Cost | C++ Python | O(1) | O(1) | Easy | Math | |
| 3577 | Count the Number of Computer Unlocking Permutations | C++ Python | O(n) | O(1) | Medium | Combinatorics | |
| 3588 | Find Maximum Area of a Triangle | C++ Python | O(n) | O(n) | Medium | Math, Hash Table | |
| 3596 | Minimum Cost Path with Alternating Directions I | C++ Python | O(1) | O(1) | Medium | 🔒 | Math |
| 3602 | Hexadecimal and Hexatrigesimal Conversion | C++ Python | O(logn) | O(1) | Easy | Math | |
| 3618 | Split Array by Prime Indices | C++ Python | precompute: O(max_n) runtime: O(n) | O(max_n) | Medium | Number Theory, Linear Sieve of Eratosthenes | |
| 3621 | Number of Integers With Popcount-Depth Equal to K I | C++ Python | precompute: O((logr)^2) runtime: O((logn)^2) | O((logr)^2) | Hard | Combinatorics | |
| 3622 | Check Divisibility by Digit Sum and Product | C++ Python | O(logn) | O(1) | Easy | Math | |
| 3623 | Count Number of Trapezoids I | C++ Python | O(n) | O(n) | Medium | Freq Table, Combinatorics | |
| 3624 | Number of Integers With Popcount-Depth Equal to K II | C++ Python | precompute: O((logr) * log(logr)) runtime: O(nlogr + max_k * n + nlogn + qlogn) | O(logr + max_k * n) | Hard | BIT, Fenwick Tree | |
| 3625 | Count Number of Trapezoids II | C++ Python | O(n^2 * logr) | O(n^2) | Hard | Freq Table, Combinatorics | |
| 3648 | Minimum Sensors to Cover Grid | C++ Python | O(1) | O(1) | Medium | Math | |
| 3658 | GCD of Odd and Even Sums | C++ Python | O(1) | O(1) | Easy | Math | |
| 3659 | Partition Array Into K-Distinct Groups | C++ Python | O(n) | O(n) | Medium | Math, Freq Table | |
| 3664 | Two-Letter Card Game | C++ Python | O(n + 26) | O(26) | Medium | Math, Freq Table | |
| 3666 | Minimum Operations to Equalize Binary String | C++ Python | O(n) | O(1) | Hard | Math | |
| 3671 | Sum of Beautiful Subsequences | C++ Python | precompute: O(rlogr) runtime: O(nlogr * (log(nlogr) + logn)) | O(rlogr) | Hard | Number Theory, BIT, Fenwick Tree | |
| 3677 | Count Binary Palindromic Numbers | C++ Python | O(logn) | O(1) | Hard | Bitmasks, Combinatorics | |
| 3697 | Compute Decimal Representation | C++ Python | O(logn) | O(1) | Easy | Math | |
| 3726 | Remove Zeros in Decimal Representation | C++ Python | O(logn) | O(1) | Easy | Math, String | |
| 3731 | Find Missing Elements | C++ Python | O(n + r) | O(n) | Easy | Hash Table | |
| 3745 | Maximize Expression of Three Elements | C++ Python | O(n) | O(1) | Easy | Math | |
| 3747 | Count Distinct Integers After Removing Zeros | C++ Python | O(logn) | O(1) | Medium | Combinatorics | |
| 3754 | Concatenate Non-Zero Digits and Multiply by Sum I | C++ Python | O(logn) | O(1) | Easy | Math | |
| 3765 | Complete Prime Number | C++ Python | O(logn * sqrt(n)) | O(1) | Medium | Prefix Sum, Number Theory | |
| 3770 | Largest Prime from Consecutive Prime Sum | C++ Python | precompute: O(r) runtime: O(logp) | O(sqrt(r)) | Medium | Precompute, Number Theory, Linear Sieve of Eratosthenes, Binary Search | |
| 3783 | Mirror Distance of an Integer | C++ Python | O(logn) | O(1) | Easy | Math | |
| 3789 | Minimum Cost to Acquire Required Items | C++ Python | O(1) | O(1) | Medium | Math | |
| 3790 | Smallest All-Ones Multiple | C++ Python | O(k) | O(1) | Medium | duplicate of Smallest Integer Divisible by K | Math |
| 3798 | Largest Even Number | C++ Python | O(n) | O(1) | Easy | Math | |
| 3800 | Minimum Cost to Make Two Binary Strings Equal | C++ Python | O(n) | O(1) | Medium | Math | |
| 3817 | Good Indices in a Digit String | C++ Python | O(n) | O(1) | Medium | 🔒 | Math, Sliding Window |
| 3821 | Find Nth Smallest Integer With K One Bits | C++ Python | ctor: O(r^2) runtime: O(r) | O(r^2) | Hard | DP, Combinatorics | |
| 3855 | Sum of K-Digit Numbers in a Range | C++ Python | O(logr) | O(1) | Hard | Math | |
| 3857 | Minimum Cost to Split into Ones | C++ Python | O(1) | O(1) | Medium | Combinatorics | |
| 3870 | Count Commas in Range | C++ Python | O(logn) | O(1) | Easy | Math | |
| 3871 | Count Commas in Range II | C++ Python | O(logn) | O(1) | Medium | Math | |
| 3881 | Direction Assignments with Exactly K Visible People | C++ Python | O(n) | O(n) | Medium | Combinatorics | |
| 3895 | Count Digit Appearances | C++ Python | O(nlogr) | O(1) | Medium | Math | |
| 3896 | Count Digit Appearances | C++ Python | precompute: O(r), runtime: O(nlogn) | O(r) | Medium | Number Theory, Linear Sieve of Eratosthenes, Prime Gap, Binary Search | |
| 3899 | Angles of a Triangle | C++ Python | O(1) | O(1) | Medium | Math, Law of Cosines | |
| 3908 | Valid Digit Number | C++ Python | O(logn) | O(1) | Easy | Math | |
| 3927 | Minimize Array Sum Using Divisible Replacements | C++ Python | O(n + rlogr) | O(r) | Medium | Number Theory | |
| 3954 | Sum of Compatible Numbers in Range I | C++ Python | O(log(n + k)) | O(1) | Easy | Bitmasks, Combinatorics, Simulation | |
| 3958 | Minimum Cost to Split into Ones II | C++ Python | O(1) | O(1) | Medium | 🔒 | Math, Invariant |
| 3959 | Check Good Integer | C++ Python | O(logn) | O(1) | Easy | Math | |
| 3984 | Divisible Game | C++ Python | precompute: O(r) runtime: O(nlogx) | O(r + n) | Medium | Number Theory, Linear Sieve of Eratosthenes, Kadane's Algorithm, Prefix Sum | |
| 3987 | Minimum Total Cost to Process All Elements | C++ Python | O(n) | O(1) | Medium | Math | |
| 3993 | Maximum Value of an Alternating Sequence | C++ Python | O(1) | O(1) | Medium | Math | |
| 3996 | Even Number of Knight Moves | C++ Python | O(1) | O(1) | Easy | Math, Parity | |
| 4002 | Count Valid Sequences | C++ Python | O(n) | O(n) | Medium | Combinatorics, Stars and Bars | |
| 4022 | K-th Digit in Infinite String | C++ Python | O(logk) | O(1) | Medium | Math | |
| 4034 | Minimum Bishop Moves to Reach Target | C++ Python | O(1) | O(1) | Medium | Math | |
| 4035 | Maximum Valid Split Positions I | C++ Python | O(n) | O(n) | Medium | Number Theory, Prefix Sum | |
| 4037 | Maximum Valid Split Positions II | C++ Python | O(n) | O(n) | Hard | Number Theory, Prefix Sum | |
| 4039 | Sum of Decoded Numbers | C++ Python | O(nlogr) | O(1) | Medium | Fast Exponentiation | |
| 4060 | Count Evenly Good Integers | C++ Python | O(logr) | O(1) | Hard | 🔒 | Math |
| 4061 | Minimum Queen Moves to Reach Target | C++ Python | O(1) | O(1) | Easy | Math | |
| 4078 | Three Fibonacci Sum | C++ Python | O(logn) | O(1) | Easy | Math |
Sort
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3011 | Find if Array Can Be Sorted | C++ Python | O(n) | O(1) | Medium | Sort | |
| 3025 | Find the Number of Ways to Place People I | C++ Python | O(n^2) | O(1) | Medium | Sort, Array | |
| 3027 | Find the Number of Ways to Place People II | C++ Python | O(n^2) | O(1) | Hard | Sort, Array | |
| 3081 | Replace Question Marks in String to Minimize Its Value | C++ Python | O(n + 26 * log(26)) | O(n + 26) | Medium | Greedy, Counting Sort, Heap, Prefix Sum | |
| 3132 | Find the Integer Added to Array II | C++ Python | O(n) | O(n) | Medium | Sort, Paritial Sort, Freq Table | |
| 3169 | Count Days Without Meetings | C++ Python | O(nlogn) | O(1) | Medium | Sort | |
| 3194 | Minimum Average of Smallest and Largest Elements | C++ Python | O(nlogn) | O(1) | Easy | Sort | |
| 3309 | Maximum Possible Number by Binary Concatenation | C++ Python | O(n * logr * logn) | O(nlogr) | Medium | Sort, Brute Force | |
| 3394 | Check if Grid can be Cut into Sections | C++ Python | O(nlogn) | O(1) | Medium | Sort, Merge Intervals | |
| 3431 | Minimum Unlocked Indices to Sort Nums | C++ Python | O(n) | O(1) | Medium | Sort | |
| 3551 | Minimum Swaps to Sort by Digit Sum | C++ Python | O(nlogr + nlogn) | O(n) | Medium | Sort | |
| 3631 | Sort Threats by Severity and Exploitability | C++ Python | O(nlogn) | O(1) | Medium | 🔒 | Sort |
| 3644 | Maximum K to Sort a Permutation | C++ Python | O(n) | O(1) | Medium | Sort, Bitmasks, Constructive Algorithms | |
| 3667 | Sort Array By Absolute Value | C++ Python | O(n + r) | O(n + r) | Easy | 🔒 | Sort |
| 3759 | Count Elements With at Least K Greater Values | C++ Python | O(n) | O(1) | Medium | Sort, Quick Select | |
| 3780 | Maximum Sum of Three Numbers Divisible by Three | C++ Python | O(n) | O(1) | Medium | Sort, Math | |
| 3799 | Word Squares II | C++ Python | O(n^4) | O(1) | Medium | Sort, Brute Force, Hash Table | |
| 3975 | Filter Occupied Intervals | C++ Python | O(nlogn) | O(n) | Medium | Sort | |
| 4065 | Rearrange Array by Removing Distinct Values | C++ Python | O(nlogn) | O(n) | Easy | Freq Table, Sort | |
| 4068 | Maximize Meeting Earnings with Idle Gaps | C++ Python | O(nlogn) | O(n) | Hard | Sort, Two Pointers, Binary Search, Prefix Sum |
Two Pointers
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3006 | Find Beautiful Indices in the Given Array I | C++ Python | O(n) | O(min(a + b + x + y, n)) | Medium | KMP Algorithm, Binary Search, Two Pointers | |
| 3008 | Find Beautiful Indices in the Given Array II | C++ Python | O(n) | O(min(a + b + x + y, n)) | Hard | KMP Algorithm, Binary Search, Two Pointers | |
| 3013 | Divide an Array Into Subarrays With Minimum Cost II | C++ Python | O(nlogd) | O(d) | Hard | Sliding Window, Heap, Freq Table, Ordered Set, BST, Sorted List | |
| 3085 | Minimum Deletions to Make String K-Special | C++ Python | O(n + 26) | O(n + 26) | Medium | Freq Table, Counting Sort, Two Pointers | |
| 3090 | Maximum Length Substring With Two Occurrences | C++ Python | O(n + 26) | O(26) | Easy | Freq Table, Sliding Window, Two Pointers | |
| 3095 | Shortest Subarray With OR at Least K I | C++ Python | O(n * 30) | O(30) | Easy | Brute Force, Freq Table, Two Pointers | |
| 3097 | Shortest Subarray With OR at Least K II | C++ Python | O(n * 30) | O(30) | Medium | Freq Table, Two Pointers | |
| 3171 | Find Subarray With Bitwise OR Closest to K | C++ Python | O(nlogr) | O(logr) | Hard | variant of Find a Value of a Mysterious Function Closest to Target | DP, Freq Table, Two Pointers, Sliding Window |
| 3206 | Alternating Groups I | C++ Python | O(n) | O(1) | Easy | Two Pointers, Sliding Window | |
| 3208 | Alternating Groups II | C++ Python | O(n) | O(1) | Medium | Two Pointers, Sliding Window | |
| 3234 | Count the Number of Substrings With Dominant Ones | C++ Python | O(n^(3/2)) | O(1) | Medium | Two Pointers, Sliding Window | |
| 3254 | Find the Power of K-Size Subarrays I | C++ Python | O(n) | O(1) | Medium | Two Pointers, Sliding Window | |
| 3255 | Find the Power of K-Size Subarrays II | C++ Python | O(n) | O(1) | Medium | Two Pointers, Sliding Window | |
| 3258 | Count Substrings That Satisfy K-Constraint I | C++ Python | O(n) | O(1) | Easy | Two Pointers, Sliding Window | |
| 3261 | Count Substrings That Satisfy K-Constraint II | C++ Python | O(n) | O(n) | Hard | Two Pointers, Sliding Window, Prefix Sum, Hash Table | |
| 3264 | Final Array State After K Multiplication Operations I | C++ Python | O(nlogn) | O(n) | Easy | Sort, Two Pointers, Sliding Window, Fast Exponentiation, Heap, Binary Search, Simulation | |
| 3266 | Final Array State After K Multiplication Operations II | C++ Python | O(nlogn) | O(n) | Hard | Sort, Two Pointers, Sliding Window, Fast Exponentiation, Heap, Binary Search | |
| 3297 | Count Substrings That Can Be Rearranged to Contain a String I | C++ Python | O(n + 26) | O(26) | Medium | Two Pointers, Sliding Window, Freq Table | |
| 3298 | Count Substrings That Can Be Rearranged to Contain a String II | C++ Python | O(n + 26) | O(26) | Hard | Two Pointers, Sliding Window, Freq Table | |
| 3305 | Count of Substrings Containing Every Vowel and K Consonants I | C++ Python | O(n) | O(1) | Medium | Two Pointers, Sliding Window, Freq Table | |
| 3306 | Count of Substrings Containing Every Vowel and K Consonants II | C++ Python | O(n) | O(1) | Medium | Two Pointers, Sliding Window, Freq Table | |
| 3318 | Find X-Sum of All K-Long Subarrays I | C++ Python | O(nlogn) | O(n) | Easy | Two Pointers, Sliding Window, Freq Table, Ordered Set, Sorted List | |
| 3321 | Find X-Sum of All K-Long Subarrays II | C++ Python | O(nlogn) | O(n) | Hard | Two Pointers, Sliding Window, Freq Table, Ordered Set, Sorted List | |
| 3323 | Minimize Connected Groups by Inserting Interval | C++ Python | O(nlogn) | O(n) | Medium | 🔒 | Sort, Prefix Sum, Two Pointers, Sliding Window |
| 3325 | Count Substrings With K-Frequency Characters I | C++ Python | O(n + 26) | O(26) | Medium | Freq Table, Two Pointers, Sliding Window | |
| 3329 | Count Substrings With K-Frequency Characters II | C++ Python | O(n + 26) | O(26) | Hard | 🔒 | Freq Table, Two Pointers, Sliding Window |
| 3346 | Maximum Frequency of an Element After Performing Operations I | C++ Python | O(nlogn) | O(n) | Medium | Sort, Freq Table, Two Pointers, Sliding Window, Difference Array, Line Sweep | |
| 3347 | Maximum Frequency of an Element After Performing Operations II | C++ Python | O(nlogn) | O(n) | Hard | Sort, Freq Table, Two Pointers, Sliding Window, Difference Array, Line Sweep | |
| 3364 | Minimum Positive Sum Subarray | C++ Python | O(nlogn) | O(n) | Easy | Prefix Sum, Two Pointers, Sliding Window, Sorted List, BST, Binary Search | |
| 3413 | Maximum Coins From K Consecutive Bags | C++ Python | O(nlogn) | O(1) | Medium | Sort, Two Pointers, Sliding Window | |
| 3420 | Count Non-Decreasing Subarrays After K Operations | C++ Python | O(n) | O(n) | Hard | Mono Deque, Two Pointers, Sliding Window | |
| 3422 | Minimum Operations to Make Subarray Elements Equal | C++ Python | O(nlogk) | O(k) | Medium | 🔒 | Math, Two Pointers, Sliding Window, Sorted List, BST |
| 3425 | Longest Special Path | C++ Python | O(n + e) | O(n + e) | Hard | DFS, Two Pointers, Sliding Window, Prefix Sum | |
| 3430 | Maximum and Minimum Sums of at Most Size K Subarrays | C++ Python | O(n) | O(k) | Hard | Two Pointers, Sliding Window, Mono Deque | |
| 3439 | Reschedule Meetings for Maximum Free Time I | C++ Python | O(n) | O(1) | Medium | Two Pointers, Sliding Window | |
| 3445 | Maximum Difference Between Even and Odd Frequency II | C++ Python | O(d^2 * n) | O(n) | Hard | Prefix Sum, Two Pointers, Sliding Window | |
| 3460 | Longest Common Prefix After at Most One Removal | C++ Python | O(n) | O(1) | Medium | 🔒 | Two Pointers |
| 3485 | Longest Common Prefix of K Strings After Removal | C++ Python | O(l * nlogn) | O(n) | Hard | Sort, Sliding Window, Prefix Sum, Trie | |
| 3486 | Longest Special Path II | C++ Python | O(n + e) | O(n + e) | Hard | DFS, Two Pointers, Sliding Window, Prefix Sum | |
| 3555 | Smallest Subarray to Sort in Every Sliding Window | C++ Python | O(n) | O(n) | Medium | 🔒 | Mono Stack, Two Pointers |
| 3567 | Minimum Absolute Difference in Sliding Submatrix | C++ Python | O(m * n * k^2) | O(k^2) | Medium | Brute Force, Sort, Two Pointers, Sliding Window, BST, Sorted List | |
| 3584 | Maximum Product of First and Last Elements of a Subsequence | C++ Python | O(n) | O(1) | Medium | Two Pointers, Sliding Window | |
| 3589 | Count Prime-Gap Balanced Subarrays | C++ Python | precompute: O(r) runtime: O(n) | O(r) | Medium | Number Theory, Linear Sieve of Eratosthenes, Mono Deque, Two Pointers, Sliding Window | |
| 3634 | Minimum Removals to Balance Array | C++ Python | O(nlogn) | O(1) | Medium | Sort, Two Pointers, Sliding Window | |
| 3640 | Trionic Array II | C++ Python | O(n) | O(1) | Easy | Two Pointers, Sliding Window, Greedy | |
| 3641 | Longest Semi-Repeating Subarray | C++ Python | O(n) | O(1) | Medium | 🔒 | Freq Table, Two Pointers, Sliding Window |
| 3649 | Number of Perfect Pairs | C++ Python | O(nlogn) | O(1) | Medium | Sort, Two Pointers, Sliding Window, Math | |
| 3652 | Best Time to Buy and Sell Stock using Strategy | C++ Python | O(n) | O(1) | Medium | Two Pointers, Sliding Window | |
| 3672 | Sum of Weighted Modes in Subarrays | C++ Python | O(nlogk) | O(k) | Medium | 🔒 | Sorted List, BST, Two Pointers, Sliding Window |
| 3679 | Minimum Discards to Balance Inventory | C++ Python | O(n) | O(w) | Medium | Freq Table, Two Pointers, Sliding Window | |
| 3698 | Split Array With Minimum Difference | C++ Python | O(n) | O(1) | Medium | Two Pointers | |
| 3740 | Minimum Distance Between Three Equal Elements I | C++ Python | O(n) | O(n) | Easy | Hash Table, Two Pointers, Sliding Window | |
| 3741 | Minimum Distance Between Three Equal Elements II | C++ Python | O(n) | O(n) | Medium | Hash Table, Two Pointers, Sliding Window | |
| 3768 | Minimum Inversion Count in Subarrays of Fixed Length | C++ Python | O(nlogn) | O(n) | Hard | Sort, Coordinate Compression, BIT, Fenwick Tree, Two Pointers, Sliding Window | |
| 3795 | Minimum Subarray Length With Distinct Sum At Least K | C++ Python | O(n) | O(n) | Medium | Freq Table, Two Pointers, Sliding Window | |
| 3802 | Number of Ways to Paint Sheets | C++ Python | O(mlogm) | O(m) | Hard | 🔒 | Prefix Sum, Two Pointers |
| 3835 | Count Subarrays With Cost Less Than or Equal to K | C++ Python | O(n) | O(n) | Medium | Mono Deque, Two Pointers, Sliding Window | |
| 3844 | Longest Almost-Palindromic Substring | C++ Python | O(n^2) | O(1) | Medium | Two Pointers | |
| 3845 | Maximum Subarray XOR with Bounded Range | C++ Python | O(nlogr) | O(n) | Hard | Two Pointers, Sliding Window, Mono Deque, Bitmasks, Prefix Sum, Trie, Hash Table | |
| 3851 | Maximum Requests Without Violating the Limit | C++ Python | O(nlogn) | O(n) | Medium | 🔒 | Hash Table, Sort, Deque, Two Pointers, Sliding Window |
| 3859 | Count Subarrays With K Distinct Integers | C++ Python | O(n) | O(n) | Hard | Freq Table, Two Pointers, Sliding Window | |
| 3872 | Longest Arithmetic Sequence After Changing At Most One Element | C++ Python | O(n) | O(1) | Medium | Two Pointers | |
| 3874 | Valid Subarrays With Exactly One Peak | C++ Python | O(n) | O(1) | Medium | 🔒 | Combinatorics, Two Pointers |
| 3937 | Minimum Operations to Make Array Modulo Alternating I | C++ Python | O(n + k) | O(k) | Medium | Freq Table, Two Pointers, Sliding Window | |
| 3944 | Minimum Operations to Make Array Modulo Alternating II | C++ Python | O(n + k) | O(k) | Hard | 🔒 | Freq Table, Two Pointers, Sliding Window |
| 3969 | Valid Subarrays With Matching Sum Digits I | C++ Python | O(nlogr) | O(n) | Medium | Brute Force, Prefix Sum, Two Pointers, Sliding Window | |
| 3972 | Valid Subarrays With Matching Sum Digits II | C++ Python | O(nlogr) | O(n) | Hard | 🔒 | Prefix Sum, Two Pointers, Sliding Window |
| 3992 | Rearrange String to Avoid Character Pair | C++ Python | O(n) | O(1) | Easy | Two Pointers | |
| 4001 | Aggregate Two Time Series | C++ Python | O(n + m) | O(1) | Medium | Two Pointers | |
| 4031 | Find All Numbers Disappeared in an Array II | C++ Python | O(r) | O(r) | Medium | Sort, Two Pointers, Hash Table | |
| 4032 | Longest Subarray With at Most K Distinct Prime Factors | C++ Python | ctor: O(r) runtime: O(nlogr) | O(r) | Medium | Number Theory, Linear Sieve of Eratosthenes, Freq Table, Two Pointers, Sliding Window | |
| 4033 | Valid K-Unique Subarrays I | C++ Python | O(n + q) | O(n) | Hard | Two Pointers, Sliding Window, Hash Table, Prefix Sum, BIT, Fenwick Tree, Sort, Coordinate Compression, Mo's Algorithm | |
| 4042 | Valid K-Unique Subarrays II | C++ Python | O(n + q) | O(n) | Hard | 🔒 | Two Pointers, Sliding Window, Hash Table, Prefix Sum |
| 4044 | Count Good Cyclic Rotations | C++ Python | O(n) | O(1) | Medium | Two Pointers, Sliding Window | |
| 4067 | Longest Subarray With Restricted Pair Sums | C++ Python | O(n * r) | O(r) | Medium | Freq Table, Two Pointers, Sliding Window | |
| 4075 | Longest Resilient Subarray I | C++ Python | O(n) | O(1) | Medium | Two Pointers, Brute Force | |
| 4076 | Longest Resilient Subarray II | C++ Python | O(n) | O(1) | Medium | Two Pointers | |
| 4089 | Count Subarrays With Loose Bounds | C++ Python | O(n) | O(1) | Medium | Two Pointers |
Recursion
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|
Binary Search
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3048 | Earliest Second to Mark Indices I | C++ Python | O(mlogm) | O(n) | Medium | Binary Search, Greedy | |
| 3049 | Earliest Second to Mark Indices II | C++ Python | O((m + nlogn) *logm) | O(n) | Hard | Binary Search, Greedy, Heap | |
| 3104 | Find Longest Self-Contained Substring | C++ Python | O(n + 26^3 * logn) | O(n) | Hard | 🔒 | Brute Force, Freq Table, Two Pointers, Hash Table, Binary Search |
| 3116 | Kth Smallest Amount With Single Denomination Combination | C++ Python | O(n * 2^n * logk) | O(2^n) | Hard | Binary Search, Principle of Inclusion and Exclusion, Number Theory | |
| 3134 | Find the Median of the Uniqueness Array | C++ Python | O(nlogn) | O(n) | Hard | Binary Search, Two Pointers, Sliding Window | |
| 3135 | Equalize Strings by Adding or Removing Characters at Ends | C++ Python | O((n + m) * log(min(n, m))) | O(min(n, m)) | Medium | 🔒 | Binary Search, Rabin-Karp Algorithm, Rolling Hash, DP |
| 3145 | Find Products of Elements of Big Array | C++ Python | O(q * (logr)^2) | O(1) | Hard | Binary Search, Combinatorics, Bitmasks, Fast Exponentiation | |
| 3231 | Minimum Number of Increasing Subsequence to Be Removed | C++ Python | O(nlogn) | O(n) | Hard | 🔒, variant of Longest Increasing Subsequence | Binary Search |
| 3233 | Find the Count of Numbers Which Are Not Special | C++ Python | precompute: O(sqrt(r)) runtime: O(logr) | O(sqrt(r)) | Medium | Number Theory, Linear Sieve of Eratosthenes, Binary Search | |
| 3281 | Maximize Score of Numbers in Ranges | C++ Python | O(nlogr) | O(1) | Medium | Binary Search, Greedy | |
| 3288 | Length of the Longest Increasing Path | C++ Python | O(nlogn) | O(n) | Hard | Sort, Binary Search, Longest Increasing Subsequence | |
| 3296 | Minimum Number of Seconds to Make Mountain Height Zero | C++ Python | O(nlogr) | O(1) | Medium | Binary Search, Quadratic Equation, Heap | |
| 3356 | Zero Array Transformation II | C++ Python | O((n + q) * logn) | O(n) | Medium | Binary Search, Line Sweep | |
| 3357 | Minimize the Maximum Adjacent Element Difference | C++ Python | O(nlogr) | O(1) | Hard | Binary Search | |
| 3398 | Smallest Substring With Identical Characters I | C++ Python | O(nlogn) | O(1) | Hard | Binary Search, Greedy | |
| 3399 | Smallest Substring With Identical Characters II | C++ Python | O(nlogn) | O(1) | Hard | Binary Search, Greedy | |
| 3449 | Maximize the Minimum Game Score | C++ Python | O(n * log(m * r)) | O(1) | Hard | Binary Search, Greedy | |
| 3464 | Maximize the Distance Between Points on a Square | C++ Python | O(nlogn + nlogs) | O(n) | Hard | Sort, Binary Search, Greedy, Two Pointers, Sliding Window | |
| 3477 | Fruits Into Baskets II | C++ Python | O(nlogn) | O(n) | Easy | Segment Tree, Binary Search, Brute Force | |
| 3479 | Fruits Into Baskets III | C++ Python | O(nlogn) | O(n) | Medium | Segment Tree, Binary Search | |
| 3520 | Minimum Threshold for Inversion Pairs Count | C++ Python | O(nlogn * logr) | O(n) | Medium | 🔒 | Binary Search, Sorted List, Ordered Set |
| 3605 | Minimum Stability Factor of Array | C++ Python | O(nlogn * logr) | O(nlogn) | Hard | Number Theory, Binary Search, RMQ, Sparse Table, Greedy | |
| 3722 | Lexicographically Smallest String After Reverse | C++ Python | O(nlogn) | O(n) | Medium | String, Brute Force, Binary Search, Rabin-Karp Algorithm, Rolling Hash | |
| 3733 | Minimum Time to Complete All Deliveries | C++ Python | O(logr + logd) | O(1) | Medium | Binary Search | |
| 3735 | Lexicographically Smallest String After Reverse II | C++ Python | O(nlogn) | O(n) | Hard | 🔒 | Binary Search, Rabin-Karp Algorithm, Rolling Hash |
| 3771 | Total Score of Dungeon Runs | C++ Python | O(nlogn) | O(n) | Medium | Prefix Sum, Binary Search | |
| 3807 | Minimum Cost to Repair Edges to Traverse a Graph | C++ Python | O((n + m) * logr) | O(n + m) | Medium | 🔒 | Binary Search, BFS |
| 3824 | Minimum K to Reduce Array Within Limit | C++ Python | O(nlogn + nlogr) | O(1) | Medium | Binary Search | |
| 3825 | Longest Strictly Increasing Subsequence With Non-Zero Bitwise AND | C++ Python | O(logr * nlogn) | O(n) | Medium | Bitmasks, LIS, Longest Increasing Subsequence, Binary Search | |
| 3826 | Minimum Partition Score | C++ Python | O(nlogn + nlogr) | O(n) | Hard | Prefix Sum, DP, Convex Hull Trick, WQS Binary Search, Alien Trick | |
| 3893 | Maximum Team Size with Overlapping Intervals | C++ Python | O(nlogn) | O(n) | Medium | 🔒 | Sort, Binary Search |
| 3911 | K-th Smallest Remaining Even Integer in Subarray Queries | C++ Python | O(n + qlogn) | O(n) | Hard | Prefix Sum, Binary Search | |
| 3920 | Maximize Fixed Points After Deletions | C++ Python | O(nlogn) | O(n) | Hard | Sort, Binary Search, Longest Increasing Subsequence | |
| 3924 | Minimum Threshold Path With Limited Heavy Edges | C++ Python | O((n + e) * loge) | O(n + e) | Hard | Binary Search, 0-1 BFS, Deque | |
| 3929 | Minimum Partition Score II | C++ Python | O(nlogn + nlogr) | O(n) | Hard | 🔒 | Prefix Sum, DP, Convex Hull Trick, WQS Binary Search, Alien Trick |
| 3932 | Count K-th Roots in a Range | C++ Python | O(logr * logk) | O(1) | Medium | Binary Search, Fast Exponentiation | |
| 3934 | Smallest Unique Subarray | C++ Python | O(nlogn) | O(n) | Hard | Binary Search, Rabin-Karp Algorithm, Rolling Hash | |
| 3956 | Maximum Sum of M Non-Overlapping Subarrays I | C++ Python | O(nlogr) | O(n) | Hard | Prefix Sum, DP, Mono Deque, WQS Binary Search, Alien Trick | |
| 3957 | Maximum Sum of M Non-Overlapping Subarrays II | C++ Python | O(nlogr) | O(n) | Hard | Prefix Sum, DP, Mono Deque, WQS Binary Search, Alien Trick | |
| 3971 | Maximum Total Value | C++ Python | O(nlogr) | O(1) | Hard | Binary Search |
Binary Search Tree
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3072 | Distribute Elements Into Two Arrays II | C++ Python | O(nlogn) | O(n) | Hard | Sorted List, Ordered Set | |
| 3073 | Maximum Increasing Triplet Value | C++ Python | O(nlogn) | O(n) | Medium | 🔒 | Sorted List, BST, Prefix Sum |
| 3161 | Block Placement Queries | C++ Python | O(qlogq) | O(q) | Hard | Sorted List, BST, BIT, Fenwick Tree, Segment Tree | |
| 3165 | Maximum Sum of Subsequence With Non-adjacent Elements | C++ Python | O(n + qlogn) | O(n) | Hard | Segment Tree | |
| 3526 | Range XOR Queries with Subarray Reversals | C++ Python | O(n + qlogn) | O(n) | Hard | 🔒 | Treap |
| 3930 | Power Update After K-th Largest Insertion II | C++ Python | O((n + q) * log(n * q) + q * logr) | O(n + q) | Hard | 🔒 | Sorted List, Ordered Set, Sort, Coordinate Compression, BIT, Fenwick Tree, Fast Exponentiation |
| 3935 | Power Update After K-th Largest Insertion I | C++ Python | O((n + q) * log(n * q) + q * logr) | O(n + q) | Medium | 🔒 | Sorted List, Ordered Set, Sort, Coordinate Compression, BIT, Fenwick Tree, Fast Exponentiation |
Breadth-First Search
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3157 | Find the Level of Tree with Minimum Sum | C++ Python | O(n) | O(w) | Medium | 🔒 | BFS |
| 3286 | Find a Safe Walk Through a Grid | C++ Python | O(m * n) | O(m * n) | Medium | variant of Minimum Obstacle Removal to Reach Corner | 0-1 BFS, Deque |
| 3373 | Maximize the Number of Target Nodes After Connecting Trees II | C++ Python | O(n + m) | O(n + m) | Hard | BFS | |
| 3528 | Unit Conversion I | C++ Python | O(n) | O(n) | Medium | BFS | |
| 3535 | Unit Conversion II | C++ Python | O(n + qlogm) | O(n) | Medium | 🔒 | BFS, Fast Exponentiation |
| 3552 | Grid Teleportation Traversal | C++ Python | O(m * n) | O(m * n) | Medium | 0-1 BFS, Deque | |
| 3568 | Minimum Moves to Clean the Classroom | C++ Python | O(m * n * 2^l) | O(m * n * 2^l) | Medium | BFS, Bitmasks | |
| 3619 | Count Islands With Total Value Divisible by K | C++ Python | O(m * n) | O(m + n) | Medium | BFS, Flood Fill | |
| 3629 | Minimum Jumps to Reach End via Prime Teleportation | C++ Python | precompute: O(r) runtime: O(nlogr) | O(r + nlogr) | Medium | Number Theory, Linear Sieve of Eratosthenes, BFS | |
| 3690 | Split and Merge Array Transformation | C++ Python | O(n^4 * n!) | O(n * n!) | Medium | BFS | |
| 3695 | Maximize Alternating Sum Using Swaps | C++ Python | O(n + s) | O(n + s) | Hard | BFS, Flood Fill, Quick Select | |
| 3786 | Total Sum of Interaction Cost in Tree Groups | C++ Python | O(nlogn) | O(n) | Hard | BFS, DFS, Small-to-Large Merging | |
| 3787 | Find Diameter Endpoints of a Tree | C++ Python | O(n) | O(n) | Medium | 🔒 | BFS, Tree Diameter |
| 3820 | Pythagorean Distance Nodes in a Tree | C++ Python | O(n) | O(n) | Medium | BFS | |
| 3831 | Median of a Binary Search Tree Level | C++ Python | O(n) | O(n) | Medium | 🔒 | BFS |
| 3902 | Zigzag Level Sum of Binary Tree | C++ Python | O(n) | O(w) | Hard | 🔒 | BFS |
| 3905 | Multi Source Flood Fill | C++ Python | O(n * m) | O(n * m) | Medium | Sort, BFS, Flood Fill | |
| 3923 | Minimum Generations to Target Point | C++ Python | O(7^6) | O(7^3) | Medium | BFS | |
| 3991 | Sort Array Using Prefix Reversals | C++ Python | O(n! * n * m) | O(n! * n) | Medium | 🔒 | BFS, Bi-BFS |
| 4047 | Minimum Operations to Make XOR of All Elements Zero | C++ Python | O(n + r * d) | O(r + d) | Hard | 🔒 | BFS, Bi-BFS |
Depth-First Search
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3004 | Maximum Subtree of the Same Color | C++ Python | O(n) | O(h) | Medium | 🔒 | DFS |
| 3067 | Count Pairs of Connectable Servers in a Weighted Tree Network | C++ Python | O(n^2) | O(n) | Medium | DFS, BFS | |
| 3203 | Find Minimum Diameter After Merging Two Trees | C++ Python | O(n + m) | O(n + m) | Hard | variant of Tree Diameter | DFS, BFS, Tree DP, Tree Diameter |
| 3249 | Count the Number of Good Nodes | C++ Python | O(n) | O(h) | Medium | DFS | |
| 3319 | K-th Largest Perfect Subtree Size in Binary Tree | C++ Python | O(n) | O(n) | Medium | DFS, Quick Select | |
| 3327 | Check if DFS Strings Are Palindromes | C++ Python | O(n) | O(n) | Hard | DFS, Manacher's Algorithm | |
| 3331 | Find Subtree Sizes After Changes | C++ Python | O(n) | O(n) | Medium | DFS, Hash Table | |
| 3367 | Maximize Sum of Weights after Edge Removals | C++ Python | O(n) | O(n) | Hard | DFS, Quick Select | |
| 3590 | Kth Smallest Path XOR Sum | C++ Python | O(n * (logn)^2 + qlogn) | O(n + q) | Hard | DFS, Small-to-Large Merging, Ordered Set, Sorted List | |
| 3593 | Minimum Increments to Equalize Leaf Paths | C++ Python | O(n) | O(n) | Medium | DFS | |
| 3607 | Power Grid Maintenance | C++ Python | O(c + n + q) | O(c + n) | Medium | DFS, Flood Fill, Sort | |
| 4015 | Weighted Sum of a Tree | C++ Python | O(n) | O(n) | Medium | DFS, Tree DP | |
| 4018 | Total Sum of Interaction Cost in Tree Groups II | C++ Python | O(nlogn) | O(n) | Hard | 🔒 | DFS, Small-to-Large Merging |
Backtracking
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3211 | Generate Binary Strings Without Adjacent Zeros | C++ Python | O(n * 2^n) | O(n) | Medium | Backtracking, BFS | |
| 3437 | Permutations III | C++ Python | O(n * n!) | O(n) | Medium | 🔒 | Backtracking, Bitmasks |
| 3565 | Sequential Grid Path Cover | C++ Python | O(m * n * 3^(m * n)) | O(m * n) | Medium | 🔒 | Backtracking |
| 3669 | Balanced K-Factor Decomposition | C++ Python | precompute: O(rlogr) runtime: O(k * (logn)^(k - 1)) | O(rlogr) | Medium | Backtracking, Number Theory | |
| 3955 | Valid Binary Strings With Cost Limit | C++ Python | O(n * 2^n) | O(n) | Medium | Backtracking, Bitmasks |
Dynamic Programming
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3018 | Maximum Number of Removal Queries That Can Be Processed I | C++ Python | O(n^2) | O(n^2) | Hard | 🔒 | DP |
| 3020 | Find the Maximum Number of Elements in Subset | C++ Python | O(n) | O(n) | Medium | Freq Table, DP | |
| 3040 | Maximum Number of Operations With the Same Score II | C++ Python | O(n^2) | O(n^2) | Medium | Memoization | |
| 3041 | Maximize Consecutive Elements in an Array After Modification | C++ Python | O(nlogn) | O(1) | Hard | Sort, DP | |
| 3077 | Maximum Strength of K Disjoint Subarrays | C++ Python | O(k * n) | O(n) | Hard | DP, Greedy, Kadane's Algorithm | |
| 3082 | Find the Sum of the Power of All Subsequences | C++ Python | O(n * k) | O(k) | Hard | DP, Combinatorics | |
| 3098 | Find the Sum of Subsequence Powers | C++ Python | O(n^3 * k) | O(n^2) | Hard | DP, Prefix Sum, Two Pointers | |
| 3101 | Count Alternating Subarrays | C++ Python | O(n) | O(1) | Medium | DP | |
| 3117 | Minimum Sum of Values by Dividing Array | C++ Python | O(n * m * logr) | O(n + logr) | Hard | Memoization, DP, RMQ, Sparse Table, Mono Deque, Two Pointers | |
| 3122 | Minimum Number of Operations to Satisfy Conditions | C++ Python | O(n * (m + 10)) | O(10) | Medium | DP | |
| 3129 | Find All Possible Stable Binary Arrays I | C++ Python | O(n * m) | O(n * m) | Medium | DP | |
| 3130 | Find All Possible Stable Binary Arrays II | C++ Python | O(n * m) | O(n * m) | Hard | DP | |
| 3141 | Maximum Hamming Distances | C++ Python | O(m * 2^m) | O(2^m) | Hard | 🔒 | Bitmasks, BFS, Knapsack DP |
| 3144 | Minimum Substring Partition of Equal Character Frequency | C++ Python | O(n * (n + 26)) | O(n + 26) | Medium | DP, Freq Table | |
| 3148 | Maximum Difference Score in a Grid | C++ Python | O(m * n) | O(1) | Medium | DP | |
| 3149 | Find the Minimum Cost Array Permutation | C++ Python | O((n-1)^2 * 2^(n-1)) | O((n-1) * 2^(n-1)) | Hard | DP, Backtracing | |
| 3176 | Find the Maximum Length of a Good Subsequence I | C++ Python | O(n * k) | O(n * k) | Medium | DP | |
| 3177 | Find the Maximum Length of a Good Subsequence II | C++ Python | O(n * k) | O(n * k) | Hard | DP | |
| 3180 | Maximum Total Reward Using Operations I | C++ Python | O(n * k) | O(n * k) | Medium | Sort, DP, Bitset | |
| 3181 | Maximum Total Reward Using Operations II | C++ Python | O(n * k) | O(n * k) | Hard | Sort, DP, Bitset | |
| 3186 | Maximum Total Damage With Spell Casting | C++ Python | O(nlogn) | O(n) | Medium | Sort, DP, Two Pointers, Sliding window, Deque | |
| 3193 | Count the Number of Inversions | C++ Python | O(n * k) | O(n + k) | Hard | variant of K Inverse Pairs Array | Knapsack DP, Combinatorics, Sliding Window, Two Pointers |
| 3196 | Maximize Total Cost of Alternating Subarrays | C++ Python | O(n) | O(1) | Medium | DP | |
| 3197 | Find the Minimum Area to Cover All Ones II | C++ Python | O(max(n, m)^2) | O(max(n, m)^2) | Hard | Array, Brute Force, Prefix Sum, Binary Search, RMQ, Sparse Table, DP | |
| 3201 | Find the Maximum Length of Valid Subsequence I | C++ Python | O(n) | O(1) | Medium | Brute Force, DP | |
| 3202 | Find the Maximum Length of Valid Subsequence II | C++ Python | O(n * k) | O(k) | Medium | DP | |
| 3209 | Number of Subarrays With AND Value of K | C++ Python | O(nlogr) | O(logr) | Hard | variant of Find Subarray With Bitwise OR Closest to K | DP |
| 3212 | Count Submatrices With Equal Frequency of X and Y | C++ Python | O(n * m) | O(n * m) | Medium | DP | |
| 3213 | Construct String with Minimum Cost | C++ Python | O(n^2 + w * l) | O(t) | Hard | DP, Trie | |
| 3225 | Maximum Score From Grid Operations | C++ Python | O(n^3) | O(n) | Hard | Prefix Sum, DP | |
| 3241 | Time Taken to Mark All Nodes | C++ Python | O(n) | O(n) | Hard | Tree DP, BFS, DFS | |
| 3253 | Construct String with Minimum Cost (Easy) | C++ Python | O(n * w * l) | O(l) | Medium | 🔒 | DP, Trie |
| 3259 | Maximum Energy Boost From Two Drinks | C++ Python | O(n) | O(1) | Medium | DP | |
| 3269 | Constructing Two Increasing Arrays | C++ Python | O(m * n) | O(min(m, n)) | Hard | 🔒 | DP |
| 3277 | Maximum XOR Score Subarray Queries | C++ Python | O(n^2 + q) | O(n^2) | Hard | DP | |
| 3283 | Maximum Number of Moves to Kill All Pawns | C++ Python | O(p^2 * 2^p) | O(p * 2^p) | Hard | BFS, Bitmasks, DP | |
| 3287 | Find the Maximum Sequence Value of Array | C++ Python | O(n * r + r^2) | O(r) | Hard | Bitmasks, Prefix Sum, DP | |
| 3290 | Maximum Multiplication Score | C++ Python | O(n) | O(1) | Medium | DP | |
| 3291 | Minimum Number of Valid Strings to Form Target I | C++ Python | O(n + w * l) | O(n + t) | Medium | KMP, Rabin-Karp Algorithm, Rolling Hash, Hash Table, Two Pointers, Sliding Window, DP, Aho-Corasick Automata, Trie | |
| 3292 | Minimum Number of Valid Strings to Form Target II | C++ Python | O(n + w * l) | O(n + t) | Hard | KMP, Rabin-Karp Algorithm, Rolling Hash, Hash Table, Two Pointers, Sliding Window, DP, Aho-Corasick Automata, Trie | |
| 3313 | Find the Last Marked Nodes in Tree | C++ Python | O(n) | O(n) | Hard | 🔒, variant of Time Taken to Mark All Nodes | BFS, DFS, Tree DP, Tree Diameter |
| 3316 | Find Maximum Removals From Source String | C++ Python | O(n * m) | O(n + m) | Medium | DP | |
| 3320 | Count The Number of Winning Sequences | C++ Python | O(n^2) | O(n) | Hard | DP | |
| 3332 | Maximum Points Tourist Can Earn | C++ Python | O(k * n^2) | O(n) | Hard | DP | |
| 3333 | Find the Original Typed String II | C++ Python | O(n + k^2) | O(n + k) | Hard | DP | |
| 3335 | Total Characters in String After Transformations I | C++ Python | precompute: O(t + 26) runtime: O(n) | O(t + 26) | Medium | DP, Matrix Exponentiation, Precompute | |
| 3336 | Find the Number of Subsequences With Equal GCD | C++ Python | precompute: O(max_r^2 * log(max_r)) runtime: O(n + r^2) | O(max_r^2) | Hard | DP, Number Theory, Mobius Function, Principle of Inclusion-Exclusion, Basel Problem | |
| 3337 | Total Characters in String After Transformations II | C++ Python | O(n + 26^3 * logt) | O(26^2) | Hard | DP, Matrix Exponentiation | |
| 3343 | Count Number of Balanced Permutations | C++ Python | O(n^2) | O(n^2) | Hard | DP, Combinatorics | |
| 3351 | Sum of Good Subsequences | C++ Python | O(n) | O(n) | Hard | Freq Table, DP | |
| 3352 | Count K-Reducible Numbers Less Than N | C++ Python | O(n^2) | O(n) | Hard | DP, Combinatorics | |
| 3359 | Find Sorted Submatrices With Maximum Element at Most K | C++ Python | O(m * n) | O(m) | Hard | 🔒, variant of Count Submatrices With All Ones | Mono Stack, DP |
| 3363 | Find the Maximum Number of Fruits Collected | C++ Python | O(n^2) | O(1) | Hard | DP | |
| 3366 | Minimum Array Sum | C++ Python | O(nlogn) | O(n) | Medium | DP, Greedy, Case Works | |
| 3372 | Maximize the Number of Target Nodes After Connecting Trees I | C++ Python | O(nlogn + mlogm) | O(n + m) | Medium | Brute Force, BFS, DFS, Tree DP, Centroid Decomposition, Prefix Sum | |
| 3381 | Maximum Subarray Sum With Length Divisible by K | C++ Python | O(n) | O(k) | Medium | Prefix Sum, DP | |
| 3388 | Count Beautiful Splits in an Array | C++ Python | O(n^2) | O(n) | Medium | DP, Z-Function | |
| 3389 | Minimum Operations to Make Character Frequencies Equal | C++ Python | O(26 * n) | O(26) | Hard | Freq Table, DP | |
| 3393 | Count Paths With the Given XOR Value | C++ Python | O(m * n * r) | O(n * r) | Medium | DP | |
| 3409 | Longest Subsequence With Decreasing Adjacent Difference | C++ Python | O(r^2 + n * r) | O(r^2) | Medium | DP | |
| 3414 | Maximum Score of Non-overlapping Intervals | C++ Python | O(nlogn + n * k^2) | O(n * k^2) | Hard | DP, Binary Search | |
| 3418 | Maximum Amount of Money Robot Can Earn | C++ Python | O(m * n) | O(min(m, n)) | Medium | DP | |
| 3429 | Paint House IV | C++ Python | O(n * l^4) | O(l^2) | Medium | DP | |
| 3434 | Maximum Frequency After Subarray Operation | C++ Python | O(n) | O(n) | Medium | Freq Table, DP | |
| 3441 | Minimum Cost Good Caption | C++ Python | O(26 * n) | O(26 * n) | Hard | DP, Backtracing | |
| 3444 | Minimum Increments for Target Multiples in an Array | C++ Python | O(logr * m * 2^m + n * 3^m) | O(2^m) | Hard | Bitmasks, Number Theory, DP, Submask Enumeration | |
| 3459 | Length of Longest V-Shaped Diagonal Segment | C++ Python | O(n * m) | O(n * m) | Hard | Memoization, DP | |
| 3466 | Maximum Coin Collection | C++ Python | O(n) | O(1) | Medium | 🔒 | DP |
| 3469 | Find Minimum Cost to Remove Array Elements | C++ Python | O(n^2) | O(n) | Medium | DP, Greedy | |
| 3472 | Longest Palindromic Subsequence After at Most K Operations | C++ Python | O(n^2 * k) | O(n^2 * k) | Medium | DP | |
| 3473 | Sum of K Subarrays With Length at Least M | C++ Python | O(k * n) | O(n) | Medium | Prefix Sum, DP | |
| 3489 | Zero Array Transformation IV | C++ Python | O(n^2 * r * logq) | O(r) | Medium | Binary Search, DP | |
| 3490 | Count Beautiful Numbers | C++ Python | O(logr * 2 * 10 * s) | O(logr * 2 * 10 * s) | Hard | DP | |
| 3500 | Minimum Cost to Divide Array Into Subarrays | C++ Python | O(nlogn) | O(n) | Hard | Prefix Sum, DP, Convex Hull Trick | |
| 3503 | Longest Palindrome After Substring Concatenation I | C++ Python | O(n * m) | O(n + m) | Medium | Manacher's Algorithm, DP | |
| 3504 | Longest Palindrome After Substring Concatenation II | C++ Python | O(n * m) | O(n + m) | Hard | Manacher's Algorithm, DP | |
| 3505 | Minimum Operations to Make Elements Within K Subarrays Equal | C++ Python | O(nlogx + k * n) | O(n) | Hard | Two Heaps, Two BSTs, Two Sorted Lists, DP | |
| 3509 | Maximum Product of Subsequences With an Alternating Sum Equal to K | C++ Python | O(n * k * l) | O(n * k * l) | Hard | DP | |
| 3524 | Find X Value of Array I | C++ Python | O(n * k) | O(k) | Medium | DP | |
| 3525 | Find X Value of Array II | C++ Python | O(n * k + q * k * logn) | O(n * k) | Hard | DP, Segment Tree | |
| 3530 | Maximum Profit from Valid Topological Order in DAG | C++ Python | O(n * 2^n) | O(2^n) | Hard | DP, Bitmasks | |
| 3533 | Concatenated Divisibility | C++ Python | O(nlogr + k * n * 2^n) | O(logr + k * 2^n) | Hard | DP, Bitmasks, Backtracing | |
| 3538 | Merge Operations for Minimum Travel Time | C++ Python | O((n-k) * k^3) | O(k^2) | Hard | Prefix Sum, DP | |
| 3539 | Find Sum of Array Product of Magical Sequences | C++ Python | O(n * k * m^2) | O(k * m^2) | Hard | DP, Combinatorics | |
| 3543 | Maximum Weighted K-Edge Path | C++ Python | O(k * e * t) | O(n * t) | Medium | DP | |
| 3544 | Subtree Inversion Sum | C++ Python | O(n) | O(n) | Hard | DFS, Tree DP | |
| 3562 | Maximum Profit from Trading Stocks with Discounts | C++ Python | O(n * b) | O(n + b) | Hard | DFS, Tree DP | |
| 3563 | Lexicographically Smallest String After Adjacent Removals | C++ Python | O(n^3) | O(n^2) | Hard | DP | |
| 3573 | Best Time to Buy and Sell Stock V | C++ Python | O(n * k) | O(k) | Medium | DP | |
| 3574 | Maximize Subarray GCD Score | C++ Python | O(nlogn * logr) | O(n + logr) | Hard | Brute Force, Number Theory, Suffix-GCD States, DP, Binary Search | |
| 3575 | Maximum Good Subtree Score | C++ Python | O(n * (2^10)^2) | O(2^10) | Hard | Bitmasks, DFS, Tree DP | |
| 3578 | Count Partitions With Max-Min Difference at Most K | C++ Python | O(n) | O(n) | Medium | Mono Deque, Two Pointers, Sliding Window, DP, Prefix Sum | |
| 3579 | Minimum Steps to Convert String with Operations | C++ Python | O(n^2) | O(26^2) | Hard | DP | |
| 3583 | Count Special Triplets | C++ Python | O(n) | O(n) | Medium | DP, Freq Table | |
| 3592 | Inverse Coin Change | C++ Python | O(n^2) | O(1) | Medium | DP | |
| 3595 | Once Twice | C++ Python | O(n) | O(1) | Medium | 🔒 | DP, Bitmasks |
| 3599 | Partition Array to Minimize XOR | C++ Python | O(n^2 * k) | O(n) | Medium | DP, Prefix Sum | |
| 3603 | Minimum Cost Path with Alternating Directions II | C++ Python | O(m * n) | O(1) | Medium | DP | |
| 3610 | Minimum Number of Primes to Sum to Target | C++ Python | O(nlog(log(min(m, n))) + m * n) | O(n) | Medium | 🔒 | Number Theory, Knapsack DP |
| 3615 | Longest Palindromic Path in Graph | C++ Python | O(n^4 * 2^n) | O(n + e) | Hard | Bitmasks, DP, Freq Table | |
| 3628 | Maximum Number of Subsequences After One Inserting | C++ Python | O(n) | O(1) | Medium | Prefix Sum, DP | |
| 3647 | Maximum Weight in Two Bags | C++ Python | O(n * w1 * w2) | O(w1 * w2) | Medium | 🔒 | DP, Bitset |
| 3651 | Minimum Cost Path with Teleportations | C++ Python | O(k * (m * n + r)) | O(m * n + r) | Hard | DP, Prefix Sum | |
| 3654 | Minimum Sum After Divisible Sum Deletions | C++ Python | O(n + k) | O(k) | Medium | DP, Prefix Sum | |
| 3661 | Maximum Walls Destroyed by Robots | C++ Python | O(nlogn + mlogm) | O(n) | Hard | Sort, DP, Two Pointers | |
| 3665 | Twisted Mirror Path Count | C++ Python | O(m * n) | O(min(m, n)) | Medium | DP | |
| 3670 | Maximum Product of Two Integers With No Common Bits | C++ Python | O(n + rlogr) | O(r) | Medium | DP, Bitmasks | |
| 3685 | Subsequence Sum After Capping Elements | C++ Python | O(nlogn + n * k) | O(k) | Medium | Sort, DP, Bitmasks | |
| 3686 | Number of Stable Subsequences | C++ Python | O(n) | O(1) | Hard | DP | |
| 3693 | Climbing Stairs II | C++ Python | O(n) | O(1) | Medium | DP | |
| 3699 | Number of ZigZag Arrays I | C++ Python | O(n * (r - l)) | O(r - l) | Hard | DP | |
| 3704 | Count No-Zero Pairs That Sum to N | C++ Python | O(10 * 2^4 * logn) | O(2^3) | Hard | DP | |
| 3717 | Minimum Operations to Make the Array Beautiful | C++ Python | O(n * rlogr) | O(r) | Medium | 🔒 | DP |
| 3725 | Count Ways to Choose Coprime Integers from Rows | C++ Python | O(n * rlogr) | O(r) | Hard | DP, Number Theory, Linear Sieve of Eratosthenes, Mobius Function, Principle of Inclusion-Exclusion | |
| 3742 | Maximum Path Score in a Grid | C++ Python | O(m * n * k) | O(m * n * k) | Medium | DP | |
| 3743 | Maximize Cyclic Partition Score | C++ Python | O(n * k) | O(k) | Hard | variant of Best Time to Buy and Sell Stock V | DP |
| 3753 | Total Waviness of Numbers in Range II | C++ Python | O(logn * 11 * 11 * 2 * 2 * 10) | O(11 * 11 * 2 * 2) | Hard | DP, Memoization | |
| 3757 | Number of Effective Subsequences | C++ Python | O((n + r) * logr) | O(n + r) | Hard | SOS DP, Principle of Inclusion and Exclusion | |
| 3772 | Maximum Subgraph Score in a Tree | C++ Python | O(n) | O(n) | Hard | BFS, Tree DP | |
| 3791 | Number of Balanced Integers in a Range | C++ Python | O((logn)^2) | O(logn) | Hard | DP, Memoization | |
| 3801 | Minimum Cost to Merge Sorted Lists | C++ Python | O(l * nlogn + 2^n * log(n * l) * n * logl + 3^n) | O(n * l + 2^n) | Hard | DP, Sort, Heap, Binary Search, Submask Enumeration | |
| 3811 | Number of Alternating XOR Partitions | C++ Python | O(n) | O(1) | Medium | DP, Freq Table | |
| 3830 | Longest Alternating Subarray After Removing At Most One Element | C++ Python | O(n) | O(1) | Hard | DP, Prefix Sum | |
| 3836 | Maximum Score Using Exactly K Pairs | C++ Python | O(n * m * k) | O(min(n, m) * k) | Hard | DP | |
| 3840 | House Robber V | C++ Python | O(n) | O(1) | Medium | DP | |
| 3850 | Count Sequences to K | C++ Python | O(3^(n/2)) | O(3^(n/2)) | Hard | DP, Meet in The Middle | |
| 3864 | Minimum Cost to Partition a Binary String | C++ Python | O(n) | O(n) | Hard | Prefix Sum, Divide and Conquer, DP | |
| 3869 | Count Fancy Numbers in a Range | C++ Python | O(g * d + d^2) | O(g + d) | Hard | BFS, DP, Principle of Inclusion and Exclusion | |
| 3877 | Minimum Removals to Achieve Target XOR | C++ Python | O(n * r) | O(r) | Medium | Bitmasks, DP, BFS | |
| 3882 | Minimum XOR Path in a Grid | C++ Python | O(m * n * r) | O(n * r) | Medium | DP | |
| 3883 | Count Non Decreasing Arrays With Given Digit Sums | C++ Python | precompute: O(rlogr) runtime: O(n * r) | O(r) | Medium | DP, Prefix Sum | |
| 3891 | Minimum Increase to Maximize Special Indices | C++ Python | O(n) | O(1) | Medium | DP | |
| 3906 | Count Good Integers on a Grid Path | C++ Python | O(16 * 2 * 10 * 10) | O(16 + 2 * 10) | Hard | Memoization, DP | |
| 3916 | Number of ZigZag Arrays III | C++ Python | O(n^3) | O(n) | Hard | 🔒 | DP, Prefix Sum, Combinatorics, Lagrange Interpolation |
| 3939 | Count Non Adjacent Subsets in a Rooted Tree | C++ Python | O(n * k^2) | O(n * k) | Hard | 🔒 | Topological Sort, Tree DP |
| 3946 | Maximum Number of Items From Sale I | C++ Python | O(rlogr + n * b) | O(r + b) | Medium | Freq Table, Knapsack DP | |
| 3949 | Subtree Inversion Sum II | C++ Python | O(n * k) | O(n + h * k) | Hard | 🔒 | DFS, Tree DP |
| 3953 | Maximum Score with Co-Prime Element | C++ Python | O(n + rlogr) | O(r) | Hard | DP, Number Theory, Linear Sieve of Eratosthenes, Mobius Function, Principle of Inclusion-Exclusion | |
| 3965 | Finish Time of Tasks I | C++ Python | O(n) | O(n) | Medium | DFS, Tree DP | |
| 3966 | Count Good Integers in a Range | C++ Python | O(10 * logr) | O(10) | Hard | DP, Prefix Sum | |
| 3967 | Finish Time of Tasks II | C++ Python | O(n) | O(n) | Hard | 🔒 | DFS, Tree DP |
| 3976 | Maximum Subarray Sum After Multiplier | C++ Python | O(n) | O(1) | Medium | DP, Kadane's Algorithm | |
| 3981 | Count Distinct Ways to Form Target from Two Strings | C++ Python | O(n * m * t) | O(n * m) | Hard | DP, Prefix Sum | |
| 3983 | Subsequence After One Replacement | C++ Python | O(n + m) | O(1) | Medium | DP | |
| 3989 | Maximum Consistent Columns in a Grid | C++ Python | O(m * n^2 / 64) | O(n^2 / 64) | Hard | Sort, Prefix Sum, Binary Search, DP, Bitmasks | |
| 3995 | Minimum Cost to Convert String III | C++ Python | O(n * r * l) | O(min(n, l)) | Hard | DP | |
| 4009 | Minimum Possible Maximum Waiting Time | C++ Python | O(n * rlogr) | O(r) | Hard | Binary Search, DP, Bitmasks | |
| 4016 | Maximum Area of Two Non-Overlapping Square Submatrices | C++ Python | O(m * n) | O(n + min(m, n)) | Medium | DP | |
| 4023 | Elevator Requests II | C++ Python | O(m^2) | O(m) | Hard | DP | |
| 4027 | Elevator Requests III | C++ Python | O(m^2) | O(m) | Hard | Bitmasks, Sort, Binary Search, DP | |
| 4029 | Elevator Requests IV | C++ Python | O(m^2) | O(m) | Hard | 🔒 | Sort, Binary Search, DP |
| 4040 | Minimum Operations to Form Subset Sum I | C++ Python | O(n * s * (logs + logr)) | O(s) | Medium | Knapsack DP | |
| 4041 | Minimum Operations to Form Subset Sum II | C++ Python | O(n * s * logs * logr) | O(s) | Hard | Knapsack DP | |
| 4046 | Minimum Cost Path With At Most K Turns | C++ Python | O(m * n * k) | O(m * n) | Hard | DP, Graph, Dijkstra's Algorithm | |
| 4050 | Minimum Days to Score Exactly N Points | C++ Python | O(n * sqrt(n)) | O(n) | Medium | DP | |
| 4069 | Best Time to Buy and Sell Stock with Cooldown II | C++ Python | O(n^2) | O(n) | Medium | 🔒 | DP |
| 4072 | Maximum Alternating Subarray Sum With One Deletion | C++ Python | O(n) | O(1) | Medium | DP | |
| 4077 | Minimize Inversions in a Prefix Tree | C++ Python | O(n * l + nlogn) | O(t) | Hard | Trie, Tree DP, Bitmasks, Heap | |
| 4081 | Prime Subset Selection II | C++ Python | O(n + (n / logn) * s) | O(n + (n / logn) * s) | Hard | Number Theory, Linear Sieve of Eratosthenes, Knapsack DP, Greedy, Backtracing | |
| 4082 | Minimum Operations to Stabilize a Binary Tree | C++ Python | O(nlogn) | O(n) | Hard | 🔒 | Tree dp, Slope Trick, Treap, Heap, Small-to-Large Merging |
Greedy
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3002 | Maximum Size of a Set After Removals | C++ Python | O(n) | O(n) | Medium | Math, Hash Table, Greedy | |
| 3003 | Maximize the Number of Partitions After Operations | C++ Python | O(n) | O(n) | Hard | Prefix Sum, Greedy | |
| 3012 | Minimize Length of Array Using Operations | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3014 | Minimum Number of Pushes to Type Word I | C++ Python | O(4) | O(1) | Easy | Freq Table, Greedy | |
| 3016 | Minimum Number of Pushes to Type Word II | C++ Python | O(n) | O(26) | Medium | Freq Table, Greedy | |
| 3022 | Minimize OR of Remaining Elements Using Operations | C++ Python | O(nlogr) | O(1) | Hard | Bitmasks, Greedy | |
| 3035 | Maximum Palindromes After Operations | C++ Python | O(n * l + nlogn) | O(n) | Medium | Freq Table, Greedy, Sort | |
| 3068 | Find the Maximum Sum of Node Values | C++ Python | O(n) | O(1) | Hard | Greedy | |
| 3074 | Apple Redistribution into Boxes | C++ Python | O(nlogn) | O(1) | Easy | Sort, Greedy | |
| 3075 | Maximize Happiness of Selected Children | C++ Python | O(nlogn) | O(1) | Medium | Sort, Greedy | |
| 3086 | Minimum Moves to Pick K Ones | C++ Python | O(n) | O(n) | Hard | Prefix Sum, Greedy | |
| 3088 | Make String Anti-palindrome | C++ Python | O(n + 26) | O(26) | Hard | 🔒 | Freq Table, Counting Sort, Greedy, Two Pointers |
| 3106 | Lexicographically Smallest String After Operations With Constraint | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3107 | Minimum Operations to Make Median of Array Equal to K | C++ Python | O(n) | O(1) | Medium | Sort, Quick Select, Greedy | |
| 3111 | Minimum Rectangles to Cover Points | C++ Python | O(nlogn) | O(n) | Medium | Sort, Greedy | |
| 3114 | Latest Time You Can Obtain After Replacing Characters | C++ Python | O(1) | O(1) | Easy | String, Greedy | |
| 3119 | Maximum Number of Potholes That Can Be Fixed | C++ Python | O(n) | O(n) | Medium | 🔒 | Sort, Counting Sort, Greedy |
| 3170 | Lexicographically Minimum String After Removing Stars | C++ Python | O(n + 26) | O(n + 26) | Medium | Greedy, Hash Table, Stack | |
| 3189 | Minimum Moves to Get a Peaceful Board | C++ Python | O(n) | O(n) | Medium | 🔒, variant of Distribute Coins in Binary Tree | Counting Sort, Prefix Sum, Greedy |
| 3191 | Minimum Operations to Make Binary Array Elements Equal to One I | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3192 | Minimum Operations to Make Binary Array Elements Equal to One II | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3205 | Maximum Array Hopping Score I | C++ Python | O(n) | O(1) | Medium | 🔒 | DP, Prefix Sum, Greedy |
| 3207 | Maximum Points After Enemy Battles | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3216 | Lexicographically Smallest String After a Swap | C++ Python | O(n) | O(1) | Easy | Greedy | |
| 3218 | Minimum Cost for Cutting Cake I | C++ Python | O(mlogm + nlogn) | O(1) | Medium | Memoization, Greedy | |
| 3219 | Minimum Cost for Cutting Cake II | C++ Python | O(mlogm + nlogn) | O(1) | Hard | Greedy | |
| 3221 | Maximum Array Hopping Score II | C++ Python | O(n) | O(1) | Medium | 🔒 | Prefix Sum, Greedy |
| 3228 | Maximum Number of Operations to Move Ones to the End | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3229 | Minimum Operations to Make Array Equal to Target | C++ Python | O(n) | O(1) | Hard | variant of Minimum Number of Increments on Subarrays to Form a Target Array | Greedy |
| 3239 | Minimum Number of Flips to Make Binary Grid Palindromic I | C++ Python | O(m * n) | O(1) | Medium | Array, Greedy | |
| 3240 | Minimum Number of Flips to Make Binary Grid Palindromic II | C++ Python | O(m * n) | O(1) | Medium | Array, Greedy | |
| 3273 | Minimum Amount of Damage Dealt to Bob | C++ Python | O(nlogn) | O(n) | Hard | Sort, Greedy | |
| 3282 | Reach End of Array With Max Score | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3301 | Maximize the Total Height of Unique Towers | C++ Python | O(nlogn) | O(1) | Medium | Sort, Greedy | |
| 3302 | Find the Lexicographically Smallest Valid Sequence | C++ Python | O(n + m) | O(m) | Medium | Hash Table, Greedy | |
| 3362 | Zero Array Transformation III | C++ Python | O(n + qlogq) | O(q) | Medium | Sort, Heap, Greedy | |
| 3397 | Maximum Number of Distinct Elements After Operations | C++ Python | O(nlogn) | O(1) | Medium | Sort, Greedy | |
| 3402 | Minimum Operations to Make Columns Strictly Increasing | C++ Python | O(m * n) | O(1) | Easy | Greedy | |
| 3403 | Find the Lexicographically Largest String From the Box I | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3406 | Find the Lexicographically Largest String From the Box II | C++ Python | O(n) | O(1) | Hard | 🔒 | Greedy |
| 3410 | Maximize Subarray Sum After Removing All Occurrences of One Element | C++ Python | O(n) | O(n) | Hard | Prefix Sum, Greedy, Kadane's Algorithm, Segment Tree | |
| 3424 | Minimum Cost to Make Arrays Identical | C++ Python | O(nlogn) | O(1) | Medium | Sort, Greedy | |
| 3443 | Maximum Manhattan Distance After K Changes | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3457 | Eat Pizzas! | C++ Python | O(nlogn) | O(1) | Medium | Sort, Greedy | |
| 3458 | Select K Disjoint Special Substrings | C++ Python | O(n + 26^3) | O(26) | Medium | Hash Table, Sort, Greedy | |
| 3462 | Maximum Sum With at Most K Elements | C++ Python | O(n * m) | O(1) | Medium | Greedy, Quick Select | |
| 3468 | Find the Number of Copy Arrays | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3474 | Lexicographically Smallest Generated String | C++ Python | O(n + m) | O(n + m) | Hard | KMP Algorithm, Z-Function, Two Pointers, Sliding Window, Deque, Greedy | |
| 3476 | Maximize Profit from Task Assignment | C++ Python | O(n + tlogt) | O(n) | Medium | 🔒 | Freq Table, Sort, Greedy |
| 3478 | Choose K Elements With Maximum Sum | C++ Python | O(nlogn) | O(n) | Medium | Sort, Greedy, Two Pointers, Heap | |
| 3480 | Maximize Subarrays After Removing One Conflicting Pair | C++ Python | O(n + m) | O(n + m) | Hard | Greedy | |
| 3494 | Find the Minimum Amount of Time to Brew Potions | C++ Python | O(n * m) | O(1) | Medium | Prefix Sum, Greedy | |
| 3494 | Find the Minimum Amount of Time to Brew Potions | C++ Python | O(n * m) | O(1) | Medium | Prefix Sum, Greedy | |
| 3495 | Minimum Operations to Make Array Elements Zero | C++ Python | O(qlogr) | O(1) | Hard | Greedy | |
| 3496 | Maximize Score After Pair Deletions | C++ Python | O(n) | O(1) | Medium | 🔒 | Greedy |
| 3499 | Maximize Active Section with Trade I | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3501 | Maximize Active Section with Trade II | C++ Python | O(nlogn + q) | O(nlogn) | Hard | Greedy, RMQ, Sparse Table | |
| 3506 | Find Time Required to Eliminate Bacterial Strains | C++ Python | O(nlogn) | O(1) | Hard | 🔒 | Heap, Greedy |
| 3511 | Make a Positive Array | C++ Python | O(n) | O(1) | Medium | 🔒 | Prefix Sum, Greedy |
| 3517 | Smallest Palindromic Rearrangement I | C++ Python | O(n + 26) | O(26) | Medium | Freq Table, Counting Sort, Greedy | |
| 3518 | Smallest Palindromic Rearrangement II | C++ Python | O(26 * n) | O(26) | Hard | Freq Table, Counting Sort, Greedy, Combinatorics | |
| 3523 | Make Array Non-decreasing | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3542 | Minimum Operations to Convert All Elements to Zero | C++ Python | O(n) | O(n) | Medium | Greedy, Mono Stack | |
| 3545 | Minimum Deletions for At Most K Distinct Characters | C++ Python | O(n + 26) | O(n + 26) | Easy | Freq Table, Counting Sort, Greedy | |
| 3557 | Find Maximum Number of Non Intersecting Substrings | C++ Python | O(n) | O(26) | Medium | Greedy, Hash Table | |
| 3576 | Transform Array to All Equal Elements | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3587 | Minimum Adjacent Swaps to Alternate Parity | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3627 | Maximum Median Sum of Subsequences of Size 3 | C++ Python | O(nlogn) | O(1) | Medium | Sort, Greedy | |
| 3630 | Partition Array for Maximum XOR and AND | C++ Python | O(nlogr * 2^n) | O(1) | Hard | Bitmasks, Greedy | |
| 3633 | Earliest Finish Time for Land and Water Rides I | C++ Python | O(n) | O(1) | Easy | Greedy | |
| 3635 | Earliest Finish Time for Land and Water Rides II | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3638 | Maximum Balanced Shipments | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3645 | Maximum Total from Optimal Activation Order | C++ Python | O(nlogn) | O(n) | Medium | Sort, Greedy | |
| 3675 | Minimum Operations to Transform String | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3681 | Maximum XOR of Subsequences | C++ Python | O(nlogr) | O(r) | Hard | Bitmasks, Greedy | |
| 3689 | Maximum Total Subarray Value I | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3711 | Maximum Transactions Without Negative Balance | C++ Python | O(nlogn) | O(n) | Medium | 🔒 | Greedy, Heap |
| 3720 | Lexicographically Smallest Permutation Greater Than Target | C++ Python | O(26 * n) | O(26) | Medium | Freq Table, Greedy | |
| 3723 | Maximize Sum of Squares of Digits | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3724 | Minimum Operations to Transform Array | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3727 | Maximum Alternating Sum of Squares | C++ Python | O(n) | O(n) | Medium | Greedy, Sort, Quick Select | |
| 3730 | Maximum Calories Burnt from Jumps | C++ Python | O(nlogn) | O(1) | Medium | 🔒 | Greedy, Sort |
| 3732 | Maximum Product of Three Elements After One Replacement | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3734 | Lexicographically Smallest Palindromic Permutation Greater Than Target | C++ Python | O(26 * n) | O(26) | Hard | Freq Table, Greedy | |
| 3752 | Lexicographically Smallest Negated Permutation that Sums to Target | C++ Python | O(n) | O(1) | Medium | Greedy, Two Pointers | |
| 3763 | Maximum Total Sum with Threshold Constraints | C++ Python | O(n) | O(n) | Medium | 🔒 | Sort, Counting Sort, Greedy |
| 3767 | Maximize Points After Choosing K Tasks | C++ Python | O(n) | O(n) | Medium | Greedy, Sort, Quick Select | |
| 3776 | Minimum Moves to Balance Circular Array | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3785 | Minimum Swaps to Avoid Forbidden Values | C++ Python | O(n) | O(1) | Hard | Boyer–Moore Majority Vote Algorithm, Freq Table, Greedy | |
| 3796 | Find Maximum Value in a Constrained Sequence | C++ Python | O(n) | O(n) | Medium | Greedy, DP | |
| 3797 | Count Routes to Climb a Rectangular Grid | C++ Python | O(n * m) | O(m) | Hard | DP, Two Pointers | |
| 3806 | Maximum Bitwise AND After Increment Operations | C++ Python | O(nlogr) | O(n) | Hard | Bitmasks, Greedy, Sort, Quick Select | |
| 3812 | Minimum Edge Toggles on a Tree | C++ Python | O(n) | O(n) | Hard | Greedy, Topological Sort, Bitmasks | |
| 3816 | Lexicographically Smallest String After Deleting Duplicate Characters | C++ Python | O(n + 26) | O(26) | Hard | Freq Table, Greedy | |
| 3828 | Final Element After Subarray Deletions | C++ Python | O(1) | O(1) | Medium | Greedy, Game Theory | |
| 3849 | Maximum Bitwise XOR After Rearrangement | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3854 | Minimum Operations to Make Array Parity Alternating | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3858 | Minimum Bitwise OR From Grid | C++ Python | O(nlogr) | O(1) | Medium | Bitmasks, Greedy | |
| 3863 | Minimum Operations to Sort a String | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3868 | Minimum Cost to Equalize Arrays Using Swaps | C++ Python | O(n) | O(n) | Medium | Freq Table, Greedy | |
| 3888 | Minimum Operations to Make All Grid Elements Equal | C++ Python | O(m * n) | O(k * n) | Hard | 🔒 | Sliding Window, Greedy, Difference Array |
| 3892 | Minimum Operations to Achieve At Least K Peaks | C++ Python | O(n + klogn) | O(n) | Hard | Greedy, Heap, Doubly Linked List | |
| 3897 | Maximum Value of Concatenated Binary Segments | C++ Python | O(r + nlogn) | O(r + n) | Hard | Greedy | |
| 3914 | Minimum Operations to Make Array Non Decreasing | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3919 | Minimum Cost to Move Between Indices | C++ Python | O(n) | O(n) | Medium | Greedy, Prefix Sum | |
| 3922 | Minimum Flips to Make Binary String Coherent | C++ Python | O(n) | O(1) | Medium | Greedy, Case Works | |
| 3947 | Maximum Number of Items From Sale II | C++ Python | O(nlogn) | O(n) | Medium | Freq Table, Sort, Greedy | |
| 3948 | Lexicographically Maximum MEX Array | C++ Python | O(n) | O(n) | Hard | Hash Table, Freq Table, Prefix Sum, Greedy | |
| 3952 | Maximum Total Value of Covered Indices | C++ Python | O(n) | O(1) | Medium | Greedy, DP | |
| 3961 | Maximize Sum of Device Ratings | C++ Python | O(m * n) | O(1) | Medium | Greedy | |
| 3964 | Minimum Lights to Illuminate a Road | C++ Python | O(n) | O(n) | Medium | Difference Array, Greedy | |
| 3974 | Maximum Total Sum of K Selected Elements | C++ Python | O(nlogk) | O(k) | Medium | Sort, Greedy | |
| 3980 | Minimum Operations to Transform Binary String | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 3994 | Minimum Adjacent Swaps to Partition Array | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 4000 | Largest Integer With Given Digit Sum | C++ Python | O(n) | O(1) | Easy | Greedy | |
| 4014 | Minimum Total Price After Applying Discounts | C++ Python | O(nlogn + mlogm) | O(1) | Medium | Sort, Greedy | |
| 4019 | Merge Close Characters II | C++ Python | O(n) | O(n) | Medium | 🔒 | Greedy, Hash Table |
| 4025 | Minimize the Maximum Waiting Time at Synchronized Traffic Lights | C++ Python | O(n) | O(n) | Medium | Greedy | |
| 4026 | Maximum Gap Between Stations | C++ Python | O(n) | O(n) | Medium | Prefix Sum, Greedy | |
| 4036 | Lexicographically Largest String After Pair Transformations | C++ Python | O(n) | O(1) | Medium | Greedy | |
| 4045 | Count Robot Groups | C++ Python | O(n) | O(1) | Medium | Backward Simulation, Greedy, Mono Stack | |
| 4053 | Minimum Operations to Make Every Element Palindromic | C++ Python | O(nlogr) | O(1) | Medium | Greedy, Precompute, Binary Search | |
| 4059 | Lexicographically Largest Power Array | C++ Python | O(l * n) | O(n) | Hard | Greedy, Bitmasks, Sort | |
| 4079 | Prime Subset Selection I | C++ Python | precompute: O(r) runtime: O(min(n / logn, sqrt(s))) | O(r) | Medium | Number Theory, Linear Sieve of Eratosthenes, Greedy | |
| 4086 | Minimum Interval Selection to Cover Target Intervals | C++ Python | O(n + m + r) | O(r) | Hard | Line Sweep, Difference Array, Sort, Greedy | |
| 4087 | Maximum Subarray Sum of Fixed Length After at Most K Swaps | C++ Python | O(nlogn) | O(n) | Medium | 🔒 | Sort, Coordinate Compression, BIT, Fenwick Tree, Binary Search, Greedy, Two Pointers, Sliding window |
| 4093 | Maximize Sum After At Most K Digit Rearrangements | C++ Python | O(n) | O(n) | Medium | Greedy, Quick Select, Sort | |
| 4098 | Minimize the Maximum Value of GCD-Connected Array | C++ Python | precompute: O(sqrt(r)) runtime: O(sqrt(n) / logn) | O(sqrt(r)) | Medium | Number Theory, Linear Sieve of Eratosthenes, Greedy |
Graph
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3108 | Minimum Cost Walk in Weighted Graph | C++ Python | O(n + e + q) | O(n) | Hard | Union Find | |
| 3112 | Minimum Time to Visit Disappearing Nodes | C++ Python | O(|E| * log|V|) | O(|E|) | Medium | Graph, Dijkstra's Algorithm | |
| 3123 | Find Edges in Shortest Paths | C++ Python | O(|E| * log|V|) | O(|E|) | Hard | Graph, Dijkstra's Algorithm | |
| 3235 | Check if the Rectangle Corner Is Reachable | C++ Python | O(n^2) | O(n) | Hard | Graph, BFS, DFS, Union Find | |
| 3243 | Shortest Distance After Road Addition Queries I | C++ Python | O(n^2) | O(n^2) | Medium | Graph, Dijkstra's Algorithm, BFS | |
| 3244 | Shortest Distance After Road Addition Queries II | C++ Python | O(nlogn) | O(n) | Hard | Graph, BST, Sorted List | |
| 3265 | Count Almost Equal Pairs I | C++ Python | O(n * l^2) | O(n) | Medium | Freq Table, Combinatorics, Graph, BFS | |
| 3267 | Count Almost Equal Pairs II | C++ Python | O(n * l^4) | O(n) | Hard | Freq Table, Combinatorics, Graph, BFS | |
| 3276 | Select Cells in Grid With Maximum Score | C++ Python | O(n^2 * max(n, r)) | O(n * max(n, r)) | Hard | variant of Maximum Compatibility Score Sum | Hungarian Weighted Bipartite Matching, DP, Bitmasks |
| 3310 | Remove Methods From Project | C++ Python | O(n + e) | O(n + e) | Medium | Graph, BFS | |
| 3341 | Find Minimum Time to Reach Last Room I | C++ Python | O(n * m * log(n * m)) | O(n * m) | Medium | Graph, Dijkstra's Algorithm | |
| 3342 | Find Minimum Time to Reach Last Room II | C++ Python | O(n * m * log(n * m)) | O(n * m) | Medium | Graph, Dijkstra's Algorithm | |
| 3377 | Digit Operations to Make Two Integers Equal | C++ Python | O(nlogn) | O(n) | Medium | Graph, Number Theory, Linear Sieve of Eratosthenes, Dijkstra's Algorithm | |
| 3378 | Count Connected Components in LCM Graph | C++ Python | O(n + tlogt) | O(t) | Hard | Number Theory, Graph, Union Find | |
| 3383 | Minimum Runes to Add to Cast Spell | C++ Python | O(n) | O(n) | Hard | 🔒 | Graph, Tarjan's Strongly Connected Components Algorithm, SCC |
| 3376 | Minimum Time to Break Locks I | C++ Python | O(n^3) | O(n^2) | Medium | Bitmasks, DP, Graph, Hungarian Weighted Bipartite Matching | |
| 3385 | Minimum Time to Break Locks II | C++ Python | O(n^3) | O(n^2) | Hard | 🔒 | Graph, Hungarian Weighted Bipartite Matching |
| 3387 | Maximize Amount After Two Days of Conversions | C++ Python | O(n^2) | O(n) | Medium | Bellman-Ford Algorithm, BFS | |
| 3419 | Minimize the Maximum Edge Weight of Graph | C++ Python | O(nlogn + e) | O(n + e) | Medium | Graph, Dijkstra's Algorithm, Prim's Algorithm, Binary Search, BFS | |
| 3435 | Frequencies of Shortest Supersequences | C++ Python | O(n + k^2 * 2^k) | O(k^2) | Hard | Bitmasks, Graph, Topological Sort | |
| 3481 | Apply Substitutions | C++ Python | O(r * 2^r) | O(r * 2^r) | Medium | 🔒 | Graph, Topological Sort, Memoization |
| 3493 | Properties Graph | C++ Python | O(n^2 * m) | O(n) | Medium | Graph, Flood Fill, BFS, Union Find | |
| 3532 | Path Existence Queries in a Graph I | C++ Python | O(n + q) | O(n) | Medium | Prefix Sum | |
| 3534 | Path Existence Queries in a Graph II | C++ Python | O((n + q) * logn) | O(nlogn) | Hard | Prefix Sum, Greedy, Binary Lifting | |
| 3536 | Maximum Product of Two Digits | C++ Python | O(d + 10) | O(10) | Easy | Freq Table, Greedy | |
| 3547 | Maximum Sum of Edge Values in a Graph | C++ Python | O(n) | O(n) | Hard | Flood Fill, BFS, Counting Sort, Greedy | |
| 3594 | Minimum Time to Transport All Individuals | C++ Python | O(m * 3^n * log(m * 3^n)) | O(m * 3^n) | Hard | Graph, Dijkstra's Algorithm, Submask Enumeration | |
| 3600 | Maximize Spanning Tree Stability with Upgrades | C++ Python | O(n + eloge) | O(n) | Hard | MST, Maximum Spanning Tree, Union Find, Kruskal's Algorithm, Greedy | |
| 3604 | Minimum Time to Reach Destination in Directed Graph | C++ Python | O(n + elogn) | O(n + e) | Medium | Graph, Dijkstra's Algorithm | |
| 3620 | Network Recovery Pathways | C++ Python | O((n + e) * logr) | O(n + e) | Hard | Binary Search, Topological Sort, DP | |
| 3650 | Minimum Cost Path with Edge Reversals | C++ Python | O(n + elogn) | O(n + e) | Medium | Graph, Dijkstra's Algorithm | |
| 3656 | Determine if a Simple Graph Exists | C++ Python | O(nlogn) | O(1) | Medium | 🔒 | Graph, Erdős–Gallai Theorem, Sort, Prefix sum, Two Pointers |
| 3660 | Jump Game IX | C++ Python | O(n) | O(1) | Medium | Graph, Prefix Sum | |
| 3710 | Maximum Partition Factor | C++ Python | O(n^2 * logn) | O(n^2) | Hard | Graph, Sort, Coordinate Compression, Binary Search, BFS, Greedy, Union Find | |
| 3778 | Minimum Distance Excluding One Maximum Weighted Edge | C++ Python | O(n + elogn) | O(n + e) | Medium | 🔒 | Graph, Dijkstra's Algorithm |
| 3873 | Maximum Points Activated with One Addition | C++ Python | O(n) | O(n) | Hard | Graph, Union Find | |
| 3887 | Incremental Even-Weighted Cycle Queries | C++ Python | O(n + e) | O(n) | Hard | Graph, Union Find | |
| 3910 | Count Connected Subgraphs with Even Node Sum | C++ Python | O((n + e) * 2^n) | O(n + e) | Hard | Graph, Bitmasks, DFS | |
| 3928 | Minimum Cost to Buy Apples II | C++ Python | O(n * (n + elogn)) | O(n + e) | Hard | Graph, Dijkstra's Algorithm | |
| 3970 | Shortest Path With At Most K Consecutive Identical Characters | C++ Python | O(e * k * log(n * k)) | O(n * k + e) | Medium | Graph, Dijkstra's Algorithm | |
| 3977 | Minimum Time to Reach Target With Limited Power | C++ Python | O((n * p + e * p) * log(n * p)) | O(n * p) | Hard | Graph, Dijkstra's Algorithm | |
| 4003 | Minimum Cost Path with Alternating Directions III | C++ Python | O((m * n) * log(m * n)) | O(m * n) | Hard | Graph, Dijkstra's Algorithm | |
| 4085 | Find Root of a Colored Tree | C++ Python | O(n) | O(n) | Medium | Graph |
Geometry
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3453 | Separate Squares I | C++ Python | O(nlogn) | O(n) | Medium | Binary Search, Sort, Line Sweep | |
| 3454 | Separate Squares II | C++ Python | O(nlogn) | O(n) | Hard | Sort, Line Sweep, Segment Tree |
Simulation
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3100 | Water Bottles II | C++ Python | O(sqrt(n)) | O(1) | Medium | Simulation | |
| 3168 | Minimum Number of Chairs in a Waiting Room | C++ Python | O(n) | O(1) | Easy | Simulation | |
| 3175 | Find The First Player to win K Games in a Row | C++ Python | O(n) | O(1) | Medium | Simulation | |
| 3248 | Snake in Matrix | C++ Python | O(c) | O(1) | Medium | Simulation | |
| 3412 | Find Mirror Score of a String | C++ Python | O(n + 26) | O(n + 26) | Medium | Simulation, Hash Table, Stack | |
| 3433 | Count Mentions Per User | C++ Python | O(eloge + e * n) | O(e + n) | Medium | Simulation | |
| 3507 | Minimum Pair Removal to Sort Array I | C++ Python | O(nlogn) | O(n) | Easy | Simulation, Doubly Linked List, Sorted List, BST | |
| 3510 | Minimum Pair Removal to Sort Array II | C++ Python | O(nlogn) | O(n) | Hard | Simulation, Doubly Linked List, Sorted List, BST | |
| 3522 | Calculate Score After Performing Instructions | C++ Python | O(n) | O(n) | Medium | Simulation | |
| 3561 | Resulting String After Adjacent Removals | C++ Python | O(n) | O(1) | Medium | Simulation, Stack | |
| 3597 | Partition String | C++ Python | O(n) | O(t) | Medium | Simulation, Trie | |
| 3608 | Minimum Time for K Connected Components | C++ Python | O(n + eloge) | O(n) | Medium | Backward Simulation, Sort, Union Find | |
| 3609 | Minimum Moves to Reach Target in Grid | C++ Python | O(logtx + logty) | O(1) | Hard | Backward Simulation | |
| 3612 | Process String with Special Operations I | C++ Python | O(r) | O(r) | Medium | Simulation, Deque | |
| 3613 | Minimize Maximum Component Cost | C++ Python | O(n + eloge) | O(n) | Medium | Backward Simulation, Sort, Union Find | |
| 3614 | Process String with Special Operations II | C++ Python | O(n) | O(1) | Hard | Backward Simulation | |
| 3616 | Number of Student Replacements | C++ Python | O(n) | O(1) | Medium | 🔒 | Simulation |
| 3639 | Minimum Time to Activate String | C++ Python | O(n) | O(n) | Medium | Backward Simulation, Doubly Linked List | |
| 3792 | Sum of Increasing Product Blocks | C++ Python | O(n^2) | O(n^2) | Medium | 🔒 | Simulation, Math |
| 3847 | Find the Score Difference in a Game | C++ Python | O(n) | O(1) | Medium | Simulation | |
| 3853 | Merge Close Characters | C++ Python | O(n + 26) | O(26) | Medium | Simulation, Freq Table, Two Pointers, Sliding Window | |
| 3867 | Sum of GCD of Formed Pairs | C++ Python | O(nlogr) | O(n) | Medium | Simulation, Prefix sum, Sort, Two Pointers | |
| 3894 | Traffic Signal Color | C++ Python | O(1) | O(1) | Easy | Simulation | |
| 3968 | Maximum Manhattan Distance After All Moves | C++ Python | O(n) | O(1) | Medium | Simulation | |
| 4008 | Minimum Initial Strength to Defeat All Monsters | C++ Python | O(n) | O(n) | Medium | Line Sweep, Difference Array, Backward Simulation | |
| 4084 | Last Visited Cell in a Directional Grid | C++ Python | O(n) | O(1) | Medium | Simulation | |
| 4096 | Simulate Bomb Explosions and Falling Boxes | C++ Python | O(m^2 * n) | O(m * n) | Medium | 🔒 | Simulation |
Constructive Algorithms
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3139 | Minimum Cost to Equalize Array | C++ Python | O(n) | O(1) | Hard | Constructive Algorithms, Math | |
| 3260 | Find the Largest Palindrome Divisible by K | C++ Python | O(n) | O(1) | Hard | String, Constructive Algorithms, Math | |
| 3311 | Construct 2D Grid Matching Graph Layout | C++ Python | O(n) | O(n) | Hard | Graph, Constructive Algorithms, BFS | |
| 3375 | Minimum Operations to Make Array Values Equal to K | C++ Python | O(n) | O(n) | Easy | Hash Table, Constructive Algorithms | |
| 3680 | Generate Schedule | C++ Python | O(n^2) | O(1) | Medium | Constructive Algorithms | |
| 3875 | Construct Uniform Parity Array I | C++ Python | O(1) | O(1) | Easy | Constructive Algorithms | |
| 3876 | Construct Uniform Parity Array II | C++ Python | O(n) | O(1) | Medium | Constructive Algorithms | |
| 3988 | Create Grid With Exactly K Paths I | C++ Python | O(m * n) | O(1) | Medium | Constructive Algorithms | |
| 3990 | Create Grid With Exactly K Paths II | C++ Python | O((logk)^2) | O(1) | Hard | 🔒 | Constructive Algorithms |
Design
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3242 | Design Neighbor Sum Service | C++ Python | ctor: O(n^2) adjacentSum: O(1) diagonalSum: O(1) | O(n^2) | Easy | Hash Table | |
| 3369 | Design an Array Statistics Tracker | C++ Python | ctor: O(1) addNumber: O(logn) removeFirstAddedNumber: O(logn) getMean: O(1) getMedian: O(1) getMode: O(1) | O(n) | Hard | 🔒 | Deque, Freq Table, Sorted List, BST |
| 3391 | Design a 3D Binary Matrix with Efficient Layer Tracking | C++ Python | ctor: O(1) setCell: O(logn) unsetCell: O(logn) largestMatrix: O(logn) | O(n^3) | Medium | 🔒 | Heap, Sorted List |
| 3408 | Design Task Manager | C++ Python | ctor: O(tlogt) add: O(logt) edit: O(logt) rmv: O(logt) execTop: O(logt) | O(t) | Medium | Sorted List | |
| 3484 | Design Spreadsheet | C++ Python | ctor: O(1) setCell: O(1) resetCell: O(1) getValue: O(1) | O(n) | Medium | Hash Table | |
| 3508 | Implement Router | C++ Python | ctor: O(1) addPacket: O(logn) forwardPacket: O(logn) getCount: O(logn) | O(n) | Medium | Queue, Sorted List, Ordered Set | |
| 3709 | Design Exam Scores Tracker | C++ Python | ctor: O(1) record: O(1) totalScore: O(logn) | O(n) | Medium | Prefix Sum, Binary Search | |
| 3815 | Design Auction System | C++ Python | ctor: O(1) addBid: O(logn) updateBid: O(logn) removeBid: O(logn) getHighestBidder: O(1) | O(n) | Medium | Hash Table, Heap, Sorted List, BST | |
| 3822 | Design Order Management System | C++ Python | ctor: O(1) addOrder: O(1) modifyOrder: O(1) cancelOrder: O(1) getOrdersAtPrice: O(n) | O(n) | Medium | 🔒 | Hash Table |
| 3829 | Design Ride Sharing System | C++ Python | ctor: O(1) addRider: O(1) addDriver: O(1) matchDriverWithRider: O(1) cancelRider: O(1) | O(n) | Medium | Ordered Dict | |
| 3885 | Design Event Manager | C++ Python | ctor: O(n) updatePriority: O(logn) pollHightest: O(logn) | O(n) | Medium | Sorted List, BST, Heap, Hash Table | |
| 4080 | Design Bus Seat Booking System | C++ Python | ctor: O(1) toggle: O(1) getTotalTime: O(1) getMinTime: O(1) | O(n) | Medium | Hash Table |
JS
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|
SQL
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 3050 | Pizza Toppings Cost Analysis | MySQL | O(n^3 * logn) | O(n^3) | Medium | 🔒 | |
| 3051 | Find Candidates for Data Scientist Position | MySQL | O(nlogn) | O(n) | Easy | 🔒 | |
| 3052 | Maximize Items | MySQL | O(n) | O(n) | Hard | 🔒 | |
| 3053 | Classifying Triangles by Lengths | MySQL | O(n) | O(n) | Easy | 🔒 | |
| 3054 | Binary Tree Nodes | MySQL | O(nlogn) | O(n) | Medium | 🔒 | |
| 3055 | Top Percentile Fraud | MySQL | O(nlogn) | O(n) | Medium | 🔒 | |
| 3056 | Snaps Analysis | MySQL | O(n) | O(n) | Medium | 🔒 | |
| 3057 | Employees Project Allocation | MySQL | O(nlogn) | O(n) | Hard | 🔒 | |
| 3058 | Friends With No Mutual Friends | MySQL | O(n^2 * logn) | O(n^2) | Medium | 🔒 | |
| 3059 | Find All Unique Email Domains | MySQL | O(nlogn) | O(n) | Easy | 🔒 | |
| 3060 | User Activities within Time Bounds | MySQL | O(nlogn) | O(n) | Hard | 🔒 | |
| 3061 | Calculate Trapping Rain Water | MySQL | O(nlogn) | O(n) | Hard | 🔒 | |
| 3087 | Find Trending Hashtags | MySQL | O(nlogn) | O(n) | Medium | 🔒 | |
| 3089 | Find Bursty Behavior | MySQL | O(nlogn) | O(n) | Medium | 🔒 | Window Function |
| 3103 | Find Trending Hashtags II | MySQL | O(n * l^2 + (n * l) * log(n * l)) | O(n * l^2) | Hard | 🔒 | Recursive CTE |
| 3118 | Friday Purchase III | MySQL | O(n) | O(n) | Medium | 🔒 | |
| 3124 | Find Longest Calls | MySQL | O(nlogn) | O(n) | Medium | 🔒 | Window Function |
| 3126 | Server Utilization Time | MySQL | O(nlogn) | O(n) | Medium | Window Function | |
| 3140 | Consecutive Available Seats II | MySQL | O(nlogn) | O(n) | Medium | 🔒 | Window Function |
| 3150 | Invalid Tweets II | MySQL | O(n * l + nlogn) | O(n * l) | Easy | 🔒 | String |
| 3156 | Employee Task Duration and Concurrent Tasks | MySQL | O(nlogn) | O(n) | Hard | 🔒 | Line Sweep |
| 3166 | Calculate Parking Fees and Duration | MySQL | O(nlogn) | O(n) | Medium | 🔒 | |
| 3172 | Second Day Verification | MySQL | O(nlogn) | O(n) | Easy | 🔒 | |
| 3182 | Find Top Scoring Students | MySQL | O(nlogn) | O(n) | Medium | 🔒 | |
| 3188 | Find Top Scoring Students II | MySQL | O(nlogn) | O(n) | Hard | 🔒 | |
| 3198 | Find Cities in Each State | MySQL | O(nlogn) | O(n) | Easy | 🔒 | |
| 3204 | Bitwise User Permissions Analysis | MySQL | O(n) | O(n) | Medium | 🔒 | |
| 3214 | Year on Year Growth Rate | MySQL | O(nlogn) | O(n) | Hard | 🔒 | Window Function |
| 3220 | Odd and Even Transactions | MySQL | O(nlogn) | O(n) | Medium | ||
| 3230 | Customer Purchasing Behavior Analysis | MySQL | O(nlogn) | O(n) | Medium | 🔒 | Window Function |
| 3236 | CEO Subordinate Hierarchy | MySQL | O(nlogn) | O(n) | Hard | 🔒 | Recursive CTE, BFS |
| 3246 | Premier League Table Ranking | MySQL | O(nlogn) | O(n) | Easy | 🔒 | Window Function |
| 3252 | Premier League Table Ranking II | MySQL | O(nlogn) | O(n) | Medium | 🔒 | Window Function |
| 3262 | Find Overlapping Shifts | MySQL | O(nlogn) | O(n) | Medium | 🔒 | Line Sweep |
| 3268 | Find Overlapping Shifts II | MySQL | O(n^2) | O(n^2) | Hard | 🔒 | Line Sweep, Window Function, Combinatorics |
| 3278 | Find Candidates for Data Scientist Position II | MySQL | O(p * s * n + p * nlogn + plogp) | O(p * s * n) | Medium | 🔒 | Window Function |
| 3293 | Calculate Product Final Price | MySQL | O(nlogn) | O(n) | Medium | 🔒 | |
| 3308 | Find Top Performing Driver | MySQL | O(tlogt) | O(t) | Medium | 🔒 | Window Function |
| 3322 | Premier League Table Ranking III | MySQL | O(nlogn) | O(n) | Medium | 🔒 | Window Function |
| 3328 | Find Cities in Each State II | MySQL | O(nlogn) | O(n) | Medium | 🔒 | |
| 3338 | Second Highest Salary II | MySQL | O(nlogn) | O(n) | Medium | 🔒 | Window Function |
| 3358 | Books with NULL Ratings | MySQL | O(nlogn) | O(n) | Easy | 🔒 | |
| 3368 | First Letter Capitalization | MySQL | O(n * l^2 + (n * l) * log(n * l)) | O(n * l^2) | Hard | 🔒 | Recursive CTE |
| 3374 | First Letter Capitalization II | MySQL | O(n * l^2 + (n * l) * log(n * l)) | O(n * l^2) | Hard | 🔒 | Recursive CTE |
| 3384 | Team Dominance by Pass Success | MySQL | O(plogp + t) | O(p + t) | Hard | 🔒 | |
| 3390 | Longest Team Pass Streak | MySQL | O(plogp + t) | O(p + t) | Hard | 🔒 | Recursive CTE, Window Function |
| 3401 | Find Circular Gift Exchange Chains | MySQL | O(n^2) | O(n^2) | Hard | 🔒 | Recursive CTE, Window Function |
| 3415 | Find Products with Three Consecutive Digits | MySQL | O(nlogn) | O(n) | Easy | 🔒 | Regular Expression |
| 3421 | Find Students Who Improved | MySQL | O(nlogn) | O(n) | Medium | 🔒 | Window Function |
| 3436 | Find Valid Emails | MySQL | O(n) | O(n) | Easy | Regular Expression | |
| 3451 | Find Invalid IP Addresses | MySQL | O(nlogn) | O(n) | Hard | Regular Expression | |
| 3465 | Find Products with Valid Serial Numbers | MySQL | O(nlogn) | O(n) | Easy | Regular Expression | |
| 3475 | DNA Pattern Recognition | MySQL | O(nlogn) | O(n) | Medium | Regular Expression | |
| 3482 | Analyze Organization Hierarchy | MySQL | O(n^2) | O(n^2) | Hard | Recursive CTE, BFS | |
| 3497 | Analyze Subscription Conversion | MySQL | O(nlogn) | O(n) | Medium | ||
| 3521 | Find Product Recommendation Pairs | MySQL | O(n^2 * logn) | O(n^2) | Medium | ||
| 3554 | Find Category Recommendation Pairs | MySQL | O(n^2 * logn) | O(n^2) | Hard | ||
| 3564 | Seasonal Sales Analysis | MySQL | O(nlogn) | O(n) | Medium | Window Function | |
| 3570 | Find Books with No Available Copies | MySQL | O(nlogn) | O(n) | Easy | ||
| 3580 | Find Consistently Improving Employees | MySQL | O(nlogn) | O(n) | Medium | Window Function | |
| 3586 | Find COVID Recovery Patients | MySQL | O(n^2) | O(n^2) | Medium | ||
| 3601 | Find Drivers with Improved Fuel Efficiency | MySQL | O(nlogn) | O(n) | Medium | ||
| 3611 | Find Overbooked Employees | MySQL | O(m + nlogn) | O(m + n) | Medium | ||
| 3617 | Find Students with Study Spiral Pattern | MySQL | O(nlogn) | O(n) | Hard | Window Function | |
| 3626 | Find Stores with Inventory Imbalance | MySQL | O(n^2 * logn) | O(n^2) | Medium | ||
| 3642 | Find Books with Polarized Opinions | MySQL | O(r + nlogn) | O(r + n) | Easy | ||
| 3657 | Find Loyal Customers | MySQL | O(nlogn) | O(n) | Medium | ||
| 3673 | Find Zombie Sessions | MySQL | O(nlogn) | O(n) | Hard | ||
| 3705 | Find Golden Hour Customers | MySQL | O(nlogn) | O(n) | Medium | ||
| 3716 | Find Churn Risk Customers | MySQL | O(nlogn) | O(n) | Medium | Window Function | |
| 3764 | Most Common Course Pairs | MySQL | O(nlogn) | O(n) | Hard | Window Function | |
| 3793 | Find Users with High Token Usage | MySQL | O(nlogn) | O(n) | Easy | ||
| 3808 | Find Emotionally Consistent Users | MySQL | O(nlogn) | O(n) | Medium | Window Function | |
| 3832 | Find Users with Persistent Behavior Patterns | MySQL | O(nlogn) | O(n) | Hard | Window Function |
PD
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|
Repo liên quan
CS-Notes is a GitHub repository maintained by CyC2018 that collects Chinese-language study notes across ten topic areas: algorithms, operating systems, networking, object-oriented design, databases, Java, system design, tools, coding practice, and an afterword. It links each topic to standalone markdown files instead of writing everything inline, and the README says most of the content is original work rather than material copied from elsewhere.
The Algorithms - Python is an open-source collection of algorithm implementations written in Python, maintained by the TheAlgorithms organization on GitHub. The README frames the whole project as a teaching resource: the code exists to illustrate concepts, can run slower than Python's built-in equivalents, and is indexed in DIRECTORY.md for browsing. It's MIT licensed and available on GitHub.
The Algorithms - Java is a community-maintained GitHub repository collecting Java implementations of sorting algorithms, search algorithms, and core data structures, organized for study rather than production use.
Awesome Python is a curated list maintained at vinta/awesome-python that groups Python frameworks, libraries, tools, and other resources into 14 categories, from AI & ML to Security and Other. The README calls it an opinionated guide rather than an exhaustive one, and points readers to a companion site, awesome-python.com, for searching and filtering entries instead of scrolling the raw file.
Trả lời nhanh
Đọc thêm về kamyu104/LeetCode-Solutions ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/kamyu104/LeetCode-Solutions là nguồn chính thức.
kamyu104/LeetCode-Solutions có những chủ đề gì?
GitHub topics của kamyu104/LeetCode-Solutions: "algorithm", "algorithms", "cpp", "cpp11", "data-structure", "interview-practice", "interview-preparation", "interview-questions", "leetcode", "leetcode-cpp", "leetcode-python", "leetcode-solutions", "modern-cpp", "python". TopGit xếp repo vào nhóm Backend.
kamyu104/LeetCode-Solutions có phải mã nguồn mở không?
Có — kamyu104/LeetCode-Solutions phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/kamyu104/LeetCode-Solutions.
kamyu104/LeetCode-Solutions có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho kamyu104/LeetCode-Solutions. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
kamyu104/LeetCode-Solutions còn đang phát triển không?
Commit gần nhất trên kamyu104/LeetCode-Solutions là 3 tháng trước (theo timestamp GitHub). Repo có 1.8k fork — một chỉ báo về mức độ quan tâm của cộng đồng.
kamyu104/LeetCode-Solutions dùng license gì?
kamyu104/LeetCode-Solutions phát hành theo license MIT. Nên mở file LICENSE trên GitHub để xác nhận — license metadata đôi khi lệch với thực tế dự án.
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về LeetCode-Solutions?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về LeetCode-Solutions.