parameters: (self, events, k)
return_statement: return dp[0][-1]
docstring: :type events: List[List[int]]
          :type k: int
          :rtype: int
docstring_summary: :type events: List[List[int]]
          :type k: int
          :rtype: int
docstring_tokens: : type events : List [ List [ int ]] : type k : int : rtype : int
function: def maxValue(self, events, k):
          """
          :type events: List[List[int]]
          :type k: int
          :rtype: int
          """
          events.sort()
          sorted_starts = [x[0] for x in events]
          dp = [[0]*(k+1) for _ in xrange(len(events)+1)]
          for i in reversed(xrange(len(events))):
              next_i = bisect.bisect_right(sorted_starts, events[i][1])-1
              for j in xrange(1, k+1):
                  dp[i][j] = max(dp[i+1][j], dp[next_i+1][j-1]+events[i][2])
          return dp[0][-1]
function_tokens: def maxValue ( self , events , k ) : events . sort ( ) sorted_starts = [ x [ 0 ] for x in events ] dp = [ [ 0 ] * ( k + 1 ) for _ in xrange ( len ( events ) + 1 ) ] for i in reversed ( xrange ( len ( events ) ) ) : next_i = bisect . bisect_right ( sorted_starts , events [ i ] [ 1 ] ) - 1 for j in xrange ( 1 , k + 1 ) : dp [ i ] [ j ] = max ( dp [ i + 1 ] [ j ] , dp [ next_i + 1 ] [ j - 1 ] + events [ i ] [ 2 ] ) return dp [ 0 ] [ - 1 ]