Company: Tower Research_22july
Difficulty: medium
Paths to a Goal Problem Description Picture a number line whose marked points run from 0 to n, and a recorded sequence of steps using only the characters 'r' (step right by 1) and 'l' (step left by 1). Given a starting point s and a target point y, work out how many distinct subsequences of that step sequence would carry a traveler from s to y. Give the answer modulo (10^9 + 7). Notes: A subsequence comes from deleting any number of characters (possibly none) from the original sequence while keeping the remaining characters in their original order. Two subsequences count as the same if they consist of the same characters in the same order, even when pulled from different positions in the original string; each distinct character sequence is counted once, e.g., within 'rrr' the subsequence 'rr' is counted a single time. From a point j, a step 'r' advances to point j + 1, and a step 'l' retreats to point j - 1. Example: Number line positions n: 0 to 6 Move sequence is: "rrr" Start positio