DoorDash interview question

1. Union Find 2. DP