Hashing

Build hashing skills from frequency counting to interview questions on value relationships, pair sums, prefix information and windows.

178 online
Overall Progress
PLUS – Videos, editorials, planner all in one place – Videos, editorials, personalised planner & TUFY all in one place to save your time.

Planly

Know more

Striver’s Hashing Sheet contains 23 coding questions. Three basic frequency exercises now sit alongside the retained 20-question selection: Highest Occurring Element, Second Highest Occurring Element, and Sum of Highest and Lowest Frequency. This gives frequency counting a clear place before anagrams, pair sums, prefix information and window-based applications.

Fast lookup alone does not make a solution correct. A set records whether a key exists, while a map can retain its count, position or another relationship. Keeping the wrong information can lose valid answers even when every lookup succeeds. Use the questions to compare these choices and explain why the stored state matches the output.

Topics covered in this practice sheet

The beginner exercises distinguish a stored value from its frequency and compare frequency totals under each question’s rules. Later tasks use maps or sets for value relationships, counts and earlier prefix information. A target count, the highest frequency and a count of qualifying ranges are different outputs; they do not use interchangeable stored information.

  • Highest and second-highest frequency, plus highest/lowest frequency totals.
  • Sets and maps for value relationships, anagrams and pair sums.
  • Prefix information and string windows in the interview practice groups.

Beginner lessons and prerequisites

The Basic Hashing lesson explains why repeated counting can be replaced with stored information. Before using this sheet, know arrays, strings, loops and equality comparisons. Understand what a key represents and whether its associated value is a frequency, an index or another piece of information.

Be comfortable with loops, array positions and basic map or set operations. Learn the difference between whether a key exists and how many times it occurs before prefix counting. A small fixed key range may fit a counter array, while large or sparse keys can suit a map. Some majority or ordering tasks also have specialized alternatives, so hashing is a useful approach to compare, not a compulsory final method.

  • Know what information a set discards compared with a frequency map.
  • Include the work of creating and hashing a long key or signature.
  • Distinguish hash-table lookup in DSA from unrelated cryptographic hashing goals.