Chocolate Distribution | GFG Solution | Searching and Sorting
Vložit
- čas přidán 2. 06. 2021
- Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that.
NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. Question Statement:
1. Given an array A[] of positive integers of size N, where each value represents the number of chocolates in a packet. Each packet can have a variable number of chocolates. There are M students, the task is to distribute chocolate packets among M students such that :
2. Each student gets exactly one packet.
3. The difference between maximum number of chocolates given to a student and minimum number of chocolates given to a student is minimum.
Topic: #Array #GFG #SearchingAndSorting
Used #DataStructure: #Array
#TimeComplexity: O(nlogn)
#SpaceComplexity: O(1)
For detailed information and other exercises, VISIT: www.pepcoding.com
Have a look at our result: www.pepcoding.com/placements
Follow us on our FB page: / pepcoding
Follow us on Instagram: / pepcoding
Follow us on LinkedIn: / pepcoding-education
----------------------------------------------------------------
#Array #geeksforgeeks #SearchingAndSorting
For a better experience and more exercises, VISIT: www.pepcoding.com/resources/
Have a look at our result: www.pepcoding.com/placements
Follow us on our CZcams page: / pepcoding
Follow us on our FB page: / pepcoding
Follow us on Instagram: / pepcoding
Follow us on LinkedIn: / pepcoding-education
Follow us on Pinterest: / _created
Follow us on Twitter: home
.
.
.
Happy Programming !!! Pep it up 😍🤩
.
.
.
#pepcoding #code #coder #codinglife #programming #coding #java #freeresources #datastrucutres #pepcode #competitive #competitiveprogramming #softwareengineer #engineering #engineer
pepcoding is the best platform to learn DSA. thanks to entire team of pepcoding
Great explanation ! Totally loved the way you elaborated all the things 💥💯
Oh my goodness! Ye itna asaan tha kya?!
Totally loved your explanation. Pepcoding rocks!
omg, what an intuition.
thanks a lot, pepcoding. Thanks Di
wow!! On-point explanation. Really explained it very well mam.
thank you so much mam and pepcoding team of sumit sir main 1 baar ke pura crystal clear ho gya..bhut simple idea se apne clear kr diye..mtlb kya bole bilkul shock ho gya ittna easily ho gyA...ashe video bnate rhye mam..aplog ke he bharose ha humlog thank you
So true !
Thankyou
I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
Best explanation!!
very good way of teaching.kash BE karte waqt ye sab dekhte
explaining with patience. awesome
So precisely explained!!!!
Manisha Mam explanatory skills are beyond words!😁😃
Glad you liked it!
For better experience, visit nados.io, where you will get well curated content and career opportunities.
Gajab 😍🙏
Great !!
Perfect !
Great expalnation..........loved how u explained the problem
Glad it was helpful!
Keep learning.
And for better experience, visit nados.io, where you will get well curated content and career opportunities.
thik hai ji thankyou
nice explanation
Sorting + sliding window problem
great explanation!!!!!!!!!!!!
thanks mam
thanks ma'am.very nice explaination
Thanks ma'am
Thik h ji🙏
I have watched most of your videos because I understand each an every line of code that you write but I can't find videos on some mathematical problems questions ....
Please do that vas well ,
very nice explanation
Glad you love the explanation, for better experience and well organised content sign up on nados.io and start learning.
1 number mam !!!!!!!
Thank you so much and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
well explained
Thank you so much and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
mam python ke liye bhi code likh dia kare
in for loop there is n-m+1
What language is this??
i dont understand n-m loop thing
it should not be n-m, gfg has a different solution n-m+1
what is the mistake in my codde can anyone help me
class Solution
{
public long findMinDiff (ArrayList a, int n, int m)
{
// your code here
int ans =Integer.MAX_VALUE;
Collections.sort(a);
for(int i=0;i