Company: Infosys SP-Off campus -17-May-26-Slot-1
Difficulty: medium
You are given N intervals, each described by a start time l[i] , an end time r[i] , and a score s[i] attached to it. You need to work out the largest total score achievable . This total comes from picking one single moment in time, t , and adding up the scores of every interval [l[i], r[i]] that contains it (that is, every interval with l[i] ≤ t ≤ r[i] ). Find the largest total score achievable over all choices of t . Input Format The first line contains a integer, N , denoting the number of intervals. Each of the N lines contains 3 space-separated integers, representing row i of intervals. Constraints 1 ≤ N ≤ 10^5 0 ≤ intervals[i][j] ≤ 10^9 Sample Test Cases Case 1 Input: 2 1 5 10 3 7 15 Output: 25 Explanation: Picking t=3 falls inside both interval [1, 5] (score 10) and interval [3, 7] (score 15), for a combined score of 25 — the best possible total, since both intervals overlap right there. Case 2 Input: 2 1 2 100 5 6 200 Output: 200 Explanation: Intervals [1, 2] a