binary search and Bribe the Prisoners