Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #User function Template for python3
- from bisect import bisect_right as br
- class Solution:
- def median(self, mat, r, c):
- count=(r*c)>>1
- l,r=1,16
- while l<=r:
- m=(l+r)>>1
- p=0
- for i in mat:
- j=br(i,m)
- p=p+j
- if p<=count:
- l=m+1
- else:
- r=m-1
- return l
Advertisement
Add Comment
Please, Sign In to add comment