Company: Komprise
Difficulty: medium
Large dam Problem Description There is a large dam with N unique floodgates, each identified by a unique number from 0 to N-1. The control system of the dam keeps a record of the floodgate operations. A pathway between two floodgates is opened daily, allowing water to flow from one door to another. This operation is recorded in a list of logs, where each log[i] = [day, door_A, door_B] contains a non-negative integer representing the day and the numbers of the two different doors. A door is considered connected to another door if there is a direct water flow between them or if it shares water flow with another one connected to the second door. Your task is determining the earliest day by which water could flow between every door in the dam, effectively connecting all doors. If there is no such day when all doors are interconnected through water flow, the output should be -1. Complete the solve() function. The function takes 3 parameters: int solve (int N, int K, vector<vector<int&