Skip to content

Latest commit

 

History

History
70 lines (38 loc) · 5.67 KB

prefix-sum.md

File metadata and controls

70 lines (38 loc) · 5.67 KB

Prefix Sum LeetCode Problems

A collection of LeetCode problems solved using Prefix Sum pattern techniques, explanations, and complexity analysis.

Problems

Easy

# Problem Language Time Space Explanation
13 Roman to Integer Python O(n) O(n) Explanation

| 14 | Longest Common Prefix | Python | O(n) | O(n) | Explanation |

| 744 | Find Smallest Letter Greater Than Target | Python | O(n) | O(n) | Explanation |

| 1018 | Binary Prefix Divisible By 5 | Python | O(n) | O(n) | Explanation |

| 1365 | How Many Numbers Are Smaller Than the Current Number | TypeScript | O(n) | O(n) | Explanation |

| 1455 | Check If a Word Occurs As a Prefix of Any Word in a Sentence | Python | O(n) | O(n) | Explanation |

| 1961 | Check If String Is a Prefix of Array | C++ | O(n) | O(n) | Explanation |

| 2000 | Reverse Prefix of Word | JavaScript | O(n) | O(n) | Explanation |

| 2574 | Left and Right Sum Differences | Kotlin | O(n) | O(n) | Explanation |

| 2996 | Smallest Missing Integer Greater Than Sequential Prefix Sum | Rust | O(n) | O(n) | Explanation |

| 3042 | Count Prefix and Suffix Pairs I | Python | O(n) | O(n) | Explanation |

| 3471 | Find the Largest Almost Missing Integer | Kotlin | O(n) | O(n) | Explanation |

| 3550 | Smallest Index With Digit Sum Equal to Index | JavaScript | O(n) | O(n) | Explanation |

| 3718 | Smallest Missing Multiple of K | C# | O(n) | O(n) | Explanation |

Medium

# Problem Language Time Space Explanation
1291 Sequential Digits C++ O(n) O(n) Explanation

| 1621 | Number of Sets of K Non-Overlapping Line Segments | JavaScript | O(n) | O(n) | Explanation |

| 1871 | Jump Game VII | C++ | O(n) | O(n) | Explanation |

| 2424 | Longest Uploaded Prefix | JavaScript | O(n) | O(n) | Explanation |

| 2657 | Find the Prefix Common Array of Two Arrays | C++ | O(n) | O(n) | Explanation |

| 3043 | Find the Length of the Longest Common Prefix | C++ | O(n) | O(n) | Explanation |

Hard

# Problem Language Time Space Explanation
1392 Longest Happy Prefix Python O(n) O(n) Explanation

| 1563 | Stone Game V | Java | O(n) | O(n) | Explanation |

| 1872 | Stone Game VIII | Java | O(n) | O(n) | Explanation |

| 2416 | Sum of Prefix Scores of Strings | Python | O(n) | O(n) | Explanation |

| 3045 | Count Prefix and Suffix Pairs II | Python | O(n) | O(n) | Explanation |

| 3485 | Longest Common Prefix of K Strings After Removal | Python | O(n) | O(n) | Explanation |