Similar Text Substring Count (Fungible :)

Problem Overview

  • Count how many substrings of review are similar to keyword, meaning they can match after at most one swap of adjacent characters.
  • Input: lowercase strings keyword and review with 1 ≤ |keyword| ≤ |review| ≤ 50; Output: integer count; substrings are contiguous and distinct by start index.
  • Real-world: models Amazon review search tolerating typos by including near-miss words.
  • From Amazon interviews; a coding interview problem and a common interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: