title: Tiling With Dominoes
signature: function tilingWithDominoes(n: number): number {
test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: number, expected: number): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(n: number, expected:number): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(29, 0);
    console.log(`TEST-0...${result}`);
  
    result = driver(13, 0);
    console.log(`TEST-1...${result}`);
  
    result = driver(25, 0);
    console.log(`TEST-2...${result}`);
  
    result = driver(65, 0);
    console.log(`TEST-3...${result}`);
  
    result = driver(27, 0);
    console.log(`TEST-4...${result}`);
  
    result = driver(42, 808717138331);
    console.log(`TEST-5...${result}`);
  
    result = driver(19, 0);
    console.log(`TEST-6...${result}`);
  
    result = driver(50, 156886956080403);
    console.log(`TEST-7...${result}`);
  
    result = driver(59, 0);
    console.log(`TEST-8...${result}`);
  
    result = driver(13, 0);
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
source_py: def tiling_with_dominoes(n):
      A = ([0] * (n + 1))
      B = ([0] * (n + 1))
      A[0] = 1
      A[1] = 0
      B[0] = 0
      B[1] = 1
      for i in range(2, (n + 1)):
          A[i] = (A[(i - 2)] + (2 * B[(i - 1)]))
          B[i] = (A[(i - 1)] + B[(i - 2)])
      return A[n]
source_cpp: int tiling_with_dominoes(int n) {
    int A [ n + 1 ], B [ n + 1 ];
    A [ 0 ] = 1, A [ 1 ] = 0, B [ 0 ] = 0, B [ 1 ] = 1;
    for ( int i = 2;
    i <= n;
    i ++ ) {
      A [ i ] = A [ i - 2 ] + 2 * B [ i - 1 ];
      B [ i ] = A [ i - 1 ] + B [ i - 2 ];
    }
    return A [ n ];
  }