You are given two positive integers startPos and endPos. Initially, you are positioned at startPos on an infinite number line. In each step, you can move either
Return the total number of distinct ways to reach position endPos after moving exactly k steps. Since the answer may be large, return it modulo
Note: Two ways are considered different if the sequence of chosen directions at each step is not identical.
Constraints:
startPos, endPos, k
You are given two positive integers startPos and endPos. Initially, you are positioned at startPos on an infinite number line. In each step, you can move either
Return the total number of distinct ways to reach position endPos after moving exactly k steps. Since the answer may be large, return it modulo
Note: Two ways are considered different if the sequence of chosen directions at each step is not identical.
Constraints:
startPos, endPos, k