DoorDash Interview Question

1 LC Hard question about relationship between elements in a collection, seemed like a graph problem