Available question text
Count the number of length-k sequences of ±1 moves on an infinite number line that take you from startPos to endPos — equivalently, choose how many right vs left steps produce the required net displacement. Return the count modulo 10^9+7 (zero if |endPos−startPos|>k or parity mismatches); typical solutions use combinatorics (binomial coefficients) or DP since k ≤ 1000.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 2400. Number of Ways to Reach a Position After Exactly k Steps
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source