Distinct Moves

Problem Overview

  • Core task: In this coding interview problem, count subsequences of a move string that take you from x to y on a number line 0..n.
  • I/O: s with 'l'/'r' moves; integers n, x, y; return the number of valid subsequences modulo 1e9+7.
  • Constraints: 1<=|s|<=1e3; 0<=x,y,n<=2500.
  • Context: Discrete path counting for movement on a number line (navigation/domain modeling).
  • Source: Asked in Flexport interviews; a common interview question from Flexport.

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: