title: Count Strings Adjacent Characters Difference One
signature: def countStringsAdjacentCharactersDifferenceOne(n: Int) = {
test_code: import scala.collection.mutable.HashMap
  import scala.collection.immutable.HashSet
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  
  // TESTING CODE 
  // ============================================
  def validateSolution(actual: Long , expected: Long): Boolean = {
      actual.toString == expected.toString
  }
  
  def driver(n: Int, expected: Long): String = {
      try {
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)) {
              "PASSED"
          } else{
              "FAILED"
          }
      }catch{
          case e: Exception => {e.getClass.getName}
      }
  
  }
  object QuestionEvaluator extends App {
  
      println(s"TEST-0...${driver(
        7, 
        1468L    
      )}")   
  
  
      println(s"TEST-1...${driver(
        47, 
        1134264891541288L    
      )}")   
  
  
      println(s"TEST-2...${driver(
        56, 
        544505079089235836L    
      )}")   
  
  
      println(s"TEST-3...${driver(
        22, 
        41103600L    
      )}")   
  
  }
  
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;
  }