Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 1269. Number of Ways to Stay in the Same Place After Some Steps
Count the number of sequences of left/right/stay moves on a 1D array of length arrLen starting at index 0 that return to index 0 after exactly steps moves (answer modulo 1e9+7). This is a DP/counting problem over steps and positions — with steps ≤ 500 you can limit the positions considered to O(min(arrLen, steps)) to compute ways efficiently.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.