Rolling Hash LeetCode Problems: All 18, With Python Solutions
Every problem in this library that LeetCode tags Rolling Hash — 18 in total, 13 of them with a complete Python solution, a worked example and the time and space complexity of the approach.
- 18 problems
- 0 Easy
- 8 Medium
- 10 Hard
Rolling Hash problems by difficulty
Problems with a complete Python solution are listed first, then by ascending problem number.
Medium (8)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 187 | Repeated DNA Sequences | Medium | Bit Manipulation, Hash Table, String +3 |
| 718 | Maximum Length of Repeated Subarray | Medium | Array, Binary Search, Dynamic Programming +3 |
| 1461 | Check If a String Contains All Binary Codes of Size K | Medium | Bit Manipulation, Hash Table, String +2 |
| 2261 | K Divisible Elements Subarrays | Medium | Trie, Array, Hash Table +3 |
| 1062 | Longest Repeating SubstringPremium | Medium | String, Binary Search, Dynamic Programming +3 |
| 1554 | Strings Differ by One CharacterPremium | Medium | Hash Table, String, Hash Function +1 |
| 1698 | Number of Distinct Substrings in a StringPremium | Medium | Trie, String, Suffix Array +2 |
| 2168 | Unique Substrings With Equal Digit FrequencyPremium | Medium | Hash Table, String, Counting +2 |
Hard (10)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 214 | Shortest Palindrome | Hard | String, String Matching, Hash Function +1 |
| 1044 | Longest Duplicate Substring | Hard | String, Binary Search, Suffix Array +3 |
| 1147 | Longest Chunked Palindrome Decomposition | Hard | Greedy, Two Pointers, String +3 |
| 1316 | Distinct Echo Substrings | Hard | Trie, String, Hash Function +1 |
| 1392 | Longest Happy Prefix | Hard | String, String Matching, Hash Function +1 |
| 1923 | Longest Common Subpath | Hard | Array, Binary Search, Suffix Array +2 |
| 1960 | Maximum Product of the Length of Two Palindromic Substrings | Hard | String, Hash Function, Rolling Hash |
| 2156 | Find Substring With Given Hash Value | Hard | String, Sliding Window, Hash Function +1 |
| 2430 | Maximum Deletions on a String | Hard | String, Dynamic Programming, String Matching +2 |
| 2223 | Sum of Scores of Built Strings | Hard | String, Binary Search, String Matching +3 |
Keep exploring
All LeetCode topicsEvery tag with a page of its own, with the number of problems behind each.LeetCode patternsThe techniques themselves, with a Python template and complexity for each.Curated study listsBlind 75, NeetCode 150 and three more, grouped by pattern.Easy problemsStart here when the data structure is new rather than the problem.
Other topics
- Array1,569
- String672
- Hash Table588
- Math485
- Dynamic Programming481
- Sorting392
- Greedy346
- Depth-First Search289
- Binary Search253
- Database249
- Tree225
- Breadth-First Search223
- Matrix216
- Two Pointers201
- Bit Manipulation194
- Binary Tree174
- Heap (Priority Queue)163
- Prefix Sum157
- Stack157
- Simulation144
- Graph138
- Counting126
- Design122
- Sliding Window116
When the Rolling Hash problem arrives live
Stealth Interview is a desktop app for macOS and Windows. It reads the coding problem off your screen, returns a working solution with a step-by-step explanation and its time and space complexity, and transcribes what the interviewer is saying — while staying invisible to screen sharing.