Nodes left over
transcript
Two photos. Each one must come before the other. The logs contradict each other, so no valid order exists. The code says zero choices. Why?
The loop takes a ready photo. It frees the photos that come after it. It stops when none is ready.
Each photo waits for the other one. So no photo is ever ready. And the loop ends at once.
Neither photo is ever ready. So the loop never even starts.
No photo was placed. But there are two photos in total.
Test a set with no rules at all. Test a rule that appears twice. Then test a cycle of two photos.
Count the photos you placed. Compare that with n. If it is fewer, return minus one.
An empty ready set can hide a cycle. Compare the placed count with n at the end. Test a cycle of two. Full breakdown in the lecture.