title: Maximum Height Of Triangular Arrangement Of Array Values
signature: function maximumHeightOfTriangularArrangementOfArrayValues(a, n) {
test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value) {
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual, expected){
      return convertToString(actual)===convertToString(expected);
  }
  
  function driver(a, n, expected){
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(a, n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver([8, 10, 11, 14, 14, 17, 20, 20, 22, 22, 22, 23, 25, 30, 33, 39, 39, 41, 43, 45, 46, 46, 46, 50, 51, 53, 57, 59, 60, 64, 64, 66, 72, 72, 75, 77, 85, 85, 87, 88, 90, 91, 93, 94, 94, 95], 38, 8);
    console.log(`TEST-0...${result}`);
  
    result = driver([-44, -90, 20, 4, -56, -50, -80, 74, -82, 20, 62, -26, -10, -14, -76, 82, -88, 92, 30, 44, -62, -86, -20, -96, -60, -88, -78, -40, -48, -92, 62, 58, 94, 68, 68, 44, 80, 4, 48, -92, 30, -76, -46, -20, 4], 36, 7);
    console.log(`TEST-1...${result}`);
  
    result = driver([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], 28, 6);
    console.log(`TEST-2...${result}`);
  
    result = driver([8, 34, 48, 10, 5, 12, 80, 7, 67, 1, 79, 59, 63, 13, 16, 23, 62, 56, 99, 89, 7, 80], 12, 4);
    console.log(`TEST-3...${result}`);
  
    result = driver([-88, -46, -40, -40, 38], 3, 1);
    console.log(`TEST-4...${result}`);
  
    result = driver([1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1], 44, 8);
    console.log(`TEST-5...${result}`);
  
    result = driver([8, 15, 35, 39, 49, 81, 86, 91], 7, 3);
    console.log(`TEST-6...${result}`);
  
    result = driver([-24, 56, -74, -76, -80, 86, 90, 0, -26, 18, 72, 78, -66, -28, 22, 22, 72, 78, -50, -12, 20, 12, -68, -2, -58, -44, 28, -58, 90, -28, 32, -70, -48, -66, -94, -50, 18, -12, 80, 12, 82, 56, -64, 10, -22], 36, 7);
    console.log(`TEST-7...${result}`);
  
    result = driver([0, 0], 1, 1);
    console.log(`TEST-8...${result}`);
  
    result = driver([62, 93, 69, 40, 26, 2, 29, 83, 66, 68, 67, 73, 12, 65, 89, 57, 38, 99, 42, 27, 38, 24, 43, 4, 4, 54, 72, 47, 52, 46, 53, 24, 3, 41, 64, 33, 88, 3, 1, 7, 17, 31, 20, 33, 69, 21, 9, 24, 59], 26, 6);
    console.log(`TEST-9...${result}`);
  
    process.exit(0);
  };
  
  if (require.main === module) {
    main();
  }
source_py: def maximum_height_of_triangular_arrangement_of_array_values(a, n):
      result = 1
      for i in range(1, n):
          y = ((i * (i + 1)) / 2)
          if (y < n):
              result = i
          else:
              break
      return result
source_cpp: int maximum_height_of_triangular_arrangement_of_array_values(vector<int> a, int n) {
    int result = 1;
    for ( int i = 1;
    i <= n;
    ++ i ) {
      long long y = ( i * ( i + 1 ) ) / 2;
      if ( y < n ) result = i;
      else break;
    }
    return result;
  }