title: Number Triangles N Moves
signature: pub fn number_triangles_n_moves(n: i32) -> i64 {
test_code: use std::collections::HashMap;
  use std::collections::HashSet;
  use std::cmp::*;
  use std::collections::*;
  use std::fmt::*; 
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  pub fn validate_solution(actual: i64, expected: i64)->bool{
  return actual==expected
  }
  pub fn driver(n: i32, expected: i64)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(n), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        33, 
        11118121133111045
      ));
      
      println!("TEST-1...{}", driver(
        8, 
        13121
      ));
      
      println!("TEST-2...{}", driver(
        6, 
        1457
      ));
      
  }
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 ];
    }