https://leetcode.com/problems/number-of-ways-to-stay-in-the-same-place-after-some-steps/


class Solution:

    def numWays(self, steps: int, arrLen: int) -> int:

        size = min(arrLen, steps)

        dp = [[0 for _ in range(size)] for _ in range(steps + 1)]

        dp[0][0] = 1

        for i in range(1, steps + 1):

            for j in range(size):

                dp[i][j] = dp[i-1][j]

                if j > 0:

                    dp[i][j] += dp[i-1][j-1]

                if j < size - 1:

                    dp[i][j] += dp[i-1][j+1]

                dp[i][j] %= 1000000007

        return dp[steps][0]


dp일 수밖에 없는 문제고, 그걸 파악하면 그렇게 어렵진 않음