#NEWLINE# def minArea( self , image , x , y ) : #NEWLINE# #INDENT# '\n        :type image: List[List[str]]\n        :type x: int\n        :type y: int\n        :rtype: int\n        ' #NEWLINE# def binarySearch( left , right , find , image , has_one ) : #NEWLINE# #INDENT# while ( left <= right ) : #NEWLINE# #INDENT# mid = ( left + ( ( right - left ) / 2 ) ) #NEWLINE# if find ( image , has_one , mid ) : #NEWLINE# #INDENT# right = ( mid - 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# left = ( mid + 1 ) #NEWLINE# #UNINDENT# #UNINDENT# return left #NEWLINE# #UNINDENT# searchColumns = ( lambda image , has_one , mid : ( any ( [ int ( row [ mid ] ) for row in image ] ) == has_one ) ) #NEWLINE# left = binarySearch ( 0 , ( y - 1 ) , searchColumns , image , True ) #NEWLINE# right = binarySearch ( ( y + 1 ) , ( len ( image [ 0 ] ) - 1 ) , searchColumns , image , False ) #NEWLINE# searchRows = ( lambda image , has_one , mid : ( any ( itertools . imap ( int , image [ mid ] ) ) == has_one ) ) #NEWLINE# top = binarySearch ( 0 , ( x - 1 ) , searchRows , image , True ) #NEWLINE# bottom = binarySearch ( ( x + 1 ) , ( len ( image ) - 1 ) , binarySearch , image , False ) #NEWLINE# return ( ( right - left ) * ( bottom - top ) )