title: Count Strings Adjacent Characters Difference One
signature: function count_strings_adjacent_characters_difference_one(n)
test_code: 
  
  -- SOLUTION CODE
  -- ============================================
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  function isCorrect(actual, expected)
      if type(expected) ~= type(actual) then
          return false
      end
      
      if type(expected) == 'table' then
          for k,v_expected in pairs(expected) do
              
              if actual[k] == nil then
                  return false
              end
              local v_actual = actual[k]
              if not isCorrect(v_actual, v_expected) then
                  return false
              end
              actual[k]=nil
          end
      
          if next(actual) then 
              return false
          end
          return true
      else
          return actual == expected
      end
  end
  
  function validateSolution(actual, expected)
      return isCorrect(actual,expected)
  end
  
  function driver(n, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(n) 
      end)
      if status then
          if validateSolution(exec_result,expected) then
              return "PASSED"
          end
          return "FAILED"
      else
          return string.format("ERROR=%s",string.gsub(error_msg,".*:[%d]+: ",""))
      end
  end
      
  function main()
      result = driver(7, 1468)
      print(string.format("TEST-0...%s",result))
  
      result = driver(47, 1134264891541288)
      print(string.format("TEST-1...%s",result))
  
      result = driver(56, 544505079089235836)
      print(string.format("TEST-2...%s",result))
  
      result = driver(22, 41103600)
      print(string.format("TEST-3...%s",result))
  
  end
  
  main()
source_py: def count_strings_adjacent_characters_difference_one(n):
      dp = [[0 for j in range(27)] for i in range((n + 1))]
      for i in range(0, 26):
          dp[1][i] = 1
      for i in range(2, (n + 1)):
          for j in range(0, 26):
              if (j == 0):
                  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 i in range(0, 26):
          sum = (sum + dp[n][i])
      return sum
source_cpp: int count_strings_adjacent_characters_difference_one(int n) {
    long int dp [ n + 1 ] [ 27 ];
    memset ( dp, 0, sizeof ( dp ) );
    for ( int i = 0;
    i <= 25;
    i ++ ) dp [ 1 ] [ i ] = 1;
    for ( int i = 2;
    i <= n;
    i ++ ) {
      for ( int j = 0;
      j <= 25;
      j ++ ) if ( j == 0 ) dp [ i ] [ j ] = dp [ i - 1 ] [ j + 1 ];
      else dp [ i ] [ j ] = ( dp [ i - 1 ] [ j - 1 ] + dp [ i - 1 ] [ j + 1 ] );
    }
    long int sum = 0;
    for ( int i = 0;
    i <= 25;
    i ++ ) sum = ( sum + dp [ n ] [ i ] );
    return sum;
  }