Chain With a Loop
A task chain is represented as an index array `next_idx`: the task at index i points to the next task `next_idx[i]`, where -1 marks the end of the chain. Given `next_idx` and a starting index `start`, determine whether following the chain ever loops forever.
A task chain is represented as an index array `next_idx`: the task at index i points to the next task `next_idx[i]`, where -1 marks the end of the chain. Given `next_idx` and a starting index `start`, determine whether following the chain ever loops forever.