title: Tiling With Dominoes
signature: func tilingWithDominoes(n int) int64 {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int64, expected int64) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(n int, expected int64) string {
      if validateSolution(PLACEHOLDER_FN_NAME(n),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(29, 0)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(13, 0)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(25, 0)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(65, 0)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(27, 0)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(42, 808717138331)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(19, 0)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(50, 156886956080403)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(59, 0)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(13, 0)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
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 ];
  }