using System.Collections.Generic;
private static int FindPlatform(int[] arrArr, int[] depArr, int n)
List<int> arr = new List<int>(arrArr);
List<int> dep = new List<int>(depArr);
while ((depIndex < n) && (arrIndex < n))
if (arr[arrIndex] <= dep[depIndex])
Console.WriteLine("arr: " + arr[arrIndex] + " dep: " + dep[depIndex] + " -> adding plaform");
maxPlatforms = Math.Max(maxPlatforms, currPlatforms);
if (arrIndex < n) arrIndex++;
else if (arr[arrIndex] > dep[depIndex])
Console.WriteLine("arr: " + arr[arrIndex] + " dep: " + dep[depIndex] + " -> removing plaform");
if (depIndex < n) depIndex++;
public static void Main()
int[] arr = new int[] { 900, 940, 950, 1100, 1500, 1800 };
int[] dep = new int[] { 910, 1200, 1120, 1130, 1900, 2000 };
Console.WriteLine("Minimum Number of Platforms Required = " + FindPlatform(arr, dep, n));