parameters: (self, nums, k)
return_statement: return result
docstring: :type nums: List[int]
          :type k: int
          :rtype: int
docstring_summary: :type nums: List[int]
          :type k: int
          :rtype: int
docstring_tokens: : type nums : List [ int ] : type k : int : rtype : int
function: def waysToPartition(self, nums, k):
          """
          :type nums: List[int]
          :type k: int
          :rtype: int
          """
          total = sum(nums)
          right = collections.Counter()
          prefix = 0
          for i in xrange(len(nums)-1):
              prefix += nums[i]
              right[prefix-(total-prefix)] += 1
          result = right[0]
          left = collections.Counter()
          prefix = 0
          for x in nums:
              result = max(result, left[k-x]+right[-(k-x)])
              prefix += x
              left[prefix-(total-prefix)] += 1
              right[prefix-(total-prefix)] -= 1
          return result
function_tokens: def waysToPartition ( self , nums , k ) : total = sum ( nums ) right = collections . Counter ( ) prefix = 0 for i in xrange ( len ( nums ) - 1 ) : prefix += nums [ i ] right [ prefix - ( total - prefix ) ] += 1 result = right [ 0 ] left = collections . Counter ( ) prefix = 0 for x in nums : result = max ( result , left [ k - x ] + right [ - ( k - x ) ] ) prefix += x left [ prefix - ( total - prefix ) ] += 1 right [ prefix - ( total - prefix ) ] -= 1 return result