start[i] range is from ( 0 to 10^9 ) d range is from ( 0 to 10 ^ 9 ) The min value you can get is 0 . The max value you can get is ( Max(start[i]) + Max(d) == 10^9 + 10^9 == 2*10^9 ) The max absolute diff is 2*10^9 So that's why i have taken high as 10^10
Just try to observe the difficulty rating of C problem and make sure that you practice roughly around 30 or above problems in that difficulty rating from practice section and learn the concepts and try to observe the patterns . It can help you eventually
Can you explain the part where are mid + p[0] < p[1], still we accept it and went further with p[1]?? What if elements are like [1,5,9] and d=2, so p = 1 is not possible still according to our mathod it's true, why?? I know we need to look for bigger elements than this, but how can we apply binary search on such inconsistent data.
@@U-DAY sorry, p[0] I am referring here was array elements, and the another p in the example is our mid, for which we are checking whether it is acceptable min diff or not
great explanation . thankyou
Thank you ❤
Great solution, we could reduce the search space from 10**10 to max(arr) + d for the high
@@raveendragachchinamath7565 yes that's right you can do that
you're a legend bro 🙏
Thank you bro.. ❤
Thanks man, Great explaination
Thank you ❤
Nice explanation found got the intuition
Thank you ❤
How did you choose high?
start[i] range is from ( 0 to 10^9 )
d range is from ( 0 to 10 ^ 9 )
The min value you can get is 0 .
The max value you can get is ( Max(start[i]) + Max(d) == 10^9 + 10^9 == 2*10^9 )
The max absolute diff is 2*10^9
So that's why i have taken high as 10^10
Hey wanna ask like how can i reach expert from where to practice so that can come up with div2 C have been struggling a lot plz help
Just try to observe the difficulty rating of C problem and make sure that you practice roughly around 30 or above problems in that difficulty rating from practice section and learn the concepts and try to observe the patterns . It can help you eventually
Can you explain the part where are mid + p[0] < p[1], still we accept it and went further with p[1]?? What if elements are like [1,5,9] and d=2, so p = 1 is not possible still according to our mathod it's true, why?? I know we need to look for bigger elements than this, but how can we apply binary search on such inconsistent data.
what is p here ?
@@U-DAY sorry, p[0] I am referring here was array elements, and the another p in the example is our mid, for which we are checking whether it is acceptable min diff or not
@@U-DAY bro, have you understood my question??