# Tag Info

0

I think this is actually a much more natural algorithm than the "standard" one involving two BFSes, linked by nitangle :) One way to interpret it: The $i$-th entry in maximums stores the lengths of the two longest paths emanating from vertex $i$ that (a) have distinct second vertices and (b) avoid a specific vertex (namely, $i$'s parent in the DFS)....

1

The easiest way to understand this is really to draw it out and move your fingers on a graph, so I recommend literally pulling out a piece of paper to follow along. Picture the part before the cycle as a line, and the cycle is a circle. So we have a straight line of arrows pointing into a circle of arrows. The length of the line is X steps, and the length of ...

0

When idleSpot (or, as in the code, idleState) is zero or negative, it means we have enough tasks other than A to fill the required minimum cooldown periods between A tasks. Well, suppose BB are the overflowing tasks. Instead of appending them to the end of scheduling queue, we can just insert them, one right after each A. So instead of $\quad$A X X A X X A ...

Top 50 recent answers are included