parameters: (self, ribbons, k)
return_statement: return right
docstring: :type ribbons: List[int]
          :type k: int
          :rtype: int
docstring_summary: :type ribbons: List[int]
          :type k: int
          :rtype: int
docstring_tokens: : type ribbons : List [ int ] : type k : int : rtype : int
function: def maxLength(self, ribbons, k):
          """
          :type ribbons: List[int]
          :type k: int
          :rtype: int
          """
          def check(ribbons, k, s):
              return reduce(lambda total,x: total+x//s, ribbons, 0) >= k
  
          left, right = 1, sum(ribbons)//k
          while left <= right:
              mid = left + (right-left)//2
              if not check(ribbons, k, mid):
                  right = mid-1
              else:
                  left = mid+1
          return right
function_tokens: def maxLength ( self , ribbons , k ) : def check ( ribbons , k , s ) : return reduce ( lambda total , x : total + x // s , ribbons , 0 ) >= k left , right = 1 , sum ( ribbons ) // k while left <= right : mid = left + ( right - left ) // 2 if not check ( ribbons , k , mid ) : right = mid - 1 else : left = mid + 1 return right