Below code works fine and pass all the test cases but I don't know how this bitwise operator doing in this code, it's 275 leetcode problem:
class Solution:
def hIndex(self, citations: List[int]) -> int:
l, r = 0, len(citations)
while(l<r):
m = (l+r)//2
if citations[~m] > m:
l = m + 1
else:
r = m
return l