I have solved the problem LINK with sliding window. But in comments, some people mentioned about solving it with binary search. What should be the search function for binary search in the problem? Can that function be made without using concept of sliding window.