Binary Search
CodeChefOpen on judge ↗
You have given two arrays of **$N$** integers as $A$ = { $A_1, A_2, A_3, ... , A_N$ } and $B$ = { $B_1, B_2, B_3, ... , B_N$ } such that for each **i** ($1 \leq i \leq N$) , **$B_i \leq A_i$** holds true. Lets define a functions F(L,R) where $1 \leq L \leq R \leq N$ as follows F(L,R) = $max(A_L, A_{L+1}, A_{L+2}, ... , A_R)$ $-$ $min(B_L, B_L+1, B_L+2, ... ,B_R )
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start