Block (Square) Interview Question – Typo-Squatting Detection System Design

21 Views
No Comments

Build a tool that, when given our domains and a list of other domains, alerts the user to all the possible typo-squats of our domains present in the list of other domains.

Potential kinds of typos:

  • One character is wrong (substitution)
  • Repeat characters (addition)
  • Forget a character at end (removed character)

Part 1

Detect typos where a single character from one of our domains has been changed into a different character.

Example:
Given "Square" as one of our domains, detect:

  • "Sware", "Smuare"
    but not "Share" or "Google".

Part 2

Update the tool to restrict the changed character to only be typos that are likely, given the keyboard layout.

Example:
Given "Square" → detect:

  • "Swaure"
    but not "Smuare"
    (assuming QWERTY keyboard: Q → W likely, Q → M not likely)

Part 3

Update the tool to detect typos where our domain had an additional character added or a character removed.

Example:
Given "Square", detect:

  • "Squares"
  • "Squbare"
  • "Suare"

Note:
Detect only one kind of typo at a time. Do not detect "Swares" or "Suate".


Part 1

Compare strings of equal length and detect candidates differing in exactly one position.

Part 2

Same as Part 1, but the replaced character must be among keyboard-adjacent characters (QWERTY adjacency map).

Part 3

Handle insertion/deletion typos by checking whether strings differ by one extra or missing character using a two-pointer“one-edit distance”check.

The VOprep team has long accompanied candidates through various major company OAs and VOs, including Google, Amazon, Block providing real-time voice assistance, remote practice, and interview pacing reminders to help you stay smooth during critical moments. If you are preparing for these companies, you can check out our customized support plans—from coding interviews to system design, we offer full guidance to help you succeed.

END
 0