title: Sum Of All Elements Up To Nth Row In A Pascals Triangle 1
signature: func sumOfAllElementsUpToNthRowInAPascalsTriangle1(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(53, 9007199254740991)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(3, 7)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(28, 268435455)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(44, 17592186044415)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(46, 70368744177663)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(3, 7)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(16, 65535)
      fmt.Printf("TEST-6...%s\n", result)
      
          
  }
source_py: def sum_of_all_elements_up_to_nth_row_in_a_pascals_triangle_1(n):
      sum = 0
      sum = (1 << n)
      return (sum - 1)
source_cpp: long long int sum_of_all_elements_up_to_nth_row_in_a_pascals_triangle_1(int n) {
    long long int sum = 0;
    sum = 1 << n;
    return ( sum - 1 );
  }