voice(not so quick not so slow moderate)& explanation are on 🔥
@sudarshanmaskare3328 Жыл бұрын
Nice solution, we can have only three possibilites[ (min-0),(min-1),(min-2)],,,,,(min-5) will lead to recurrence.... Why? because in question we are given [1,2,5]... This works for me-> int equal(vector arr) { vector possibilities(3); // Start with the minimum element int minimum = *min_element(arr.begin(),arr.end()); for (int i = 0; i < 3; i++) { for (int k : arr) { int diff = k - minimum; int stepsRequired = diff / 5 + (diff % 5) / 2 + ((diff % 5) % 2) / 1; possibilities[i] += stepsRequired; } minimum--; } // Return the minimum number out of all the possibilities return *min_element(possibilities.begin(),possibilities.end()); }
@artistic__08 Жыл бұрын
My first thought was solving this through BFS
@doingsneakypeakylike3 жыл бұрын
Thanks brother! Finally I understood it. The visuals and explanation were really good.
@rajeshpaithari73208 ай бұрын
Heya, I'm still confused about min to min-4.
@praveenmani56728 ай бұрын
Bro, Thanks a lot, finally understood the solution
@PIYUSH610042 жыл бұрын
Please explain more about the optimal solution being present in [min, min-4] range
@nikoo282 жыл бұрын
The range comes from the fact that you can either give 1, 2 or 5 chocolates. That's why you have to check all the possibilities in that range. We do not go past "min-4" because that will take 5 operations which is same as a single operation of giving 5 chocolates at once. Hope that helps.
@PIYUSH610042 жыл бұрын
@@nikoo28 Finally I understood.. Thanks a lot, brother!
@kumarisuruchisuman89193 жыл бұрын
what a explanation man
@vtmcedxc25733 жыл бұрын
your explanation was great, it really helped me
@urbancoder962 жыл бұрын
That is genius!
@sculptandstyle_2 жыл бұрын
i don't understand why only till min-4 is considered
@ajaysubramaniam445310 ай бұрын
well explained.
@tanishqmahendrasaini37643 жыл бұрын
Very nice bro 😃 Well explained & animation made it so easy Thank You!!
@lahiruweliwitiya13 жыл бұрын
Thank you for this explanation!
@jorgegonzaloalfaro53783 жыл бұрын
wow this was really good thank you!!!
@kartika94153 жыл бұрын
Great Work !!!!
@markohy9samy565 Жыл бұрын
great explaination Thx alot !
@vijaykumarsingh58623 жыл бұрын
how you come to know that min will go till min-4??
@nikoo283 жыл бұрын
That is because she can give a maximum of 5 chocolates. If she was able to give 8 chocolates, then you would have to check till 7.
@aakrandan3 жыл бұрын
@@nikoo28 This is a vital information, should have mentioned in the description.
@nikoo283 жыл бұрын
@@aakrandan This information is mentioned in the problem description. :)
@manojkalyan94 Жыл бұрын
@@nikoo28 No where mentioned max of 5 chocolates can be distributed in pblm statement I have checked it
@radhakalyaninakka58772 жыл бұрын
very interesting explanation
@rohanjain42382 жыл бұрын
very detailed explanations
@ayabc43203 жыл бұрын
Great video :) 😊
@siddhigolatkar85583 жыл бұрын
Thank you
@alakmarshafin90653 жыл бұрын
Nicely explained
@aakashkatiyar50053 жыл бұрын
Very helpful!!
@shwetaravi26963 жыл бұрын
bruh i have a doubt what if min=2,then will the still continue till it calculates min-4
@nikoo283 жыл бұрын
yes…you need to calculate every possible min. Otherwise how will you know that min =2?
@doremifasolatee62588 ай бұрын
14:05 can someone please explain to me how is (minimum - 5) the same scenario??
@nikoo288 ай бұрын
it is like dividing in groups of 5. the scenario will be same if it is 30 or 25 or 35
@hoddybhaba67042 ай бұрын
I had the same doubt on watching this video…
@BestOption193 жыл бұрын
when we reach min-5 then how it will be same scenario ??(14:02)
@nikoo283 жыл бұрын
If you reach ‘min-5’, then you will reach the same scenario you started with. Try to do a dry run and take away 5 chocolates, you will find yourself in a recurrence :)
@uttamkumarreddygaggenapall25043 жыл бұрын
according to algorith ans to 1 5 5 is 4 but the true ans is 3
@nikoo283 жыл бұрын
Can you describe the 3 steps to make the distribution equal?
@@nikoo28 take 1 from first ==> 1 operation take 5 from second ==> 2 operation take 5 from third ==> 3operation Not sure if 0,0,0 can be the answer or not.
@nikoo283 жыл бұрын
@@aakrandan 3 is the correct answer. If you try to run the code I have provided, it will give you the answer 3. I think from my explanation you missed the part to check for a range of "min" to "min - 4"
@yashgupta67972 жыл бұрын
consider min from [min,min-4]
@hoddybhaba67042 ай бұрын
Don’t understand the Min to min -4 logic
@vikasgowdalv7703 жыл бұрын
Worst voice ever heard :)
@nikoo283 жыл бұрын
Thanks for your feedback, in an effort to constantly improve please let me know what kind of issues did you face. I will try to improve it in my next video.
@sheikhyawar26283 жыл бұрын
You have nothing to do with his voice, he is doing a great job let him continue you just focus on your voice.we don't come here to judge his voice but to understand his problem solving technique.
@vikasgowdalv7703 жыл бұрын
@@sheikhyawar2628 BTW brother, I never commented on his problem solving skills ik he's a good problem solver And moreover I'll comment what I feel @Study Algorithms pleas do use autotuned voice it's really difficult to listen Hope you understand:)