title: Count Strings With Consecutive 1S
signature: count_strings_with_consecutive_1s <- 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(
          27L, 
          133703499L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          13L, 
          7582L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          33L, 
          8580707127L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          57L, 
          144114231353829831L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          51L, 
          2251746497394075L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          10L, 
          880L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          1L, 
          0L
      )))
  
  }
  
  main()
source_py: def count_strings_with_consecutive_1s(n):
      a = ([0] * n)
      b = ([0] * n)
      a[0] = b[0] = 1
      for i in range(1, n):
          a[i] = (a[(i - 1)] + b[(i - 1)])
          b[i] = a[(i - 1)]
      return (((1 << n) - a[(n - 1)]) - b[(n - 1)])
source_cpp: int count_strings_with_consecutive_1s(int n) {
    int a [ n ], b [ n ];
    a [ 0 ] = b [ 0 ] = 1;
    for ( int i = 1;
    i < n;
    i ++ ) {
      a [ i ] = a [ i - 1 ] + b [ i - 1 ];
      b [ i ] = a [ i - 1 ];
    }
    return ( 1 << n ) - a [ n - 1 ] - b [ n - 1 ];
  }