As reported: Cisco Analyst (intern), campus technical round (2025): the second coding question — minimum number of platforms required for trains; brute force first, then an optimised two-pointer approach, with complexity analysis.
A station receives n trains in one day. Train i arrives at arr[i] and departs at dep[i]; times are 24-hour clock values written as integers HHMM (e.g. 950 is 9:50, 1130 is 11:30). Return the minimum number of platforms needed so that no train has to wait.
A platform is occupied from the arrival minute to the departure minute inclusive: a train arriving at the same minute another one departs needs a different platform.
Example 1
arr = [900, 940, 950, 1100, 1500, 1800]
dep = [910, 1200, 1120, 1130, 1900, 2000]
Output: 3
Between 11:00 and 11:20 the trains that arrived at 9:40, 9:50 and 11:00 are all at the station.
Example 2
arr = [1000, 1010]
dep = [1010, 1020]
Output: 2
The second train arrives the minute the first one leaves.
Constraints: 1 ≤ n ≤ 5·10^4; 0 ≤ arr[i] ≤ dep[i] ≤ 2359, all valid HHMM times of the same day.
Code runner format: one JSON value per line — arr, then dep. Implement findPlatform(arr, dep); the harness prints the number.