CommonLounge is a community of learners who learn together. Get started with the featured resources above, ask questions and discuss related stuff with everyone.
Binary search extended
A sequence (array) is really just a function which associates integers (indices) with the corresponding values. However, there is no reason to restrict our usage of binary search to tangible sequences. In fact, we can use the same algorithm described above on any monotonic function f. ... The only difference is that we replace an array lookup with a function evaluation: we are now looking for some x such that f(x) is equal to the target value.
Hi...is it possible to solve this problem using sliding window method?? If we take by taking 3 elements at a time and defining arr[-1] as the last element and arr[n] as the first element ( 0 based indexing )..Is it possible to solve using this method??