Simplified Sorting Solution without heaps / binary search - beats 96%
Intuition\n- Brute Force: Sorting + double nested for loop to find the maximum interval before the current one that gives the maximum value.\n- Heap: Sort by st
# Intuition\n- Brute Force: Sorting + double nested for loop to find the maximum interval before the current one that gives the maximum value.\n- Heap: Sort by starts and ends, and add all intervals from ends into heap which are less than the current start. \n- Constant to keep track of max: Replace heap with a variable to keep track of max, most optimal solution.\n\n# Complexity\n- Time complexity:\n$$O(nlog(n))$$ --> for sorting the initial arrays by starts and ends\n\n- Space complexity:\n$$O(n)$$ --> extra space to store the sorted arrays\n\n# Code\n```python3 []\nclass Solution:\n    def maxTwoEvents(self, events: List[List[int]]) -> int:\n        ends = sorted(events, key=lambda x: x[1])\n        starts = sorted(events, key=lambda x: x[0])\n        max_val = 0\n        end_idx = 0\n        res = 0\n\n        for i in range(len(starts)):\n            while end_idx < len(ends) and ends[end_idx][1] < starts[i][0]:\n                max_val = max(max_val, ends[end_idx][2])\n                end_idx += 1\n            \n            res = max(res, starts[i][2] + max_val)\n        \n        return res\n\n\n\n```
['Python3']