title: Maximum Height Of Triangular Arrangement Of Array Values
signature: maximum_height_of_triangular_arrangement_of_array_values <- function(a, n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(a, n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(a, n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(8L, 10L, 11L, 14L, 14L, 17L, 20L, 20L, 22L, 22L, 22L, 23L, 25L, 30L, 33L, 39L, 39L, 41L, 43L, 45L, 46L, 46L, 46L, 50L, 51L, 53L, 57L, 59L, 60L, 64L, 64L, 66L, 72L, 72L, 75L, 77L, 85L, 85L, 87L, 88L, 90L, 91L, 93L, 94L, 94L, 95L), 38L, 
          8L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(-44L, -90L, 20L, 4L, -56L, -50L, -80L, 74L, -82L, 20L, 62L, -26L, -10L, -14L, -76L, 82L, -88L, 92L, 30L, 44L, -62L, -86L, -20L, -96L, -60L, -88L, -78L, -40L, -48L, -92L, 62L, 58L, 94L, 68L, 68L, 44L, 80L, 4L, 48L, -92L, 30L, -76L, -46L, -20L, 4L), 36L, 
          7L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 28L, 
          6L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(8L, 34L, 48L, 10L, 5L, 12L, 80L, 7L, 67L, 1L, 79L, 59L, 63L, 13L, 16L, 23L, 62L, 56L, 99L, 89L, 7L, 80L), 12L, 
          4L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-88L, -46L, -40L, -40L, 38L), 3L, 
          1L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(1L, 0L, 0L, 1L, 0L, 1L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 1L, 0L, 1L, 1L, 1L, 0L, 1L, 1L, 1L), 44L, 
          8L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(8L, 15L, 35L, 39L, 49L, 81L, 86L, 91L), 7L, 
          3L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(-24L, 56L, -74L, -76L, -80L, 86L, 90L, 0L, -26L, 18L, 72L, 78L, -66L, -28L, 22L, 22L, 72L, 78L, -50L, -12L, 20L, 12L, -68L, -2L, -58L, -44L, 28L, -58L, 90L, -28L, 32L, -70L, -48L, -66L, -94L, -50L, 18L, -12L, 80L, 12L, 82L, 56L, -64L, 10L, -22L), 36L, 
          7L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(0L, 0L), 1L, 
          1L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(62L, 93L, 69L, 40L, 26L, 2L, 29L, 83L, 66L, 68L, 67L, 73L, 12L, 65L, 89L, 57L, 38L, 99L, 42L, 27L, 38L, 24L, 43L, 4L, 4L, 54L, 72L, 47L, 52L, 46L, 53L, 24L, 3L, 41L, 64L, 33L, 88L, 3L, 1L, 7L, 17L, 31L, 20L, 33L, 69L, 21L, 9L, 24L, 59L), 26L, 
          6L
      )))
  
  }
  
  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;
  }