title: Sum Of All Elements Up To Nth Row In A Pascals Triangle
signature: function sumOfAllElementsUpToNthRowInAPascalsTriangle(n: number): number {
test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: number, expected: number): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(n: number, expected:number): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(21, 2097151);
    console.log(`TEST-0...${result}`);
  
    result = driver(4, 15);
    console.log(`TEST-1...${result}`);
  
    result = driver(31, 2147483647);
    console.log(`TEST-2...${result}`);
  
    result = driver(38, 274877906943);
    console.log(`TEST-3...${result}`);
  
    result = driver(36, 68719476735);
    console.log(`TEST-4...${result}`);
  
    result = driver(32, 4294967295);
    console.log(`TEST-5...${result}`);
  
    result = driver(23, 8388607);
    console.log(`TEST-6...${result}`);
  
  };
  
  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;
  }