Deviopath › Swift
Hard · Algorithms
next[i] is the next index, -1 is none. Head is 0. Write hasCycle(_:).
next[i]
-1
hasCycle(_:)
Next: Kth Largest