TikTok Balanced Clips

Problem Overview

  • Compute the number of smooth lowercase clips of length clipLength where adjacent letters differ by at most diff.
  • Input: clipLength (2–1e5) and diff (1–25); Output: total count modulo 1e9+7.
  • Real-world context: TikTok clip generation with constraints on neighboring character differences.
  • From TikTok interviews; a coding interview question and counting problem.

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: