# Hash Function DSA Problems

> 38 Hash Function coding problems for placements and interviews, sorted easiest first, with hints and company tags. Free practice on InternHack.

Canonical: https://www.internhack.in/learn/dsa/hash-function
Last updated: 2026-11-28

38 hash function problems for coding interviews and campus placements, with hints and company tags. Below are all 38: 4 easy, 17 medium and 17 hard. Practise them free on InternHack and track what you have solved.

## Hash Function problems, easiest first

1. [Count Prefix and Suffix Pairs I](https://www.internhack.in/learn/dsa/problem/count-prefix-and-suffix-pairs-i) (Easy)
2. [Design HashMap](https://www.internhack.in/learn/dsa/problem/design-hashmap) (Easy)
3. [Design HashSet](https://www.internhack.in/learn/dsa/problem/design-hashset) (Easy)
4. [Subtree of Another Tree](https://www.internhack.in/learn/dsa/problem/subtree-of-another-tree) (Easy)
5. [Check If a String Contains All Binary Codes of Size K](https://www.internhack.in/learn/dsa/problem/check-if-a-string-contains-all-binary-codes-of-size-k) (Medium)
6. [Count Cells in Overlapping Horizontal and Vertical Substrings](https://www.internhack.in/learn/dsa/problem/count-cells-in-overlapping-horizontal-and-vertical-substrings) (Medium)
7. [Encode and Decode TinyURL](https://www.internhack.in/learn/dsa/problem/encode-and-decode-tinyurl) (Medium)
8. [Equalize Strings by Adding or Removing Characters at Ends](https://www.internhack.in/learn/dsa/problem/equalize-strings-by-adding-or-removing-characters-at-ends) (Medium)
9. [Find Beautiful Indices in the Given Array I](https://www.internhack.in/learn/dsa/problem/find-beautiful-indices-in-the-given-array-i) (Medium)
10. [Find Pattern in Infinite Stream I](https://www.internhack.in/learn/dsa/problem/find-pattern-in-infinite-stream-i) (Medium)
11. [K Divisible Elements Subarrays](https://www.internhack.in/learn/dsa/problem/k-divisible-elements-subarrays) (Medium)
12. [Longest Repeating Substring](https://www.internhack.in/learn/dsa/problem/longest-repeating-substring) (Medium)
13. [Maximum Length of Repeated Subarray](https://www.internhack.in/learn/dsa/problem/maximum-length-of-repeated-subarray) (Medium)
14. [Minimum Number of Valid Strings to Form Target I](https://www.internhack.in/learn/dsa/problem/minimum-number-of-valid-strings-to-form-target-i) (Medium)
15. [Minimum Time to Revert Word to Initial State I](https://www.internhack.in/learn/dsa/problem/minimum-time-to-revert-word-to-initial-state-i) (Medium)
16. [Number of Distinct Islands](https://www.internhack.in/learn/dsa/problem/number-of-distinct-islands) (Medium)
17. [Number of Distinct Substrings in a String](https://www.internhack.in/learn/dsa/problem/number-of-distinct-substrings-in-a-string) (Medium)
18. [Number of Subarrays That Match a Pattern I](https://www.internhack.in/learn/dsa/problem/number-of-subarrays-that-match-a-pattern-i) (Medium)
19. [Repeated DNA Sequences](https://www.internhack.in/learn/dsa/problem/repeated-dna-sequences) (Medium)
20. [Strings Differ by One Character](https://www.internhack.in/learn/dsa/problem/strings-differ-by-one-character) (Medium)
21. [Unique Substrings With Equal Digit Frequency](https://www.internhack.in/learn/dsa/problem/unique-substrings-with-equal-digit-frequency) (Medium)
22. [Check if DFS Strings Are Palindromes](https://www.internhack.in/learn/dsa/problem/check-if-dfs-strings-are-palindromes) (Hard)
23. [Count Prefix and Suffix Pairs II](https://www.internhack.in/learn/dsa/problem/count-prefix-and-suffix-pairs-ii) (Hard)
24. [Delete Duplicate Folders in System](https://www.internhack.in/learn/dsa/problem/delete-duplicate-folders-in-system) (Hard)
25. [Distinct Echo Substrings](https://www.internhack.in/learn/dsa/problem/distinct-echo-substrings) (Hard)
26. [Find Beautiful Indices in the Given Array II](https://www.internhack.in/learn/dsa/problem/find-beautiful-indices-in-the-given-array-ii) (Hard)
27. [Find Pattern in Infinite Stream II](https://www.internhack.in/learn/dsa/problem/find-pattern-in-infinite-stream-ii) (Hard)
28. [Find Substring With Given Hash Value](https://www.internhack.in/learn/dsa/problem/find-substring-with-given-hash-value) (Hard)
29. [Longest Chunked Palindrome Decomposition](https://www.internhack.in/learn/dsa/problem/longest-chunked-palindrome-decomposition) (Hard)
30. [Longest Common Subpath](https://www.internhack.in/learn/dsa/problem/longest-common-subpath) (Hard)
31. [Longest Duplicate Substring](https://www.internhack.in/learn/dsa/problem/longest-duplicate-substring) (Hard)
32. [Longest Happy Prefix](https://www.internhack.in/learn/dsa/problem/longest-happy-prefix) (Hard)
33. [Maximum Deletions on a String](https://www.internhack.in/learn/dsa/problem/maximum-deletions-on-a-string) (Hard)
34. [Minimum Time to Revert Word to Initial State II](https://www.internhack.in/learn/dsa/problem/minimum-time-to-revert-word-to-initial-state-ii) (Hard)
35. [Number of Distinct Islands II](https://www.internhack.in/learn/dsa/problem/number-of-distinct-islands-ii) (Hard)
36. [Number of Subarrays That Match a Pattern II](https://www.internhack.in/learn/dsa/problem/number-of-subarrays-that-match-a-pattern-ii) (Hard)
37. [Shortest Palindrome](https://www.internhack.in/learn/dsa/problem/shortest-palindrome) (Hard)
38. [Sum of Scores of Built Strings](https://www.internhack.in/learn/dsa/problem/sum-of-scores-of-built-strings) (Hard)

## Companies that ask hash function problems

- [Google](https://www.internhack.in/learn/dsa/companies/google): 23 of these problems
- [Amazon](https://www.internhack.in/learn/dsa/companies/amazon): 17 of these problems
- [Meta](https://www.internhack.in/learn/dsa/companies/meta): 13 of these problems
- [Bloomberg](https://www.internhack.in/learn/dsa/companies/bloomberg): 12 of these problems
- [Microsoft](https://www.internhack.in/learn/dsa/companies/microsoft): 11 of these problems
- [Uber](https://www.internhack.in/learn/dsa/companies/uber): 8 of these problems
- [Autodesk](https://www.internhack.in/learn/dsa/companies/autodesk): 4 of these problems
- [Tiktok](https://www.internhack.in/learn/dsa/companies/tiktok): 4 of these problems
- [Capital ONE](https://www.internhack.in/learn/dsa/companies/capital-one): 3 of these problems
- [Palantir Technologies](https://www.internhack.in/learn/dsa/companies/palantir-technologies): 3 of these problems
- [Coupang](https://www.internhack.in/learn/dsa/companies/coupang): 3 of these problems
- [Apple](https://www.internhack.in/learn/dsa/companies/apple): 2 of these problems

## Before your interview

Most resumes are filtered by software before a recruiter reads them. [Check your resume ATS score free](https://www.internhack.in/ats-score/try), no signup needed.

## Other DSA topics

- [Array](https://www.internhack.in/learn/dsa/array) (1869)
- [String](https://www.internhack.in/learn/dsa/string) (775)
- [Hash Table](https://www.internhack.in/learn/dsa/hash-table) (708)
- [Math](https://www.internhack.in/learn/dsa/math) (564)
- [Dynamic Programming](https://www.internhack.in/learn/dsa/dynamic-programming) (557)
- [Sorting](https://www.internhack.in/learn/dsa/sorting) (464)
- [Greedy](https://www.internhack.in/learn/dsa/greedy) (407)
- [Depth-First Search](https://www.internhack.in/learn/dsa/depth-first-search) (314)
- [Binary Search](https://www.internhack.in/learn/dsa/binary-search) (298)
- [Matrix](https://www.internhack.in/learn/dsa/matrix) (246)
- [Breadth-First Search](https://www.internhack.in/learn/dsa/breadth-first-search) (245)
- [Bit Manipulation](https://www.internhack.in/learn/dsa/bit-manipulation) (238)
- [Tree](https://www.internhack.in/learn/dsa/tree) (235)
- [Two Pointers](https://www.internhack.in/learn/dsa/two-pointers) (217)
- [Prefix Sum](https://www.internhack.in/learn/dsa/prefix-sum) (204)
- [Database](https://www.internhack.in/learn/dsa/database) (197)
- [Heap (Priority Queue)](https://www.internhack.in/learn/dsa/heap-priority-queue) (196)
- [Simulation](https://www.internhack.in/learn/dsa/simulation) (177)
- [Counting](https://www.internhack.in/learn/dsa/counting) (174)
- [Binary Tree](https://www.internhack.in/learn/dsa/binary-tree) (169)

## Related

- [Home](https://www.internhack.in/)
- [Learn](https://www.internhack.in/learn)
- [DSA](https://www.internhack.in/learn/dsa)
