title: Maximum Height Of Triangular Arrangement Of Array Values 1
signature: def maximumHeightOfTriangularArrangementOfArrayValues1(a: List[Int], n: Int) = {
test_code: import scala.collection.mutable.HashMap
  import scala.collection.immutable.HashSet
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  
  // TESTING CODE 
  // ============================================
  def validateSolution(actual: Int , expected: Int): Boolean = {
      actual.toString == expected.toString
  }
  
  def driver(a: List[Int], n: Int, expected: Int): String = {
      try {
          if (validateSolution(PLACEHOLDER_FN_NAME(a, n),expected)) {
              "PASSED"
          } else{
              "FAILED"
          }
      }catch{
          case e: Exception => {e.getClass.getName}
      }
  
  }
  object QuestionEvaluator extends App {
  
      println(s"TEST-0...${driver(
        List(1, 2, 2, 3, 5, 6, 7, 8, 8, 12, 15, 16, 18, 18, 20, 21, 21, 22, 22, 24, 24, 25, 30, 35, 42, 49, 52, 55, 55, 63, 68, 70, 72, 73, 77, 80, 83, 87, 87, 88, 88, 94, 95, 97), 22, 
        6    
      )}")   
  
  
      println(s"TEST-1...${driver(
        List(48, -72, 84, -24, 28, 94, 36, 28, 32, 66, -62, 64, 6, -68, -12, 46, 4, 98, 18, 86, -60, 76, 14, 98), 12, 
        4    
      )}")   
  
  
      println(s"TEST-2...${driver(
        List(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), 25, 
        6    
      )}")   
  
  
      println(s"TEST-3...${driver(
        List(11, 16, 84, 8, 86, 44, 79, 11, 73, 12, 29, 62, 22, 44, 28, 8, 48, 92, 73, 63, 59, 44, 95, 66), 14, 
        4    
      )}")   
  
  
      println(s"TEST-4...${driver(
        List(-94, -94, -92, -88, -86, -82, -80, -80, -78, -76, -56, -56, -50, -44, -42, -36, -36, -32, -32, -26, -14, -12, -6, 12, 24, 28, 34, 38, 42, 42, 46, 50, 56, 62, 62, 74, 84, 92, 94), 19, 
        5    
      )}")   
  
  
      println(s"TEST-5...${driver(
        List(0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0), 24, 
        6    
      )}")   
  
  
      println(s"TEST-6...${driver(
        List(2, 2, 3, 3, 3, 4, 5, 13, 16, 18, 21, 22, 27, 28, 32, 34, 36, 37, 41, 42, 43, 51, 52, 52, 54, 54, 61, 65, 67, 67, 68, 71, 75, 77, 77, 78, 80, 81, 81, 84, 86, 90, 90, 93, 93, 94, 99, 99), 31, 
        7    
      )}")   
  
  
      println(s"TEST-7...${driver(
        List(54, -86), 1, 
        1    
      )}")   
  
  
      println(s"TEST-8...${driver(
        List(0, 1), 1, 
        1    
      )}")   
  
  
      println(s"TEST-9...${driver(
        List(5, 54, 49, 80, 56, 62, 31, 49, 60, 19, 45, 94, 33, 46, 32), 8, 
        3    
      )}")   
  
  }
  
source_py: def maximum_height_of_triangular_arrangement_of_array_values_1(a, n):
      return (((- 1) + int(math.sqrt((1 + (8 * n))))) // 2)
source_cpp: int maximum_height_of_triangular_arrangement_of_array_values_1(vector<int> a, int n) {
    return floor ( ( - 1 + sqrt ( 1 + ( 8 * n ) ) ) / 2 );
  }