Minimize the Heights II | Problem of the Day | May 30 2021 | GFG Practice | Hindi

preview_player
Показать описание


USE CODE - SKSAMAGFG
for FLAT 10% off on all Geeks For Geeks Courses

#sksama #problemoftheday #solution #explanation #gfg
Рекомендации по теме
Комментарии
Автор

this was the best explanation.thank u so much sir

chakshumahajan
Автор

Bhai bahut awesome explain Kiya hai mujhe ye achase smaja

ShivamKendre-fcsu
Автор

Bhai Jo koi nahi smja paya vo tumne smja dia...thank you🙂

coldplay
Автор

I finally understood the logic behind this concept. Crystal clear explanation <3

akshatdubey
Автор

After watching 4-5 solution videos, your video of solution is best and very simple.

nevilmavani
Автор

Sir doubt hai
maxEle = max(arr[i-1] + k, arr[n-1] - k);
minEle = min(arr[0]+k, arr[i]-k);

eg K = 3, N = 5
Arr[] = {3, 9, 12, 16, 20}
Output:
11
Explanation:
The array can be modified as
{6, 12, 9, 13, 17}. The difference between
the largest and the smallest is 17-6 = 11
but lekin aapke hisab se max(16+3=19, 20-3=17) = 19
min(3+3 = 6, 20-3=17) = 6
so answer is min(19-6, 20-3) = 13

madhavtayal
Автор

Very well explained sir best video out there for this problem

BeastlyFlash
Автор

i have seen many videos but i don't understand but after watching your video i understand completely thank you very much

vivekkumaryadav
Автор

This is the clearest explanation of this question I have found.

satisfyingwalks
Автор

Very well explained, none of the other videos were able to explain the intuition behind the soln, thanks for posting this solution.

rohitsinha
Автор

Amazing video, Very well explained I finally understood the logic behind this question

shikharsingh
Автор

this is the one, thanks, just want to say, the ideal case would be that we get the ans as (min elem after operation is a[0]+k, and max elem after elem as a[n-1]-k), but this is ideal expectation, that is not always the case, hence we check that what is the next closest we can get to this number, and that why we check for every possible change point (basically element till it are increased and after it and decreased). we are just trying to find a change point which give answer closest to the ideal difference.

neerajchoudhary
Автор

Bro hands down the best video on this
Love the way you explain

anshsharma
Автор

You explained it very well . i understood it finally. Thanks !!

divyanshudwivedi
Автор

The main logic behind the problem is lowering the distance between two element situated at two opposite point. For this they should come toward each other by increasing the value of left element and decreasing the value of right element. But after we complete modifying each element we need to confirm whether the height distance we get is the difference between the lowest element and highest element or not. So at every index we increase the element by k and see if it has become the new largest or not and decrease every element by k to see If it has become the new lowest element or not. With that, at every point we also check if the value we get by subtracting new min from max is lower than the existing height difference or not. Eventually we will achieve the lowest possible difference between the lower one and the higher one.
I thought it like this. Hope this helps you too. Thank

calmyourmind
Автор

bhaiya please keep making these videos and videos for questions from love babbar sheet because those are very important questions. THANK YOU VERY MUCH AGAIN!

divyareddy
Автор

Bohat acche se explain kiya h thankyou <3

NitinKumar-gvhs
Автор

sir u r genius, , this is the best explanation out there in youtube for this question

pushkarnath
Автор

thank sir, for making a long video on this topic, , , it helps me a lot to learn the concept of this question..

pawanlok
Автор

Best explanation out there! I've seen 3-4 videos on the same problem but none were as legit as yours!!

yashsalvi