#NEWLINE# def bisect( self , pages , k , lower , upper ) : #NEWLINE# #INDENT# '\n        O(n lg sum(p))\n        ' #NEWLINE# while ( lower < upper ) : #NEWLINE# #INDENT# mid = ( ( lower + upper ) / 2 ) #NEWLINE# if self . valid ( pages , k , mid ) : #NEWLINE# #INDENT# upper = mid #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# lower = ( mid + 1 ) #NEWLINE# #UNINDENT# #UNINDENT# return lower