title: Find The Maximum Element In An Array Which Is First Increasing And Then Decreasing
signature: fun findTheMaximumElementInAnArrayWhichIsFirstIncreasingAndThenDecreasing(arr: ArrayList<Int>, low: Int, high: Int): Int {
source_py: def find_the_maximum_element_in_an_array_which_is_first_increasing_and_then_decreasing(arr, low, high):
      max = arr[low]
      i = low
      for i in range((high + 1)):
          if (arr[i] > max):
              max = arr[i]
      return max
source_cpp: int find_the_maximum_element_in_an_array_which_is_first_increasing_and_then_decreasing(vector<int> arr, int low, int high) {
    int max = arr [ low ];
    int i;
    for ( i = low + 1;
    i <= high;
    i ++ ) {
      if ( arr [ i ] > max ) max = arr [ i ];
      else break;
    }
    return max;
  }
question_info.test_list: [{"idx": 0, "outputs": 94, "inputs": {"arr": [11, 15, 16, 19, 24, 25, 26, 28, 34, 34, 43, 61, 63, 66, 67, 72, 77, 79, 81, 83, 87, 94, 99], "low": 15, "high": 21}}, {"idx": 1, "outputs": 92, "inputs": {"arr": [8, 92], "low": 1, "high": 1}}, {"idx": 2, "outputs": 1, "inputs": {"arr": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "low": 23, "high": 15}}, {"idx": 3, "outputs": 92, "inputs": {"arr": [84, 39, 92, 89, 38, 75, 18, 39, 83, 67, 41, 46, 49, 27], "low": 8, "high": 13}}, {"idx": 4, "outputs": 86, "inputs": {"arr": [-98, -94, -88, -84, -74, -72, -58, -52, -48, -48, -46, -42, -42, -32, -30, -30, -18, -10, -8, -8, -6, -4, 4, 6, 28, 30, 34, 38, 44, 48, 56, 58, 60, 64, 86], "low": 31, "high": 34}}, {"idx": 5, "outputs": 1, "inputs": {"arr": [0, 1, 0], "low": 2, "high": 2}}, {"idx": 6, "outputs": 97, "inputs": {"arr": [5, 9, 10, 16, 18, 19, 23, 24, 26, 33, 37, 44, 46, 54, 55, 57, 58, 59, 63, 64, 70, 75, 77, 81, 83, 84, 85, 85, 88, 89, 96, 97, 99], "low": 20, "high": 31}}, {"idx": 7, "outputs": 86, "inputs": {"arr": [86, 20, -50, 74, -78, 86], "low": 3, "high": 5}}, {"idx": 8, "outputs": 1, "inputs": {"arr": [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], "low": 19, "high": 18}}, {"idx": 9, "outputs": 99, "inputs": {"arr": [16, 57, 65, 61, 17, 63, 7, 35, 69, 91, 30, 44, 99, 80, 6, 80, 56, 8, 84, 95, 20, 73, 30, 62, 77, 26, 66, 61, 61, 45], "low": 28, "high": 22}}]
question_info.extension: kts
question_info.test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Int, expected:Int):Boolean{
    return actual.equals(expected)
  }
  fun driver(arr: ArrayList<Int>, low: Int, high: Int, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(arr, low, high), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(arrayListOf(11, 15, 16, 19, 24, 25, 26, 28, 34, 34, 43, 61, 63, 66, 67, 72, 77, 79, 81, 83, 87, 94, 99), 15, 21, 94)
      println("TEST-0...${result}")
      
      result = driver(arrayListOf(8, 92), 1, 1, 92)
      println("TEST-1...${result}")
      
      result = driver(arrayListOf(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), 23, 15, 1)
      println("TEST-2...${result}")
      
      result = driver(arrayListOf(84, 39, 92, 89, 38, 75, 18, 39, 83, 67, 41, 46, 49, 27), 8, 13, 92)
      println("TEST-3...${result}")
      
      result = driver(arrayListOf(-98, -94, -88, -84, -74, -72, -58, -52, -48, -48, -46, -42, -42, -32, -30, -30, -18, -10, -8, -8, -6, -4, 4, 6, 28, 30, 34, 38, 44, 48, 56, 58, 60, 64, 86), 31, 34, 86)
      println("TEST-4...${result}")
      
      result = driver(arrayListOf(0, 1, 0), 2, 2, 1)
      println("TEST-5...${result}")
      
      result = driver(arrayListOf(5, 9, 10, 16, 18, 19, 23, 24, 26, 33, 37, 44, 46, 54, 55, 57, 58, 59, 63, 64, 70, 75, 77, 81, 83, 84, 85, 85, 88, 89, 96, 97, 99), 20, 31, 97)
      println("TEST-6...${result}")
      
      result = driver(arrayListOf(86, 20, -50, 74, -78, 86), 3, 5, 86)
      println("TEST-7...${result}")
      
      result = driver(arrayListOf(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), 19, 18, 1)
      println("TEST-8...${result}")
      
      result = driver(arrayListOf(16, 57, 65, 61, 17, 63, 7, 35, 69, 91, 30, 44, 99, 80, 6, 80, 56, 8, 84, 95, 20, 73, 30, 62, 77, 26, 66, 61, 61, 45), 28, 22, 99)
      println("TEST-9...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: findTheMaximumElementInAnArrayWhichIsFirstIncreasingAndThenDecreasing
question_info.entry_cls_name: Solution
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: kotlinc -script __FILENAME__ -no-reflect -nowarn