title: Sum Of All Elements Up To Nth Row In A Pascals Triangle
signature: sum_of_all_elements_up_to_nth_row_in_a_pascals_triangle <- 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(
          21L, 
          2097151L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          4L, 
          15L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          31L, 
          2147483647L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          38L, 
          274877906943L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          36L, 
          68719476735L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          32L, 
          4294967295L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          23L, 
          8388607L
      )))
  
  }
  
  main()
source_py: def sum_of_all_elements_up_to_nth_row_in_a_pascals_triangle(n):
      sum = 0
      for row in range(n):
          sum = (sum + (1 << row))
      return sum
source_cpp: long long int sum_of_all_elements_up_to_nth_row_in_a_pascals_triangle(int n) {
    long long int sum = 0;
    for ( int row = 0;
    row < n;
    row ++ ) {
      sum = sum + ( 1 << row );
    }
    return sum;
  }