FrontendInterviews.dev

Loading problem…

49. Progress Bar III - Bounded Parallelism

Medium•

This problem builds on progress-bar-ii. Complete that first, then load your solution to continue.

Build on Progress Bar II.

Now allow parallel animation with a cap:

  • up to 3 bars can animate at once,
  • extra bars wait,
  • when one active bar completes, the next waiting bar starts.

Constraints

  • Maximum 3 active bars
  • FIFO for waiting bars
  • Bars keep independent duration (2000ms each)
  • Support adding bars while animations are running