title: Minimum Number Platforms Required Railwaybus Station
signature: fun minimumNumberPlatformsRequiredRailwaybusStation(arr: ArrayList<Int>, dep: ArrayList<Int>, n: Int): Int {
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>, dep: ArrayList<Int>, n: Int, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(arr, dep, n), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(arrayListOf(8, 24, 28, 64, 75, 86, 93, 95), arrayListOf(19, 30, 41, 51, 62, 68, 85, 96), 6, 2)
      println("TEST-0...${result}")
      
      result = driver(arrayListOf(-94, -92, -86, -78, -68, -58, -54, -42, -30, -30, -28, -26, -18, -8, -6, -4, 0, 0, 2, 6, 8, 14, 16, 30, 34, 50, 58, 58, 66, 78, 84, 86, 94, 98), arrayListOf(-98, -90, -84, -76, -64, -62, -52, -48, -44, -34, -24, -22, -12, -10, -8, -4, 10, 10, 14, 16, 22, 28, 28, 34, 40, 46, 50, 50, 52, 64, 68, 78, 80, 96), 18, 2)
      println("TEST-1...${result}")
      
      result = driver(arrayListOf(0, 0, 0, 0, 0, 0, 1), arrayListOf(0, 0, 0, 0, 0, 1, 1), 6, 1)
      println("TEST-2...${result}")
      
      result = driver(arrayListOf(2, 4, 5, 5, 21, 35, 48, 50, 51, 59, 61, 64, 71, 76, 81, 95), arrayListOf(5, 8, 28, 31, 40, 40, 43, 47, 49, 50, 51, 67, 67, 84, 86, 90), 8, 3)
      println("TEST-3...${result}")
      
      result = driver(arrayListOf(-64, -52, 44, 52, 90), arrayListOf(-62, -16, 22, 26, 58), 3, 1)
      println("TEST-4...${result}")
      
      result = driver(arrayListOf(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), arrayListOf(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), 17, 1)
      println("TEST-5...${result}")
      
      result = driver(arrayListOf(2, 15, 25, 55, 72, 96, 98), arrayListOf(3, 6, 11, 19, 26, 37, 39), 6, 1)
      println("TEST-6...${result}")
      
      result = driver(arrayListOf(-98, -76, -72, -60, -58, -56, -56, -48, -40, -34, -34, -30, -24, -20, 4, 8, 30, 30, 40, 52, 74, 74, 76), arrayListOf(-98, -96, -82, -76, -76, -72, -66, -64, -50, -40, -28, -22, -20, -8, 6, 8, 14, 18, 34, 36, 52, 52, 56), 20, 2)
      println("TEST-7...${result}")
      
      result = driver(arrayListOf(0, 0, 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), arrayListOf(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), 22, 1)
      println("TEST-8...${result}")
      
      result = driver(arrayListOf(1, 20, 34, 37, 56, 72, 84, 87), arrayListOf(15, 29, 54, 62, 68, 70, 84, 96), 6, 2)
      println("TEST-9...${result}")
      
          
  }
  
  main()
source_py: def minimum_number_platforms_required_railwaybus_station(arr, dep, n):
      arr.sort()
      dep.sort()
      plat_needed = 1
      result = 1
      i = 1
      j = 0
      while ((i < n) and (j < n)):
          if (arr[i] < dep[j]):
              plat_needed += 1
              i += 1
              if (plat_needed > result):
                  result = plat_needed
          else:
              plat_needed -= 1
              j += 1
      return result
source_cpp: int minimum_number_platforms_required_railwaybus_station(vector<int> arr, vector<int> dep, int n) {
    sort(arr.begin(), arr.end());
    sort(dep.begin(), dep.end());
    int plat_needed = 1, result = 1;
    int i = 1, j = 0;
    while ( i < n && j < n ) {
      if ( arr [ i ] <= dep [ j ] ) {
        plat_needed ++;
        i ++;
        if ( plat_needed > result ) result = plat_needed;
      }
      else {
        plat_needed --;
        j ++;
      }
    }
    return result;
  }