title: Number Triangles N Moves
signature: fun numberTrianglesNMoves(n: Int): Long {
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 ];
    }
question_info.test_list: [{"idx": 0, "outputs": 11118121133111045, "inputs": {"n": 33}}, {"idx": 1, "outputs": 13121, "inputs": {"n": 8}}, {"idx": 2, "outputs": 1457, "inputs": {"n": 6}}]
question_info.extension: kts
question_info.test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Long, expected:Long):Boolean{
    return actual.equals(expected)
  }
  fun driver(n: Int, expected:Long):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(n), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(33, 11118121133111045)
      println("TEST-0...${result}")
      
      result = driver(8, 13121)
      println("TEST-1...${result}")
      
      result = driver(6, 1457)
      println("TEST-2...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: numberTrianglesNMoves
question_info.entry_cls_name: Solution
question_info.test_case_ids: 0 1 2
question_info.commands: kotlinc -script __FILENAME__ -no-reflect -nowarn