Print N-bit binary numbers having more 1’s than 0’s for any prefix

  Рет қаралды 72,203

Aditya Verma

Aditya Verma

Күн бұрын

Пікірлер: 286
@shrihariprajapati9996
@shrihariprajapati9996 3 жыл бұрын
Coded it on my own within 15 mins ! And just a week ago I couldn't even understand how recursion works ! Thanks man ! Legend ! 🙌
@nirmalwagh1976
@nirmalwagh1976 3 жыл бұрын
Can u please share code?
@aniketbhoite7168
@aniketbhoite7168 3 жыл бұрын
Initially add 1 in output string n pass no of zero as 0 n one as 1 n as n-1....then if o>z then we can add one or zero otherwise only one... Hope this helps
@AmarSingh-qj1pp
@AmarSingh-qj1pp 3 жыл бұрын
Hey can you solve the generating m bit gray code of gfg using recursion. I have been trying it but stuck on one test case. If possible pls do
@thinkingmad1685
@thinkingmad1685 3 жыл бұрын
Like did u code in ide with problem statement or just own ide
@Monkeydluffy-we2fk
@Monkeydluffy-we2fk 3 жыл бұрын
Ha maine bhi ..recursion ka master hu mai abh 😶..lol agle video dekhna hai cuz there
@ntesla5
@ntesla5 4 жыл бұрын
Thank you very much for awesome explaination . Most of the comment section of his all videos are usually requesting for different topics or correcting or asking for some sort of help. We all are so selfish , the guy is teaching (BEST in the world) and that to for free of cost. Despite getting a high salary job , he is still spending his value able time for us . I think we should accept it and appreciate his work and not force him to make video based on our requirements
@TheAdityaVerma
@TheAdityaVerma 4 жыл бұрын
❤️❤️❤️❤️❤️❤️❤️❤️
@akashmanna2099
@akashmanna2099 4 жыл бұрын
Nailed it 👌!
@akshatw7866
@akshatw7866 3 жыл бұрын
Exactly my thoughts!
@ADNANAHMED-eo5xx
@ADNANAHMED-eo5xx 3 жыл бұрын
@@TheAdityaVerma isi baat par video daal do yaar
@ayushmansingh5271
@ayushmansingh5271 3 жыл бұрын
@@ADNANAHMED-eo5xx 😂
@satwikmishra60
@satwikmishra60 3 жыл бұрын
Trust me, this guy's a living legend. Just a month ago I couldn't even write a single line of code for a basic recursion problem and eventually ended up doing this question just after hearing the problem statement. 🎩📴
@piyushgupta9048
@piyushgupta9048 4 жыл бұрын
I was able to solve recursion questions but after this, I m able to solve problems in much lesser time. These videos gave me immense clarity on how to approach a question.
@Kabir-lv7oq
@Kabir-lv7oq 27 күн бұрын
I'm able to do the questions alone..GOATED playlist
@priyankarai7005
@priyankarai7005 4 жыл бұрын
did it myself. now going to look at solution. Thank u so much aditya
@manavshah7450
@manavshah7450 3 жыл бұрын
Watch the video till 12:19 and then code the solution yourself. You will definitely get it! Thank you aditya verma for all this. You are the best!
@swappy4515
@swappy4515 3 жыл бұрын
Yess I did the same
@Ssss-ox2nu
@Ssss-ox2nu 3 жыл бұрын
yes same me too
@sunnykumarjha9527
@sunnykumarjha9527 3 жыл бұрын
same vro😁 yar itna aasan bana diya hai bhai ne recursion ko😂
@AkashKumar-lr6hc
@AkashKumar-lr6hc 2 жыл бұрын
I did just by reading question ... He made me Jedi in recursion
@Ak-.-47
@Ak-.-47 3 жыл бұрын
Before Watching this series I was not able to approach basic problems of recursion....but now due to Your help i am easily able to do medium level questions.Thanku sir for this❤
@darkndown
@darkndown Жыл бұрын
I, just like others in comments, wasn't able to write basic recursive code. However, after watching this playlist, I coded this ques just after hearing the problem statement. Thanks Aditya!
@DroidHolicOfficial
@DroidHolicOfficial 2 жыл бұрын
Wow! You have explained previous problems so damn well that I didn't even have to watch this video to write the solution. Thanks a lot man!
@HimanshuSingh-yh8lz
@HimanshuSingh-yh8lz 3 жыл бұрын
before starting this series I was having problem while solving problems of recursion and now I am solving the question before watching the explanation video..Thanks, Aditya Verma
@viditshah5944
@viditshah5944 4 жыл бұрын
Sir Awesome videos.This might be No.1 channel to prepare and clear the concepts... It gives too much bust for interview preparation..! Waiting for Backtracking problems..
@himanshumalik6913
@himanshumalik6913 3 жыл бұрын
Bhai, khud se kar lya sirf shuru ke 15 min video dekhi, question understand ke lye. Bina answer dekhe 😭😭😭😭😭 Thank you bhai.
@sumitkeshav4718
@sumitkeshav4718 4 жыл бұрын
A few moments later 😂😂! Great content as usual ❤✌
@abhijitsaha4311
@abhijitsaha4311 3 жыл бұрын
You are great brother. I am one of those CS student who always preferred maintaining a safe distance from recursion. As a result I was getting feverish feeling whenever I was facing problems that need DP to solve. I came across your DP playlist first and after watching a few videos I felt if anyone can teach me Recursion, it is Aditya Verma only. Now I am solving problem before looking into your solutions. You are just a gift of GOD. Stay healthy and happy brother. Keep teaching us with your amazing teaching skills.
@ankitmishra3823
@ankitmishra3823 3 жыл бұрын
I saw all series of recursion and able to do question very easily and able to understand problems.
@AnupBarman-bd1ju
@AnupBarman-bd1ju 7 ай бұрын
coded it on my own again! the basics I've received from this playlist is unimaginable. hats off bhai.
@AnupBarman-bd1ju
@AnupBarman-bd1ju 7 ай бұрын
the code i've written for the gfg problem is here : class Solution{ public: void generate(int n, int one, int zero, string op, vector &v) { if (n == 0) { v.push_back(op); return; } if (n != 0) { string op2 = op; op2.push_back('1'); generate(n - 1, one + 1, zero, op2, v); } if (one > zero) { string op2 = op; op2.push_back('0'); generate(n - 1, one, zero + 1, op2, v); } return; } vector NBitBinary(int n) { vector v; string op = ""; generate(n, 0, 0, op, v); sort(v.begin(), v.end(), greater ()); return v; } };
@anshirk9770
@anshirk9770 3 жыл бұрын
11 minutes was sufficient due to your amazing explanation! Thank you so much bhaiyya :')
@saloni8603
@saloni8603 3 жыл бұрын
Can't thank you enough for this awesome playlist 😭❤❤
@Cool-ss7ph
@Cool-ss7ph 11 ай бұрын
Solved this question in 5 min, even before watching it, just on the basis of the knowledge gained from the previous videos in the playlist. Great work man.. hats off to you. 👏👏👏
@ajitpawar7558
@ajitpawar7558 3 жыл бұрын
I was fearing the recursion. Whenever i saw recursion i tried to do it with loops but never got the answer in required time complexity. At the starting of the series he said that after completing the entire playlist you will become Jedi. And yes after completing i can say i have become Jedi in Recursion. Thanks a lot for helping me out. You are doing a great job here.... ❤️💯🔥
@SHAH_PREPARES
@SHAH_PREPARES 2 жыл бұрын
i was literally able to solve this question on my own in the first go...all thanks to your efforts bro..( this playlist is must for everyone who thinks recursion sucks.)
@shivambhardwaj5313
@shivambhardwaj5313 3 жыл бұрын
about to finish this playlist just one more question left, normally i dont even have to watch your complete video thanks to your explanation. thanks a lot hope u return to youtube
@hope-jh7bv
@hope-jh7bv 2 жыл бұрын
Thank you so much sir. With your help I am so much confident with recursion and backtracking. I was so depressed and having second option other than learning DSA. But finally I am able to solve medium range problems gradually and got my confidence back. I will be always grateful to you. Again, thanks a lot.
@rajshreebose1828
@rajshreebose1828 3 жыл бұрын
God Bless you, Buddy!!! was struggling with recursion since months now.
@harshitpatil6138
@harshitpatil6138 10 ай бұрын
Just click on video saw first 10 sec and think let me understand myselft about ip-op and ps click on the link and understand the problem then first try to make the recursive tree ofcourse first time I failed to do . then again think about the problem and retry to build the recursive tree and this time somehow I made it and see what I code it as you taugh once you made a recursive writing code will be cake work . so I just run code again test case and it passes😄 that is the power of your teaching . Thankyou aditya Bhaiya for your efforts ! You are The BEST 🙃.
@archanaa7747
@archanaa7747 2 жыл бұрын
tysm for this playlist. you explained each and everything very clearly. this playlist help me a lottt.
@manishchauhan4630
@manishchauhan4630 Ай бұрын
omg i solved this question all by myself just needed to draw the binary tree thats it i cant believe it wow this is so good great work man great all these binary tree and choices problems are so clear when i havent even coded the solution i could clearly see it how i should code amazing
@rajeshramoju8837
@rajeshramoju8837 3 жыл бұрын
just saw the problem statement and boom i did myself ..thankyou
@saravind3153
@saravind3153 3 жыл бұрын
We need your tutorials sir big fan of you
@SKILLCRYSTAL
@SKILLCRYSTAL 2 жыл бұрын
The best about his videos is that after you watched the explanation of the problem, you can code by yourself irrespective of which language you code.
@aniketpathak2721
@aniketpathak2721 3 жыл бұрын
Amazing work bhaiya! Hands down, one of the best channel to learn algorithms. Will always be grateful for what I gained from this channel!
@vanshjain5960
@vanshjain5960 Жыл бұрын
I am wordless how good ur content is this is just awesome bhaiiii Love it❤❤❤❤❤❤
@aayushpagare9366
@aayushpagare9366 3 жыл бұрын
OMG Aditya bhaiya you are magical.....i cant belive i came with the solution in just 5 minutes......TQSM ❤️❤️❤️❤️
@LokeshSharma-hm5jz
@LokeshSharma-hm5jz Жыл бұрын
Watching previous videos, the moment you said it is related to balanced parenthesis. I got the idea. Thanks
@shubhamkumarjha2653
@shubhamkumarjha2653 3 жыл бұрын
Thanks a lot buddy .😍 Just week ago I can't able to solve simple prb but know I have lot of confidence .
@dewanganumesh11
@dewanganumesh11 4 жыл бұрын
Thanks @AdityaVerma....now i can realized how to approach for recursive problem. Keep up the good work :)
@adityajain5101
@adityajain5101 3 жыл бұрын
Your explanation is best ...better than most of the youtubers out there
@zaidshaikh8111
@zaidshaikh8111 3 жыл бұрын
I watched first two mins and solved the question!!! Aditya Bhaiyya, You are amazing!!!
@DebojyotiMandal
@DebojyotiMandal 4 жыл бұрын
Best playlist on recursion ever !!!!!!
@amayatre3558
@amayatre3558 2 жыл бұрын
Thank you so much Bhaiya , because after following this playlist completely , I was able to solve this question just by reading the problem statement. Hats Off to you Bhaiya ..
@vikasvk9174
@vikasvk9174 4 жыл бұрын
After looking at the problem statement. I solved it myself it only happen bcz of You Big Thank :)
@subrinasirajee530
@subrinasirajee530 3 жыл бұрын
Coded on my own way without seeing the full video. Thanks bro.
@vineeladonthu9266
@vineeladonthu9266 3 жыл бұрын
Thank you so much sir! the way you taught us to approach the problem is very good sir
@ved7678
@ved7678 4 жыл бұрын
Thanks a lot bro for your effort. It's been a great help for me. Just a request can you please make videos on Greedy,backtracking and divide & conqueror
@shaikfahim1232
@shaikfahim1232 3 жыл бұрын
Include graph also
@aashimaa2681
@aashimaa2681 2 жыл бұрын
Thanks Adi! You are the best
@tiyashadas5247
@tiyashadas5247 3 жыл бұрын
I solved a recursion problem on my own :') im not crying you are crying :') Thank you :') 🌻
@codertan4109
@codertan4109 2 жыл бұрын
Thank You so much Aditya! I was able to code by myself!!!
@harshitewari
@harshitewari 7 ай бұрын
As base condition if we take zeroes + ones = n; then we get a segmentation fault. Does anyone know why this happens?
@dhirunand
@dhirunand 2 жыл бұрын
Watched video till 9:50 and coded it, love you brooooo 😍
@mayureebudhe5087
@mayureebudhe5087 3 ай бұрын
You are Kohinoor Boss, amazing skills you have. Take a Bow
@kushgupta6416
@kushgupta6416 3 жыл бұрын
I really liked your way of teaching and keep on building problems based on previous thinking. it helps a lot to grasp concepts. just one suggestion. try to provide a few examples of a problem that requires for loop along with recursion. like print all permutation of array elements.
@aritralahiri8321
@aritralahiri8321 4 жыл бұрын
Your work is really great . No one has ever taught recursion in the same manner you are teaching .You are teaching us how to use a tool so that it can be used whenever necessary .I can say now that I really know recursion , I've solved this problem without looking into your solution . Really grateful for this hard work really appreciate your work bro . Thanks a lot .
@shishirchaurasiya7374
@shishirchaurasiya7374 2 жыл бұрын
Aditya Verma OP!!!!!! Love you so much..
@shyampramanik780
@shyampramanik780 4 жыл бұрын
Great content as always !!
@mayur_madhwani03
@mayur_madhwani03 3 жыл бұрын
Itna sahi samjhaya ki khudse hi code likh liya ❤️
@mohit6215
@mohit6215 Жыл бұрын
I was able to think about it by yours grace❤
@sarvagyaiitmadras8727
@sarvagyaiitmadras8727 3 жыл бұрын
really awesome content.Only one problem in videos me , voice thodi low rhti hai bhai tumhari, mtlb full audio krne pe bhi.
@simply_akh1l
@simply_akh1l 2 ай бұрын
did it on my own, thanks a lot
@laxmangurjar4776
@laxmangurjar4776 3 жыл бұрын
love the way you teach ❤
@LokeshSharmaCP
@LokeshSharmaCP 11 ай бұрын
thanks a lottttt solving recursion que - medium, hard easily after this
@ayanjana2052
@ayanjana2052 3 жыл бұрын
Thanks for the awesome explanation
@priyanjali2857
@priyanjali2857 3 жыл бұрын
Thank you so much for the recursion playlist FINALLY I UNDERSTOOD THE CONCEPT Also please could you also make videos on backtrackingggg Thanks dude!!!!
@ManishKumar-ux5un
@ManishKumar-ux5un 3 жыл бұрын
@Aditya sir you can use pointer mark so that we can see where you are pointing.
@NitinKumar-pl3xl
@NitinKumar-pl3xl 4 жыл бұрын
Thanks Bro for doing this from your heart with one goal to help others. You are doing without any expectation from others. Follow this attitude/simplicity using pen and paper, definitely you will get what you want in life. The good thing is that you are not wasting time in basics(definition etc) the way or approach you are building to solve problem is awesome. Below list is considered as best material for Data Structure and Algorithm there is no comparison of your videos to this. Even your videos are very help full for experience ones also they have to also face first coding round. 1. Cracking the Coding Interview, 6th Edition :Gayle Laakmann McDowell 2. Introduction to Algorithms Third Edition : Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest Clifford Stein 3. KZbin video : Abdul Bari If possible add English subtitles. After that you can see the difference in your video will reach to world wide. Subscribed your channel.
@Vishal-ds6ly
@Vishal-ds6ly Жыл бұрын
thankyou very much sir for awesome playlist on recursion
@parthmittal5625
@parthmittal5625 3 жыл бұрын
Solved on my own!! Unmatched playlist! 🙇🏼‍♂️
@arijitchandra8218
@arijitchandra8218 4 жыл бұрын
thank u for uploading videos like this
@PriyanshuSingh-dt3oz
@PriyanshuSingh-dt3oz 3 жыл бұрын
you deserve 1 million subscribers.🙇🙇
@panavkumar9009
@panavkumar9009 2 жыл бұрын
I can't believe I was able to solve this problem on my own!!
@sureshgadde5113
@sureshgadde5113 4 жыл бұрын
Thank you Bhai, for such a great explanation
@khushh.i
@khushh.i 7 ай бұрын
Sir, thank youuuuuuuu soooo much!!!!!!!
@ShivangiShree
@ShivangiShree 4 жыл бұрын
You are back❤
@RohitGupta-fv1ul
@RohitGupta-fv1ul 4 жыл бұрын
Eagerly Waiting for graph contents
@gulshankumar9118
@gulshankumar9118 4 жыл бұрын
Koi bat nhi bhai jo ha wo bhi ek no. hai......
@TheAdityaVerma
@TheAdityaVerma 4 жыл бұрын
Thanks brother, making videos is easy, but dealing with these issues (hissing sound/low audio) is really a headache 😓😓Now I know how hard these other quality youtubers work.
@gulshankumar9118
@gulshankumar9118 4 жыл бұрын
@@TheAdityaVerma keep it up!! brother.......u will find a sol^n.....u could take help of other youtubers too.....
@randomthoughts3533
@randomthoughts3533 4 жыл бұрын
Hey Adi did it again thanx to you buddy
@gamerhu7462
@gamerhu7462 3 жыл бұрын
i did it myself yaass Yaar ye banda kitna awesome hai!!
@chetanpandey8722
@chetanpandey8722 3 жыл бұрын
void solve(int n, string res, vector &vec, int ones=0, int zeros=0){ if(n == 0){ if(ones>=zeros){ vec.push_back(res); } return; } solve(n-1, res+"1", vec, ones+1, zeros); if(!res.empty()) solve(n-1, res+"0", vec, ones, zeros+1); } vector NBitBinary(int N) { // Your code goes here string str; vector st; solve(N, str, st); return st; } I was trying this for the above question but its giving output limit exceeded. Can someone suggest where I am going wrong
@046_krishnarajchouhan9
@046_krishnarajchouhan9 4 жыл бұрын
Desh ki tarakki ke liye ye tumhara ye andaj bhot pasand aayaa bhai bhot hard...........thank you so much bhai.
@shibanidas7018
@shibanidas7018 3 жыл бұрын
Finished without seeing the solution !!! public void generate(String op, int n0, int n1, int N, ArrayList list){ if(n0 + n1 == N){ list.add(op); return; } String op1 = op + "1"; generate(op1, n0, n1-1, N , list); if(n0 > n1){ String op2 = op + "0"; generate(op2,n0-1,n1,N,list); } }
@bhumikasharma5033
@bhumikasharma5033 3 жыл бұрын
Great explanation
@UCS_B_RishiRajTiwari
@UCS_B_RishiRajTiwari 3 жыл бұрын
Awesome Content... Now recursion has become cakewalk for me...
@Prateek_Mantry
@Prateek_Mantry 9 ай бұрын
thank you.
@bhairavas2528
@bhairavas2528 3 жыл бұрын
Java Solution. A bit different from Aditya's approach public static void solve(int one,int zero,int n,String output) { if(n==0) { System.out.println(output); return; } if(one == zero) { String op1 = output; op1+="1"; solve(one+1,zero,n-1,op1); }else { String op1 = output; String op2 = output; op1+="1"; op2+="0"; solve(one+1,zero,n-1,op1); solve(one,zero+1,n-1,op2); } }
@sohel-tamboli
@sohel-tamboli 4 жыл бұрын
Thank You So much bro for this playlist it is really improving my problem solving skills. Because of You, I am able to solve last parenthesis and this problem and other many problems without seeing Logic . Thank You So Much For great video series......
@aniketbhoite7168
@aniketbhoite7168 3 жыл бұрын
Thank you...we can literally solve these problems with nearly same functions...just little bit change n no need to see the video as well
@princekumar-wt7ne
@princekumar-wt7ne 3 жыл бұрын
If any know resources like this on backtracking. Please let us know
@balidinesh5687
@balidinesh5687 4 жыл бұрын
bro ..plzz explain any question which includes for loop in the recursion function
@aakash4771
@aakash4771 2 жыл бұрын
cpp code //Print N-bit binary numbers having more 1’s than 0’s for any prefix #include using namespace std; void solve(string output,int one ,int zero,int n){ if(n==0){ cout
@devgupta9469
@devgupta9469 4 жыл бұрын
Please make videos on graph. I keep forgetting its algorithms
@AP-bk8vq
@AP-bk8vq 4 жыл бұрын
I was waiting for this🔥 Thanks sir and please try to upload videos on GRAPH!
@harshthakur9890
@harshthakur9890 2 жыл бұрын
legend of algorithms.
@nikhilanand984
@nikhilanand984 3 жыл бұрын
if(ones
@derilraju2106
@derilraju2106 2 жыл бұрын
class Solution: def NBitBinary(self, N): # code here self.N = N self.sol=[] self.recursion(0,0,"") return sorted(self.sol)[::-1] def recursion(self,ones,zeros,op): if len(op) == self.N: self.sol.append(op) return if zeros + 1
@codewithsachendra7090
@codewithsachendra7090 4 жыл бұрын
Waiting for backtracking😍
@SaurabhSingh-ph2ry
@SaurabhSingh-ph2ry 3 жыл бұрын
But haven't got 🥲
@animeshbarole
@animeshbarole 2 жыл бұрын
Code with my Own ,Thnx Man
@krishparmar7917
@krishparmar7917 Жыл бұрын
awesome video bro 💙💙. pr saath me time complexity bhi bta diya kr.
@aryachaudhary1118
@aryachaudhary1118 3 жыл бұрын
``` int n; void bin(string s , int o , int z) { if(o+z==n) { cout
@shrishtysrivastava9282
@shrishtysrivastava9282 4 жыл бұрын
Best content 👍 Please make series on graph and hashing.
@issacholmes2475
@issacholmes2475 3 жыл бұрын
Isn't there is need for a negative base case : if zeros > ones: return
@nimishgupta5289
@nimishgupta5289 28 күн бұрын
Just watched 2 mins of the video and I'm sensing it similar to generate all balanced parenthesis. Not sure, I may be wrong, lets see what happens next Damn... I was right, able to do this question.
@mdumarhabib5341
@mdumarhabib5341 4 жыл бұрын
Is video me bhai ne "cool" kam bola ... XD
Josephus Problem | Game of Death in a circle | Execution in Circle
33:56
Generate all Balanced Parentheses
34:03
Aditya Verma
Рет қаралды 153 М.
Война Семей - ВСЕ СЕРИИ, 1 сезон (серии 1-20)
7:40:31
Семейные Сериалы
Рет қаралды 1,6 МЛН
$1 vs $500,000 Plane Ticket!
12:20
MrBeast
Рет қаралды 122 МЛН
9 Largest number in K swaps
36:47
Aditya Verma
Рет қаралды 19 М.
First Negative Number in every Window of Size K | Sliding Window
32:17
Kth Symbol in Grammar
23:32
Aditya Verma
Рет қаралды 127 М.
The Doomsday Algorithm - Numberphile
14:33
Numberphile
Рет қаралды 858 М.
one year of studying (it was a mistake)
12:51
Jeffrey Codes
Рет қаралды 231 М.
How to Remember Everything You Read
26:12
Justin Sung
Рет қаралды 3,1 МЛН
Lecture 69: Print N-bit binary numbers having more 1s than 0s
31:54