title: Minimum Number Platforms Required Railwaybus Station
signature: minimum_number_platforms_required_railwaybus_station <- function(arr, dep, n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(arr, dep, n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(arr, dep, n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(8L, 24L, 28L, 64L, 75L, 86L, 93L, 95L), list(19L, 30L, 41L, 51L, 62L, 68L, 85L, 96L), 6L, 
          2L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(-94L, -92L, -86L, -78L, -68L, -58L, -54L, -42L, -30L, -30L, -28L, -26L, -18L, -8L, -6L, -4L, 0L, 0L, 2L, 6L, 8L, 14L, 16L, 30L, 34L, 50L, 58L, 58L, 66L, 78L, 84L, 86L, 94L, 98L), list(-98L, -90L, -84L, -76L, -64L, -62L, -52L, -48L, -44L, -34L, -24L, -22L, -12L, -10L, -8L, -4L, 10L, 10L, 14L, 16L, 22L, 28L, 28L, 34L, 40L, 46L, 50L, 50L, 52L, 64L, 68L, 78L, 80L, 96L), 18L, 
          2L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 1L), list(0L, 0L, 0L, 0L, 0L, 1L, 1L), 6L, 
          1L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(2L, 4L, 5L, 5L, 21L, 35L, 48L, 50L, 51L, 59L, 61L, 64L, 71L, 76L, 81L, 95L), list(5L, 8L, 28L, 31L, 40L, 40L, 43L, 47L, 49L, 50L, 51L, 67L, 67L, 84L, 86L, 90L), 8L, 
          3L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-64L, -52L, 44L, 52L, 90L), list(-62L, -16L, 22L, 26L, 58L), 3L, 
          1L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(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, 1L), list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 17L, 
          1L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(2L, 15L, 25L, 55L, 72L, 96L, 98L), list(3L, 6L, 11L, 19L, 26L, 37L, 39L), 6L, 
          1L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(-98L, -76L, -72L, -60L, -58L, -56L, -56L, -48L, -40L, -34L, -34L, -30L, -24L, -20L, 4L, 8L, 30L, 30L, 40L, 52L, 74L, 74L, 76L), list(-98L, -96L, -82L, -76L, -76L, -72L, -66L, -64L, -50L, -40L, -28L, -22L, -20L, -8L, 6L, 8L, 14L, 18L, 34L, 36L, 52L, 52L, 56L), 20L, 
          2L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 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), list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 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, 1L, 1L, 1L, 1L, 1L), 22L, 
          1L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(1L, 20L, 34L, 37L, 56L, 72L, 84L, 87L), list(15L, 29L, 54L, 62L, 68L, 70L, 84L, 96L), 6L, 
          2L
      )))
  
  }
  
  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;
  }