Problem 1204 · Medium

Last Person to Fit in the Bus

SQL walkthrough: keep a running total of weights in boarding order and report the last person before the total would exceed the limit. The sample queue is invented for teaching.

Open the interactive visualisation