title: Tiling With Dominoes
signature: tiling_with_dominoes <- function(n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          29L, 
          0L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          13L, 
          0L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          25L, 
          0L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          65L, 
          0L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          27L, 
          0L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          42L, 
          808717138331L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          19L, 
          0L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          50L, 
          156886956080403L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          59L, 
          0L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          13L, 
          0L
      )))
  
  }
  
  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 ];
  }