A loading screen runs several looping CSS animations at once. Their durations in milliseconds are in durations. They all start together at time 0.
Write loopsLineUp(durations) that returns the first time after 0 when every animation is at the start of a loop again: the least common multiple of the durations.
Input: durations = [400,600] Output: 1200
400 loops 3 times and 600 loops 2 times in 1200 ms, and no earlier time works for both.
Input: durations = [300] Output: 300
One animation lines up with itself after one loop.
1 <= durations.length <= 201 <= durations[i] <= 10^610^15.Run tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #636 When Animations Line Up. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.