title: Number N Digit Stepping Numbers
signature: def number_n_digit_stepping_numbers(n):
source_py: def number_n_digit_stepping_numbers(n):
      dp = [[0 for x in range(10)] for y in range((n + 1))]
      if (n == 1):
          return 10
      for j in range(10):
          dp[1][j] = 1
      for i in range(2, (n + 1)):
          for j in range(10):
              if (j == 0):
                  dp[i][j] = dp[(i - 1)][(j + 1)]
              elif (j == 9):
                  dp[i][j] = dp[(i - 1)][(j - 1)]
              else:
                  dp[i][j] = (dp[(i - 1)][(j - 1)] + dp[(i - 1)][(j + 1)])
      sum = 0
      for j in range(1, 10):
          sum = (sum + dp[n][j])
      return sum
source_cpp: long long number_n_digit_stepping_numbers(int n) {
    int dp [ n + 1 ] [ 10 ];
    if ( n == 1 ) return 10;
    for ( int j = 0;
    j <= 9;
    j ++ ) dp [ 1 ] [ j ] = 1;
    for ( int i = 2;
    i <= n;
    i ++ ) {
      for ( int j = 0;
      j <= 9;
      j ++ ) {
        if ( j == 0 ) dp [ i ] [ j ] = dp [ i - 1 ] [ j + 1 ];
        else if ( j == 9 ) dp [ i ] [ j ] = dp [ i - 1 ] [ j - 1 ];
        else dp [ i ] [ j ] = dp [ i - 1 ] [ j - 1 ] + dp [ i - 1 ] [ j + 1 ];
      }
    }
    long long sum = 0;
    for ( int j = 1;
    j <= 9;
    j ++ ) sum += dp [ n ] [ j ];
    return sum;
  }
question_info.test_code: import array
  import bisect
  import collections
  import datetime
  import functools
  import heapq
  import itertools
  import math
  import queue
  import re
  import string
  import sys
  from typing import Any, Dict, List, Optional, Set
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  def validate_solution(actual, expected):
      return actual == expected
  
  def driver(n, expected):
      try:
          if validate_solution(PLACEHOLDER_FN_NAME(
              n),
              expected
          ):
              return "PASSED"
          return "FAILED"
      except Exception as exception_obj:
          return type(exception_obj).__name__
      
  if __name__ == "__main__":
      result = driver(18, 547810)
      print(f"TEST-0...{result}")
  
      result = driver(26, 100719775)
      print(f"TEST-1...{result}")
  
      result = driver(41, 1774846161206)
      print(f"TEST-2...{result}")
  
      result = driver(20, 2017126)
      print(f"TEST-3...{result}")
  
      result = driver(25, 52479500)
      print(f"TEST-4...{result}")
  
      result = driver(52, 2306507126768895)
      print(f"TEST-5...{result}")
  
      result = driver(13, 21053)
      print(f"TEST-6...{result}")
  
      sys.exit(0)
question_info.test_case_ids: ['0', '1', '2', '3', '4', '5', '6']
question_info.entry_fn_name: number_n_digit_stepping_numbers
question_info.test_list: [{"idx": 0, "outputs": 547810, "inputs": {"n": 18}}, {"idx": 1, "outputs": 100719775, "inputs": {"n": 26}}, {"idx": 2, "outputs": 1774846161206, "inputs": {"n": 41}}, {"idx": 3, "outputs": 2017126, "inputs": {"n": 20}}, {"idx": 4, "outputs": 52479500, "inputs": {"n": 25}}, {"idx": 5, "outputs": 2306507126768895, "inputs": {"n": 52}}, {"idx": 6, "outputs": 21053, "inputs": {"n": 13}}]
question_info.entry_cls_name: Solution