String Transformation (Also for Infra Automation Intern)

Problem Overview

  • Count how many distinct sequences of suffix-to-front rotations transform string src into target in exactly k steps.
  • Input: src, target (lowercase), and integer k; output: number of ways modulo 1,000,000,007; lengths 2–1000, k up to 10^6.
  • Domain: NLP-style string transformation from Hackerland.
  • Task: implement getNumWays to compute the count for this problem.
  • A Snowflake interviews coding interview interview question focused on string matching and counting.

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: