🕵️ SicherheitslückenHak5: Hackers Just Poisoned the Rust Supply Chain | Threat Wire(01.09.2026 um 14:00 Uhr)
🕵️ SicherheitslückenHak5: Hackers Found a Way Into Humanoid Robots | Threat Wire(04.09.2026 um 15:04 Uhr)
🔧 AI Nachrichten Bits und so #1021 (Passwort für Laufwerk)(31.08.2026 um 22:15 Uhr)
🔧 AI Nachrichten Bits und so #1022 (Wie Weißbier)(06.09.2026 um 20:39 Uhr)
🍏 iOS / Mac OSHue-App 6.0 ist da: das sind die Neuerungen(07.09.2026 um 17:21 Uhr)
🕵️ SicherheitslückenHak5: Hackers Just Poisoned the Rust Supply Chain | Threat Wire(01.09.2026 um 14:00 Uhr)
🕵️ SicherheitslückenHak5: Hackers Found a Way Into Humanoid Robots | Threat Wire(04.09.2026 um 15:04 Uhr)
🔧 AI Nachrichten Bits und so #1021 (Passwort für Laufwerk)(31.08.2026 um 22:15 Uhr)
🔧 AI Nachrichten Bits und so #1022 (Wie Weißbier)(06.09.2026 um 20:39 Uhr)
🍏 iOS / Mac OSHue-App 6.0 ist da: das sind die Neuerungen(07.09.2026 um 17:21 Uhr)

🔧 Programmierung 🕛 kürzlich 2 Min Lesezeit
0

Minimum number of platforms required

↗ Quelle (dev.to)
🗣️ Stimme:

Problem

TC: O(nlogn)




CODE
class Solution {
// Function to find the minimum number of platforms required at the
// railway station such that no train waits.
static int findPlatform(int arr[], int dep[]) {
//sort the trains on the basis of arrival time of each train
PriorityQueue<Schedule> q = new PriorityQueue<>((a,b)-> a.a-b.a);

for(int i =0;i<arr.length;i++){
q.add(new Schedule(arr[i],dep[i]));
}
//sort the trains on the basis of which train will leave first once they have
//been arrived (which is done on the basis of ascending order of depart time of the trains)
Queue<Integer> trackDepart = new PriorityQueue<>();
int noOfplatform = 1;// at min we will need 1 platform
while(!q.isEmpty()){
Schedule s = q.remove();// train arrived
if(!trackDepart.isEmpty()){
if(trackDepart.peek() < s.a){ // if the arrival time of the train is greater than the
//train that will depart first then new train can arrive on the same platfrom (no increment in the platfrom no.)
trackDepart.remove(); // old train will go
}
else{
noOfplatform++;// else new train will need to come in a different platform
}
}
trackDepart.add(s.d);// add the depat time of the new train the queue to check for the next train if that can arrive on the same of new platform will be needed
}
return noOfplatform;
}
}
class Schedule{
public int a;
public int d;
public Schedule(int a, int d){
this.a = a;
this.d= d;
}
}


Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
Hackers Just Poisoned the Rust Supply Chain | Threat Wire
1 Quelle
Hackers Found a Way Into Humanoid Robots | Threat Wire
1 Quelle
Bits und so #1021 (Passwort für Laufwerk)
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Minimum number of platforms required

Thematisch verwandte Begriffe: Minimum, number, platforms, required · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...