📌📌 Heap || very-Easy || Well-Explained 🐍
IDEA:\nThis question is same as https://leetcode.com/problems/maximum-profit-in-job-scheduling/ .\n\n In this we have to consider atmost two events. So we will 
## IDEA:\n**This question is same as https://leetcode.com/problems/maximum-profit-in-job-scheduling/ .**\n\n* In this we have to consider atmost two events. So we will only put the cureent profit in heap.\n\n* Maintain one variable res1 for storing the maximum value among all the events ending before the current event gets start.\n* Another variable res2 store the maximum profit according the given condition.\n\n\'\'\'\n\n\tclass Solution:\n    def maxTwoEvents(self, events: List[List[int]]) -> int:\n        \n        events.sort()\n        heap = []\n        res2,res1 = 0,0\n        for s,e,p in events:\n            while heap and heap[0][0]<s:\n                res1 = max(res1,heapq.heappop(heap)[1])\n            \n            res2 = max(res2,res1+p)\n            heapq.heappush(heap,(e,p))\n        \n        return res2\n\n### Thanks and Upvote If you like the Idea !!\uD83E\uDD1E
['Heap (Priority Queue)', 'Python', 'Python3']