Python DP Binary Search 3 lines
Intuition\n Describe your first thoughts on how to solve this problem. \n- loop each event\n- val of this event + M := max(all event that have end < this_event.
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n- loop each event\n- val of this event + M := max(all event that have end < this_event.start)\n- How to find M?\n    - Generate array EV = [[e0,v0],[e1,v1],....[elast,vlast]]\n    - we binary search this_event.start in this array EV to find the last ej < start, but the vj is not max. So create another DP from EV\n    - DP = [v_max_end_at_0, v_max_end_at_1, ...]\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: NlogN\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: N\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python3 []\nclass Solution:\n    def maxTwoEvents(self, events):\n        ev = sorted([e, v] for s, e, v in events)\n        dp = list(accumulate((v for _, v in ev), func=max, initial=0))\n        return max(dp[bisect_right(ev, [s, 0])] + v for s, _, v in events)\n```
['Python3']