Skip to content

Instantly share code, notes, and snippets.

@bhavjot
Created May 11, 2022 15:58
Show Gist options
  • Save bhavjot/3d9e688607b2cd555937ca7a621e4a5f to your computer and use it in GitHub Desktop.
Save bhavjot/3d9e688607b2cd555937ca7a621e4a5f to your computer and use it in GitHub Desktop.
public int findPlatform(int[] arr, int[] dep,int n)
{
//code here
Array.Sort(arr);
Array.Sort(dep);
var noOfPlatforms = 0;
var i = 0;
var j = 0;
while (i<n){
if(arr[i]<=dep[j]){
noOfPlatforms++;
}
else{
j++;
}
i++;
}
return noOfPlatforms;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment