Company: Titan_16sep
Difficulty: medium
Segment Trouble Problem Description You are given N segments. Each segment has three properties (L, R, cost) : it starts at L , extends up to R , and has the price cost . Both endpoints L and R are included in the segment. Two segments can form a valid pair if and only if they do not overlap. Two segments overlap when there is at least one point x that lies in both of them. Because endpoints are included, two segments that only touch at a shared endpoint (one ends at R and the other starts at L = R ) do overlap and cannot be paired. The cost of pairing two valid segments is the product of their individual costs. Out of all possible valid pairs, find the one whose cost of pairing is minimal and print that minimum cost. If no valid pair exists, print -1 . Function Description Complete the function minOverlapCost in the editor. It has the following parameter: segments : a list of N rows, where row i holds the three integers L , R and cost of segment i It returns a 64-bit integer: the mini