Celebrity Problem | Solution

  Рет қаралды 77,317

Pepcoding

Pepcoding

Күн бұрын

Пікірлер: 229
@binitrajshah9354
@binitrajshah9354 3 жыл бұрын
Sir you're potential candidate to be a celebrity for sure Thank you !
@Elon-musk-007
@Elon-musk-007 4 жыл бұрын
I never understood this question I had been just skipping this question . Thank you Sir... Keep up the good work ..... You will soon rise
@Pepcoding
@Pepcoding 4 жыл бұрын
Keep watching
@yushsingla9905
@yushsingla9905 3 жыл бұрын
i still miss your videos sir. I know you're a lot busier now but i would love if you yourself could still make such amazing videos, I really appreciate your work and am sure it will help people for many years. Even though i use c++ still watch all your videos when stuck on a problem.
@Pepcoding
@Pepcoding 3 жыл бұрын
Working on it!
@sachinsharma905
@sachinsharma905 3 жыл бұрын
Sumeet sir,hamesha ki tarah aap toh cha gaye. Kya hi explain kiya aapna. Thanks.
@faizanhaider3953
@faizanhaider3953 Жыл бұрын
Gardaa.... Question kaa Dhajji Dhajjji ura sir aap to.... 🙏🙏
@harshchandwani9781
@harshchandwani9781 3 жыл бұрын
This question made me a fan of you, no one can explain it better than you
@architsharma4331
@architsharma4331 3 жыл бұрын
Sir this is my approach to do this Question in O(n):- public static void findCelebrity(int[][] arr) { Stack st=new Stack(); //this loop will find the rows having 0 in them and push them in stack for(int i=0;i
@indranilchakraborty5949
@indranilchakraborty5949 4 жыл бұрын
Thank you sir.... now I am just arrived in second year but still able to understand.
@Pepcoding
@Pepcoding 4 жыл бұрын
All the best. If you like the content, please share in your circles.
@Live-hh6li
@Live-hh6li 3 жыл бұрын
Thanks again Nowadays KZbin recomend your videos on top to me Saves a lot of time in finding good solution.
@Pepcoding
@Pepcoding 3 жыл бұрын
Glad to hear that!
@enigma2886
@enigma2886 4 жыл бұрын
kya teacher ha yein bhai saab ! dhanyawaad sir ji !
@brijpatel237
@brijpatel237 3 жыл бұрын
there's a reason why this video still doesn't have any dislikes, awesome quality and logic.
@Pepcoding
@Pepcoding 3 жыл бұрын
It's all because of the love and respect which you people have given to me. If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms ) Keep motivating, keep learning and keep loving Pepcoding😊
@avinashchaurasiya6497
@avinashchaurasiya6497 3 жыл бұрын
After searching soo much I found that you are a celebrity.❤❤
@Pepcoding
@Pepcoding 3 жыл бұрын
Glad to know that you liked the content and thank you for appreciating. The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos. So, keep motivating, keep learning and keep loving Pepcoding😊
@gauravshukla5203
@gauravshukla5203 4 жыл бұрын
your explaination is the best on internet..great sab kuch samjh a gaya itni asani se
@Pepcoding
@Pepcoding 4 жыл бұрын
thank you
@piyushsarraf9994
@piyushsarraf9994 3 жыл бұрын
Sir, Bhagwan aapka bhala kare Mast samjhate hai ek hi baar me aa gya
@Deepakkumar-kl6ni
@Deepakkumar-kl6ni 3 жыл бұрын
One day know you all according to your lacture We understand you by working very hard Thank you very much Sir
@Pepcoding
@Pepcoding 3 жыл бұрын
Thankyou beta! I am glad you liked it. If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )
@chitranshsaxena59
@chitranshsaxena59 3 жыл бұрын
I was always scared of this question, and today, I only saw the video till 6:14 and I was able to solve the question... His solutions are good...but his way of explaining any problem, that is insane
@Pepcoding
@Pepcoding 3 жыл бұрын
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 )
@pranav288
@pranav288 2 жыл бұрын
@@Pepcoding WTF ??
@Pepcoding
@Pepcoding 2 жыл бұрын
@@pranav288 Don't worry. We are soon to close the website, anyway. So it doesn't matter anymore.
@pareshshikhaliya4702
@pareshshikhaliya4702 3 жыл бұрын
good work and very good explanation but this can be done with O(1) space complexity which increase student more chances to get selected bellow find the O(1) space and O(n) time complexity public class Solution extends Relation { public int findCelebrity(int n) { int candidate = 0; // First pass to find out the potential candidate for (int i = 1; i < n; i ++) { if (!knows(i, candidate)) { candidate = i; } } // Second pass to determine if that candidate is a celebrity for (int i = 0; i < n; i ++) { if (i != candidate) { if (!knows(i, candidate)) { return -1; } if (knows(candidate, i)) { return -1; } } } return candidate; } }
@yogeshwarshendye4857
@yogeshwarshendye4857 3 жыл бұрын
Sir a slightly different approach: check all rows if any of item is 1 break the loop, this gave me the row that had all 0s and i kept that number in a stack. If stack size comes to be 0, there are no celebrity but otherwise, check for column of that number. If any one is 0, no celebrity, otherwise that number comes out to be the celebrity. This solution submitted and score 10. But I am not quite sure it it is the right way.
@shrad6611
@shrad6611 2 жыл бұрын
shandaar jabardast jindabaad, hats off to you sumit sir
@tekbssync5727
@tekbssync5727 3 жыл бұрын
bahut badhiya samjhaya aapne, ekdum crystal clear ❤
@Pepcoding
@Pepcoding 3 жыл бұрын
Thankyou beta! 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 )
@bishalchatterjee8184
@bishalchatterjee8184 2 жыл бұрын
Pepcoding is the best!!!!!!!!!!!!!! Loved the explanation sir!
@vyomyadav6497
@vyomyadav6497 3 жыл бұрын
Sir just a tip, try to animate your content and get into the mind of youth, you are the most excellent teacher, you will do marvels.
@Pepcoding
@Pepcoding 3 жыл бұрын
Ji beta, sochte h iske bare main
@Deepakkumar-kl6ni
@Deepakkumar-kl6ni 3 жыл бұрын
Sir apke samjane ka tarika bhot aacha hai 👍 ham specially for hindi medium student thanks sir aaap mahan ho
@Pepcoding
@Pepcoding 3 жыл бұрын
Thankyou beta! I am glad you liked it. I also hope that you are watching till the end and trying to understand the what, how, and especially why of the problem. If you like our efforts, will you like to review us here - g.page/Pepcoding/review?rc
@MindsetMotivation75
@MindsetMotivation75 2 жыл бұрын
I understand the solution in just one flow . Thank you sir
@FaisalKhan-ce2qu
@FaisalKhan-ce2qu 4 жыл бұрын
its great that you are making a separate video for implementation! a great help to new coders like me ! kudos !
@Pepcoding
@Pepcoding 4 жыл бұрын
Are you aware ki we have a portal as well, jahan question submit kar sakte hain www.pepcoding.com/resources/online-java-foundation
@AyushKumar-fk5lm
@AyushKumar-fk5lm 3 жыл бұрын
Could solve this only because of Sumeet Sir! Thank you sir!!🙏
@Pepcoding
@Pepcoding 3 жыл бұрын
Thankyou beta! 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 )
@AyushKumar-fk5lm
@AyushKumar-fk5lm 3 жыл бұрын
@@Pepcoding Definitely sir! Itna toh kar hi sakta hoon aapke lye!!
@stith_pragya
@stith_pragya 7 ай бұрын
Thank You So Much for this wonderful video .........🙏🙏🙏
@shashanksabharwal8591
@shashanksabharwal8591 4 жыл бұрын
No dislike till now, this is the power of pepcoding,,,, The only reason why i dont watch your all videos is that i know c++not java " :( i am missing such a great sessions from you,,, this is so sad ,, But i understood the concept its easy to code the same in c++, Thankyou :)
@Pepcoding
@Pepcoding 4 жыл бұрын
Welcome back
@DeepakKumar-yl3ok
@DeepakKumar-yl3ok 3 жыл бұрын
very nice , sumeet malik sir never disappoints
@sumantkumar6341
@sumantkumar6341 4 жыл бұрын
sir bahut achche se samajh me aaya h
@mickyman753
@mickyman753 3 жыл бұрын
love you sir ,boht hi pyara samjhaya
@namanpatni8740
@namanpatni8740 3 жыл бұрын
owsm explaination....seriously i was about to skip this question ...just thought to search on youtube and found you fortunately ...thinking i can code ...you explained the overall picture of this question that part i like...thanks :)
@riddhibandyopadhyay584
@riddhibandyopadhyay584 3 жыл бұрын
Too good.... This is the kind of explanation we all need
@Pepcoding
@Pepcoding 3 жыл бұрын
Thank you so much and If you like the content could you post something on LinkedIn about us? This will help us in reaching out to more people and help a lot of other students as well Something like this Sumeet Malik from Pepcoding is making all his content freely available to the community You can check it out here - www.pepcoding.com/resources / Also, this is the youtube channel - kzbin.infoplaylists?view_as=subscriber
@av1shekps
@av1shekps 3 жыл бұрын
Don't know why this channel is underrated?
@ANKITSINGH-xe5wk
@ANKITSINGH-xe5wk 3 жыл бұрын
this channel has true subscriber. it is increasing slowly but it will reach to top . i am sure about this
@Pepcoding
@Pepcoding 3 жыл бұрын
wow, this cheers me up. I am glad we at pepcoding could be of help to you. Keep learning. Also, recommend us to your juniors and peers, they may also benefit.
@harshwardhanchougule3039
@harshwardhanchougule3039 Жыл бұрын
Great Explanation !!!!! Your videos are best explained on KZbin
@rishigupta7371
@rishigupta7371 2 жыл бұрын
We can do the same in O(1) space. Instead of using stack we can eliminate persons and update the celebrity in a variable. int celebrity(vector& M, int n) { // code here int celeb=0; for(int i=1;i
@unstoppable9668
@unstoppable9668 3 жыл бұрын
Excellent explanation , Its almost more than 6 months and 0 dislikes shows how good the explanation was.
@Pepcoding
@Pepcoding 3 жыл бұрын
Thankyou beta! 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 review about us here - g.page/Pepcoding/review?rc
@MohitG7701
@MohitG7701 4 жыл бұрын
your method of explanation is very awesome. You have the unique talent of making difficult problems easy. Hats off to u sir
@hannanhub1717
@hannanhub1717 Жыл бұрын
very easy explanation of concept and code
@aindrilasaha1592
@aindrilasaha1592 3 жыл бұрын
I was a fan of your explanations, and will remain so,always! Thank you Sir!!
@Pepcoding
@Pepcoding 3 жыл бұрын
Thank you for appreciating. The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos. So, keep motivating, keep learning and keep loving Pepcoding😊
@kushagra4401
@kushagra4401 3 жыл бұрын
thank you so much sir
@ambarishdashora5440
@ambarishdashora5440 3 жыл бұрын
wow, You are awesome. I could never think of this question in this way.
@ketansharma6955
@ketansharma6955 Жыл бұрын
one of my favorite problems in level 1
@radharanimathurawali361
@radharanimathurawali361 3 жыл бұрын
Very nice explanation
@shubhamjain54519
@shubhamjain54519 2 жыл бұрын
3:29 condition 1 3:47 condition 2 watch again to understand
@gourangpathak276
@gourangpathak276 2 жыл бұрын
🙏🏻 will never forget this idea now
@Pepcoding
@Pepcoding 2 жыл бұрын
Glad it helped. For better experience, visit nados.io, where you will get well curated content and career opportunities.
@yashraorane578
@yashraorane578 2 жыл бұрын
Great explanation.
@shubham-pp4cw
@shubham-pp4cw 2 жыл бұрын
nice and simple explantation
@codetochange8
@codetochange8 2 жыл бұрын
Very nice explanation sir
@kiyotakaayanokoji-pt7bs
@kiyotakaayanokoji-pt7bs Жыл бұрын
such a great solution, thank you sir
@justanotherlearner1404
@justanotherlearner1404 3 жыл бұрын
amazing teaching
@gauravbansal2998
@gauravbansal2998 11 ай бұрын
Awesome explanation, loved it!
@AdityaRaj-ix5rg
@AdityaRaj-ix5rg 2 жыл бұрын
nice explanation..thanks
@muskanshivhare6466
@muskanshivhare6466 4 жыл бұрын
Thank you for such good explanation.
@Pepcoding
@Pepcoding 4 жыл бұрын
I am glad this helped. Will you like to drop us a review? g.page/Pepcoding/review?rc
@aishwaryaranghar3385
@aishwaryaranghar3385 2 жыл бұрын
ThankYou sir. You are the best
@rishavgupta7868
@rishavgupta7868 3 жыл бұрын
How to do this O(1) space as required in GFG question. (in this approach we are using stack of size n, it means space complexity is O(n)
@parissweetheart96
@parissweetheart96 3 жыл бұрын
Instead of storing it in stack you can do like this. Assume 0 as the 1st celebrity and then iterate and check other possible celebrities. If any found update the celebrity. Rest of the step is same. int celebrity = 0; for(int i=0;i
@yashsomani3042
@yashsomani3042 2 жыл бұрын
Thank you Sir , You taught really well
@paragroy5359
@paragroy5359 3 жыл бұрын
Nice explanation your videos are really good...please keep on making such videos.....you are doing a great job
@thecodingjournal4726
@thecodingjournal4726 4 жыл бұрын
Wow this question was this easy, hats offfff
@kashishchugh2541
@kashishchugh2541 4 жыл бұрын
Sir, I have followed all your videos on stack and i loved all of them. I just have 2 doubts here: 1. Can't we after finding potential celebrity, now push array elements in reverse in new stack, so we will be able to check all the remaining cells, will it work? 2. How do we get the feel after seeing the question that it can be done by stacks, in earlier ques i understood because of next greatest or smallest concept, but in this ques or diff situations how do we know that we need stack?
@Pepcoding
@Pepcoding 4 жыл бұрын
Beta, I regret to inform you that, I won't be able to answer/solve the personal doubts of each and every student over here. For clearing your doubts, you can join our community on telegram - t.me/pepcoding.
@ParasVashishth_RV
@ParasVashishth_RV 2 жыл бұрын
Actually u don't need a stack here, it can be done by a simple iteration also. Stack is used just as an example
@rishabhgoyal2835
@rishabhgoyal2835 4 жыл бұрын
amazingly explained..
@Pepcoding
@Pepcoding 4 жыл бұрын
Glad you think so!
@saurabhshandilay8261
@saurabhshandilay8261 2 жыл бұрын
vaah sirji moj kr di
@kamalkumar945
@kamalkumar945 3 жыл бұрын
too good explanation
@himanshu2149
@himanshu2149 3 жыл бұрын
Brilliant Sir!! Thank you !!!
@nishantjoshi167
@nishantjoshi167 4 жыл бұрын
awesome man....u have great teaching skills..God bless u :)
@Pepcoding
@Pepcoding 4 жыл бұрын
Thanks, you too!
@prateeksrivastava9
@prateeksrivastava9 4 жыл бұрын
Very Nice Explanation !Keep going Sir.
@Pepcoding
@Pepcoding 4 жыл бұрын
Thank you bro. Padhte rahie.
@asishpanda3547
@asishpanda3547 3 жыл бұрын
really nice explanation u just gained a subscriber, keep doing the good work.
@aryansaxena4630
@aryansaxena4630 3 жыл бұрын
thanks a lot sir ,great explanation
@willturner3440
@willturner3440 3 жыл бұрын
Sir please upload more videos.. Always waiting for notification 😔
@sunnygoswami2248
@sunnygoswami2248 3 жыл бұрын
Great explanation Sir!!
@jobanpreetsingh2370
@jobanpreetsingh2370 3 жыл бұрын
Sir I know you but you don't know me So you are celebrity 😊😊
@shaunaksensarma8351
@shaunaksensarma8351 3 жыл бұрын
Fantastic solution and such a simple explanation.
@Pepcoding
@Pepcoding 3 жыл бұрын
Glad you think so! 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 )
@nandinisharma7886
@nandinisharma7886 3 жыл бұрын
Thanks a lot sir !
@priyankaamahour
@priyankaamahour 3 жыл бұрын
Thank you so much Sir, great explanation.
@bhagirathmakwana9112
@bhagirathmakwana9112 Жыл бұрын
sir, you are great!!!
@saitama_capedbaldy9758
@saitama_capedbaldy9758 3 жыл бұрын
It would great if he explains in English. Anyway I understood the approach. Great explanation!!!
@hritikagarwal7676
@hritikagarwal7676 4 жыл бұрын
Thank you, sir. Your content and the way of teaching are amazing. It would be better if you provide some identification for problems related to stack. And also the intuition to this problem.
@Pepcoding
@Pepcoding 4 жыл бұрын
Sure I will
@sachindeshpande4521
@sachindeshpande4521 4 жыл бұрын
Awesome😊😊
@Pepcoding
@Pepcoding 4 жыл бұрын
Thank you! Cheers!
@amishapurswani9957
@amishapurswani9957 4 жыл бұрын
sir you have explained wonderfully
@Pepcoding
@Pepcoding 4 жыл бұрын
I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem. If you like our efforts, we request a review - g.page/Pepcoding/review?rc
@satwikjain6177
@satwikjain6177 Жыл бұрын
super explanation
@prernnajain1532
@prernnajain1532 3 жыл бұрын
Sir but this is of order n square as we are using 2 for loops Ranging till the length then how it is order of n please clarify my doubt sir. Thank you
@puneethj9920
@puneethj9920 3 жыл бұрын
Great video!
@vivekdabas2011
@vivekdabas2011 4 жыл бұрын
Explanation is nice!!
@satyamsingh8459
@satyamsingh8459 4 жыл бұрын
100th like here i go!, thank you sir
@AyushSingh-lt2rq
@AyushSingh-lt2rq 4 жыл бұрын
What an amazing explanation sir.Thanks a lot.
@Pepcoding
@Pepcoding 4 жыл бұрын
You are most welcome
@soumavanag5025
@soumavanag5025 3 жыл бұрын
awsome explanation :) thanks
@Pepcoding
@Pepcoding 3 жыл бұрын
Thankyou beta! If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )
@himanshusrivastav7738
@himanshusrivastav7738 3 жыл бұрын
Nice explanation dude!! keep up the good work. Hatss offf!!!!!!!!
@Pepcoding
@Pepcoding 3 жыл бұрын
Thanks a ton.Keep learning, Keep growing and keep loving Pepcoding!😊
@SCRIPTSAG
@SCRIPTSAG 4 жыл бұрын
Bole to mja aa gya sir
@Pepcoding
@Pepcoding 4 жыл бұрын
I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem. If you like my efforts, I request a review g.page/Pepcoding/review?rc
@kc8478
@kc8478 4 жыл бұрын
Thank you sir
@Pepcoding
@Pepcoding 4 жыл бұрын
yahi to chaie If you like our efforts, we request a review g.page/Pepcoding/review?rc You can subscribe to our channel here kzbin.infoabout?view_as=subscriber For clearing your doubts, you can join our community on telegram t.me/pepcoding
@kc8478
@kc8478 4 жыл бұрын
@@Pepcoding sir ur video of tum milay dil kihlay wali bohat barhia ha :)
@ayushgoel9584
@ayushgoel9584 4 жыл бұрын
sir, if possible, please upload 4-5 questions per day.
@himanshukumar1673
@himanshukumar1673 3 жыл бұрын
Thanks for owsm content in free
@Pepcoding
@Pepcoding 3 жыл бұрын
Thankyou beta! I am glad you liked it. If you like our efforts, will you like to write a review about us here -g.page/Pepcoding/review?rc
@aasimalikhan6353
@aasimalikhan6353 3 жыл бұрын
Amazing explanation sir.
@Pepcoding
@Pepcoding 3 жыл бұрын
I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem. If you like our efforts, we request a review g.page/Pepcoding/review?rc You can subscribe to our channel here kzbin.infoabout?view_as=subscriber
@iuashrafi
@iuashrafi 10 ай бұрын
Great ! Great ! Great !
@adityarathi3420
@adityarathi3420 3 жыл бұрын
Thanks Sir :-)
@shivanshtiwari7109
@shivanshtiwari7109 4 жыл бұрын
What a superb explanation!!🙌🙌
@Pepcoding
@Pepcoding 4 жыл бұрын
Glad you think so! Will you please drop us a review? g.page/Pepcoding/review?rc
@amitkumargupta6722
@amitkumargupta6722 4 жыл бұрын
Thank u so much for easiest solution...
@Pepcoding
@Pepcoding 4 жыл бұрын
Keep learning and Keep loving Pepcoding
@shubhankkhare9342
@shubhankkhare9342 4 жыл бұрын
This problem can be solved without using stack. look at the code below :- int getId(int m[MAX][MAX], int n) { long pot = 0; for(long i = 1;i
@Pepcoding
@Pepcoding 4 жыл бұрын
Yes it can be
@princesharma8676
@princesharma8676 3 жыл бұрын
thanq sir ji
@Pepcoding
@Pepcoding 3 жыл бұрын
I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem. If you like our efforts, we request a review g.page/Pepcoding/review?rc You can subscribe to our channel here kzbin.infoabout?view_as=subscriber
@rohitangiras6476
@rohitangiras6476 3 жыл бұрын
Hello Sir, Kya Kabhi isme aise bhi ho sakte hain kya ki arr[ i ][ j ] == 0 and arr[ j ][ i ] == 0.Then uss time stack mein kya push hoga. Thanks
@anmolj
@anmolj 3 жыл бұрын
Thank you sir.Really well explained.
@Pepcoding
@Pepcoding 3 жыл бұрын
You're welcome. Keep watching and keep lovingPepcoding🙏
Postfix Evaluations and Conversions | Questions
6:52
Pepcoding
Рет қаралды 17 М.
Minimum Stack - 2 | Solution
24:01
Pepcoding
Рет қаралды 22 М.
Don't underestimate anyone
00:47
奇軒Tricking
Рет қаралды 21 МЛН
FIND THE CELEBRITY | LEETCODE # 277 | PYTHON SOLUTION
12:48
Cracking FAANG
Рет қаралды 2,7 М.
Sliding Window Maximum | Solution
21:15
Pepcoding
Рет қаралды 80 М.
NVIDIA’s New AI: Stunning Voice Generator!
6:21
Two Minute Papers
Рет қаралды 77 М.
Largest Area Histogram | Solution
20:05
Pepcoding
Рет қаралды 73 М.
The Celebrity Problem | Algorithm Explanation by alGOds!!
15:56
L17. The Celebrity Problem | Stack and Queue Playlist
16:17
take U forward
Рет қаралды 30 М.
The Celebrity Problem | Stacks | Love Babbar DSA Sheet | Amazon🔥 | V.V IMP
25:47
Yogesh & Shailesh (CodeLibrary)
Рет қаралды 25 М.
6 Stock Span Problem
28:02
Aditya Verma
Рет қаралды 220 М.