title: Number Triangles N Moves
signature: class Solution {
  
      public Long numberTrianglesNMoves(Integer n) {
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.extension: java
question_info.entry_fn_name: numberTrianglesNMoves
question_info.entry_cls_name: Solution
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.test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer n, Long expected){
          try{
              Driver driver = new Driver();
              if (driver.run(n,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(33, 11118121133111045L);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(8, 13121L);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(6, 1457L);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer n, Long expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(n),expected);
      }
      
      public boolean validateSolution(Long actual, Long expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
question_info.test_case_ids: 0 1 2
question_info.commands: java __FILENAME__