Zum Hauptinhalt springen
••
Sichere ProgrammierungCryptotremor: finding out when your encryption actually stops working(03.10.2026 um 08:10 Uhr)
•
Sichere ProgrammierungAI Viva Partner: A Private, Offline Exam Study Assistant for My Friend(03.10.2026 um 08:11 Uhr)
••
Windows Tipps & SecurityMintline: prove which Solana token came first(03.10.2026 um 08:15 Uhr)
•••
Sichere ProgrammierungI've never run an AI model on my own machine. This month I will.(03.10.2026 um 08:17 Uhr)
•
Sichere ProgrammierungI removed my Chinese web font. Every page lost 1 MB(03.10.2026 um 08:18 Uhr)
•••
Sichere ProgrammierungCryptotremor: finding out when your encryption actually stops working(03.10.2026 um 08:10 Uhr)
•
Sichere ProgrammierungAI Viva Partner: A Private, Offline Exam Study Assistant for My Friend(03.10.2026 um 08:11 Uhr)
••
Windows Tipps & SecurityMintline: prove which Solana token came first(03.10.2026 um 08:15 Uhr)
•••
Sichere ProgrammierungI've never run an AI model on my own machine. This month I will.(03.10.2026 um 08:17 Uhr)
•
Sichere ProgrammierungI removed my Chinese web font. Every page lost 1 MB(03.10.2026 um 08:18 Uhr)
•
Intelligence View
⚡ tsecurity.de Intelligence

Seeing Code in the Real World: The Bus Seating Problem 🚌

Working in software development, it is hard to turn off the logic center of the brain. Have you ever looked at a completely normal, everyday situation and…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!

Working in software development, it is hard to turn off the logic center of the brain. Have you ever looked at a completely normal, everyday situation and thought, "Wait, there's an algorithm for this"?



That happened to me recently on a simple bus ride.



I observed a family getting on the bus and trying to figure out their seating arrangement. Because of the way they sat, one child was left sitting alone. My brain immediately started crunching the numbers—mathematically, there was absolutely a way to seat them all safely!



I decided to turn this real-world observation into a custom coding problem. I call it The Bus Seating Problem.






📝 The Scenario & Rules



Imagine an empty bus with paired seats. A group boards consisting of n adults (parents) and m children.



To make this a solid algorithmic challenge, let's establish some strict baseline constraints:




  • Both n and m are greater than 1 (at least 2 adults and 2 children).

  • The children always outnumber the adults (m > n).



Here are the survival rules for seating:




  • Two children can sit together safely.

  • No two adults can sit together.

  • A child CANNOT sit alone. They must sit with another child or an adult.

  • Adults can sit with children.



The Objective: Given n and m, is it possible to seat everyone safely?



Solutions : https://github.com/buildwithsomnath/everyday-algorithms

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Seeing Code in the Real World: The Bus Seating Problem 🚌

Thematisch verwandte Begriffe: Seeing, Code, Real, World · 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 ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
Nächster Beitrag