title: Number Triangles N Moves
signature: numberTrianglesNMoves(n) {
test_code: import 'dart:convert';
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(int actual, int expected){
      return actual.toString() == expected.toString();
  }
  
  String driver(n, int expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(n), expected)){
              return "PASSED";
          }
          return "FAILED";
      }catch(exception_object){
          return exception_object.runtimeType.toString();
      }
  }
  
  int main() {
  
      print("TEST-0...${driver(
          33, 
          11118121133111045)
      }");
  
      print("TEST-1...${driver(
          8, 
          13121)
      }");
  
      print("TEST-2...${driver(
          6, 
          1457)
      }");
  
      return 0;
  }
source_py: def number_triangles_n_moves(n):
      answer = ([None] * (n + 1))
      answer[0] = 1
      i = 1
      while (i <= n):
          answer[i] = ((answer[(i - 1)] * 3) + 2)
          i = (i + 1)
      return answer[n]
source_cpp: int number_triangles_n_moves(int n) {
    int answer [ n + 1 ] = {
      0 };
      answer [ 0 ] = 1;
      for ( int i = 1;
      i <= n;
      i ++ ) answer [ i ] = answer [ i - 1 ] * 3 + 2;
      return answer [ n ];
    }