Hi love..pls add subtitles for ur video.. Last three DSA course videos doesn't have subtitles.. It wud b really helpful for people like me who doesn't know hindi
@mohitraj19952 жыл бұрын
I m in lecture 5🙂 I want complete fast to cover and see daily wise latest update
@ashutosh612902 жыл бұрын
@Devesh bhai wo bhi insaan hai.. thoda unke bare me bhi socho. itna speed toh video daal rhe hai.. ab kya ek din me 5 video daal de tumhare liye.
@nehasharma6171 Жыл бұрын
circularlly linked ka ques code studio pe is logic se karne se saare test cases ren nhi horhe h . 😔
@anishtripathi38004 ай бұрын
Watching this in July 2024.. still the best lecture series, and I will complete it all. To the people watching it, I request you to not watch it from the middle if you're a beginner. I had consistently watched it from lecture 1, and trust me, this will help you pass with flying colors.
@feagy9 ай бұрын
FOR EVERY ONE DOING IT NOW TEST CASE HAS BEEN CHANGED ...current code will work after doing little bit change HERE IS THE CORRECT CODE int getlength(Node*head,int k){ int c=0; while(head!=NULL){ c++; head=head->next; } return c; } Node* kReverse(Node* head, int k) { // Write your code here. //base case if(head==NULL){ return NULL; } Node*prev=NULL; Node*curent=head; Node*forward=NULL; int c=0; while(curent!=NULL && cnext; curent->next=prev; prev=curent; curent=forward; c++; } // if(forward!=NULL ){ // head->next=kreverse(forwars,k); if(getlength(forward,k)>=k){ head->next = kReverse(forward, k); } else{ head->next=forward; } } return prev; }
@mannan71267 ай бұрын
thanks man :))
@manavgupta15585 ай бұрын
Only adding getlength on base condition can give correct answer i.e. int getlength(ListNode* head){ int n=0; ListNode* temp = head; while (temp!=NULL) { temp=temp->next; n++; } return n; } ListNode* reverseKGroup(ListNode* head, int k) { if(head==NULL || getlength(head)next=prev; prev=curr; curr=temp; cnt++; } if(temp!=NULL) head-> next= reverseKGroup(curr,k); return prev; } hope so its easier to understand.
@aviii24x74 ай бұрын
After 2 hours of trying, you helped htanks!!!
@khushigupta17834 ай бұрын
what change has been made to the question now?can anyone tell..is it that the nodes out of the k value left at end will be left as it is?
@aviii24x74 ай бұрын
@@khushigupta1783 The node that left (less than k) should not be affected, changes to be applied only if next k nodes are availbale
@viral_plays10812 жыл бұрын
Dheerr sarreee bde se bdee youtube channels, but apki energy and way of teaching.....MIND BLOWING!!!!
@ninjahattori41012 жыл бұрын
NIce Explanation Keep the josh high, we are with you following the course from the very start video
@sauravdhar16962 жыл бұрын
Completing the first phase in depth but still watching the videos that you upload daily taaki aapka motivation na down ho bhaiyya ....awesome work (march tak khatam kar denge sab kuch)
@snipper66832 жыл бұрын
konse year may ho bhai!
@AS-gf3ci Жыл бұрын
For Leetcode : (Only slight changes to this video's solution) int getLength(ListNode* head) { int length = 0; ListNode* temp =head; while(temp != NULL) { length++; temp = temp -> next; } return length; } ListNode* reverseK(ListNode* &head, int k, int length) { //Base case if(head == NULL || head -> next == NULL || k == 1 || length < k) return head; //Step 1 : Reverse first k nodes ListNode* nxt = NULL; ListNode* curr = head; ListNode* prev = NULL; int count = 1; while(curr != NULL && count next; curr -> next = prev; prev = curr; curr = nxt; count++; } //Step 2 : Reverse next k nodes using recursion if(nxt != NULL) { head -> next = reverseK(nxt, k, (length - k)); } //Step 3 : Return head of the reversed linked list head = prev; return head; } ListNode* reverseKGroup(ListNode* head, int k) { int len = getLength(head); return reverseK(head, k, len); }
@shantanumore5396 Жыл бұрын
thanks much needed!
@dreamy4174 Жыл бұрын
Getting difficulty in recusion problems .Any suggestion 🥺
@vakeelsaab5485 Жыл бұрын
@@dreamy4174 spend more time on recursion dry run
@meetmakwana34279 ай бұрын
Thanks a ton MVP
@motives7487 ай бұрын
bro the length function is much needed without it the solution gives wrong ans thanks
@RedSpade01 Жыл бұрын
APPROACH For anyone stucking in cases in codestudio or leetcode, the problem is this code reverses even if k is greater than remaining numbers, so you gotta check the size in every recursion(basically in one case your working), then mark k>size{return head}, this will do the job. edit: I will post my edited code but try once yourselves its easy
@tejasshinde7236 Жыл бұрын
Thanks
@rohitss671 Жыл бұрын
yes i also found that after reading the question i understand what to do ---
@Sukoon_3000 Жыл бұрын
thanks but was stuck for 1 hr
@PrajjvalMishra-g5f Жыл бұрын
thanks
@RedSpade01 Жыл бұрын
@@Sukoon_3000 No prob buddy, I was stuck for an hour here too😅
@deeppatel05862 жыл бұрын
Babbar sir, love your content. told many friends about this course. Infinite gratitude from my side :)))))))))
@RahulKumar-ye2iy2 жыл бұрын
This code will reverse every elements in group even if the no. of elements in one group is less than k. So, here's the updated code which will take care this condition. class Solution { public: ListNode* _reverseKGroup(ListNode* head, int size, int k){ if(head==nullptr || sizenext=prev; prev=cur; cur=next; count++; } head->next=_reverseKGroup(next, size-k, k); return prev; } ListNode* reverseKGroup(ListNode* head, int k) { int size=0; ListNode* temp=head, *root; while(temp!=nullptr){ temp=temp->next; size++; } return _reverseKGroup(head, size, k); } };
Bhaiya excellent work, after 5 months i am seeing these videos but this is one of the really nice explained content i have got ,even after seeing 1-2 paid courses i can say this clearly that this is best and keep up good work babbar bhai
@daiict22822 жыл бұрын
Easiest solution of k reverse hats off bhaiya kya smjhaya ha apki wahaj sa kitna bacho ka future secure ho raha ha
@kaushikjain96972 жыл бұрын
Babbar sir, love your content. told many friends about this course. Infinite gratitude from my side
@sakshamgarg56382 жыл бұрын
Keep the josh high, we are with you following the course from the very start video
@harshjain79452 жыл бұрын
Your way of teaching is unmatchable sir! Big fan of you sir!
If anyone doing now is getting stucked in some test cases, then the updated code is here : Node* kReverse(Node* head, int k) { int size = 0; Node* temp = head; while(temp!=NULL){ temp = temp -> next; size++; } if(size < k)return head; // just add this new part in code so that, when number of nodes is not a multiple of k, the left over ones are not to be reversed. if(head == NULL){ return NULL; } // step 1: reverse first k nodes Node* prev = NULL; Node* curr = head; Node* next = NULL; int count = 0; while(curr != NULL && count < k){ next = curr -> next; curr -> next = prev; prev = curr; curr = next; count ++; } // step 2: recursion if(next != NULL){ head -> next = kReverse(next, k); } // step 3: return head return prev; }
@Anshucc Жыл бұрын
nice edge case pass ho gye badhiya code logic
@aditighate7191 Жыл бұрын
@@Anshucc Thank you!
@ankitgaur7428 Жыл бұрын
Thanks bro
@simplesolutions26212 жыл бұрын
Excellent going, bhaiya!! Keep the Josh High!!! Hum SAATH HAI!!❤ Thode din ka gap ho sakta hai..to cover up and do more questions from previous videos!! 👍
@samaysarah74172 жыл бұрын
Dhanyawaad bhaiya iss course ke liye....
@investwithus92712 жыл бұрын
Daily video chahiye... We support you... Completed video
@siddharthsingh5510 Жыл бұрын
In question 1: reverse linked list in k groups, this is O(1) space complexity and O(n) time complexity code which i written myself: Passed all the testcases. Node* kReverse(Node* head, int k) { Node* curr = head; Node* prev = NULL; Node* forward = NULL; int j=0; Node* ultimatehead = NULL; Node* mogambo = NULL; while(curr!=NULL){ Node* tempo = curr; int i=1; while(inext; prev = curr; curr = forward; i++; } else{ forward = curr->next; curr->next = prev; prev = curr; curr = forward; i++; } } if(j==0){ ultimatehead = prev; tempo->next = curr; prev = tempo; mogambo = tempo; j++; } else{ mogambo->next = prev; tempo->next = curr; prev = tempo; mogambo = tempo; j++; } } return ultimatehead; }
@arncs55872 жыл бұрын
Class ase chalraha he ki may be meri break failure ho jayega 😂😂😂👍👍👍 thanks bhai continue ......❤️❤️ Lot of love from Amosh ....❤️❤️❤️
@srivathsav4587 Жыл бұрын
For leetcode you have to stop if there are less than k nodes: Just add this after your, if(head==NULL) condition: ListNode *d=head; for(int i=0;inext; }
@maidaiftikhar6901 Жыл бұрын
could you please explain the logic for this?
@AkshatChaudhary-fe3vv Жыл бұрын
Bro check LL is giving TLE in coding studio 😢
@naitik5542 жыл бұрын
Bhaiya hum dekhte hain aap banate jaaye.... Josh is always high because of you and your consistency.... Thank you bhaiyaa....😊😊
@Nishankjain-cw4jh4 ай бұрын
question 1 contains one more base condition that if the length is less than k than return rest of the LL as it is here is the enhanced code /** * Definition for singly-linked list. * class Node { * public: * int data; * Node *next; * Node() : data(0), next(nullptr) {} * Node(int x) : data(x), next(nullptr) {} * Node(int x, Node *next) : data(x), next(next) {} * }; */ Node *kReverse(Node *head, int k) { if (head == NULL) return head; int len = 0; Node *check = head; while (check != NULL) { len++; check = check->next; } if (len < k) { return head; } if (head == NULL) { return NULL; } // step1: reverse first k nodes Node *prev = NULL; Node *curr = head; Node *next = NULL; int count = 0; while (curr != NULL && count < k) { next = curr->next; curr->next = prev; prev = curr; curr = next; count++; } // step2: Recursion dekhlega aage ka if (next != NULL) { head->next = kReverse(next, k); } // step3: return head of reversed list return prev; }
@GaneshBhutekar-nu1gd3 ай бұрын
bro tu knse year main hain
@AbhishekVerma-gg4hf2 жыл бұрын
Bhaiya aap ka hi Sahara hain ..aap kyu apna motivation down kr rahe ho . We are with you🤝
@@neerajmahapatra5239 it works because every time when we call next reverseKGroup function. first we count remaining nodes and if remaining nodes is greater than or equal to K then we only reverse that group if it is less than K then we simply return head means no need to reverse further. Hope you understand.
@111rhishishranjan2 Жыл бұрын
Post leetcode code for circular linkedlist or not
@parthibbanerjee5994 Жыл бұрын
@@sambhavsharma2780 for i/p : 1 2 3 4 5 and k = 3......after the reversal of (1, 2, 3) when it comes to the recursion part for (4, 5), countnodes=2..... so (countnodes >= k) condition becomes false right??....then in that case how reversal of (4, 5) is happening?? can u pls explain this!!
@rakshitgupta1771 Жыл бұрын
@@parthibbanerjee5994 do this little change in it.... node *reversek(node *head, int k) { if (head == NULL) { return NULL; } node *temp = head; int cntnodes = 0; node * ans = NULL; while (temp != NULL) { cntnodes++; temp = temp->next; } if (cntnodes >= k) { node *forw = NULL; node *curr = head; node *prev = NULL; int cnt = 0; while (curr != NULL && cnt < k) { forw = curr->next; curr->next = prev; prev = curr; curr = forw; cnt++; } if (forw != NULL) { head->next = reversek(forw, k); } ans = prev; } else return head; return ans; }
@sounaksaha14552 жыл бұрын
Ennnnnnnnnerrrrrrrrggggy!!!!! Bhaiya aap video laate rahiye....... hum placement leke hi manenge.
@amandwivedi9762 жыл бұрын
Bhaiya abhi mai lecture 20 pe hoon, Attendence marked thnq so much for awesome videos
@AbhishekVerma-gg4hf2 жыл бұрын
Bhaiya aap lage raho hm log aap k saath hain
@SriniVas-mx1li2 жыл бұрын
Bhai tuuu... humra pyaar hi ♥️ Attendance from Andhra Pradesh 🥳🥳🥳
@anuragpandey81652 жыл бұрын
39:54 Bhai dekh rahe hai hamesha.... Like bhi krre hai...... Roz video chahiye
@prishasureja52802 жыл бұрын
woaahhh sir pls keep uploading we are watching this series regularly!!!!!
@ekengineer98682 жыл бұрын
Bhaiyaa ji consistency op🔥 And don't get disappointed by less comments it is because many of us are left with previous lectures 🥲
@sabhavathyashwanth91452 жыл бұрын
Hello sir I'm a btech 1st year student of it branch. I'm done with C and wanted to switch to C++. Kya mein es playlist ko follow kar sakta hun ya should I see other playlist like whole C++ lectures as esme DSA bhi included hai na. Please suggest me
@_MadhviSharma2 жыл бұрын
@@sabhavathyashwanth9145 you can follow this series, it would be really helpful for you. And in 3rd sem there is dsa subject, so you can prepare it smoothly.
@sabhavathyashwanth91452 жыл бұрын
@@_MadhviSharma thanks mam for your reply Mam which lang. is better for DSA C or C++. As per my clg syllabus we have DSA subject right in 2nd sem and OOPS in 3rd sem and prof. teaches us in C it seems
@cyberserker2 жыл бұрын
@@sabhavathyashwanth9145 Start with C and switch to C++ after you've done the Basic Data structures in C , that way your college syllabus will get covered. BTW C and C++ are not very different so you wont face any problems! :D
@_MadhviSharma2 жыл бұрын
I had just completed the first phase of this series..thank you so much sir for such content. Please provide handwritten notes from 6th lecture onwards.
@sounaksaha14552 жыл бұрын
6th aur 7th ka aa gaya hai ji....... dekh lijiye
@_MadhviSharma2 жыл бұрын
@@sounaksaha1455 thank you!
@sidtech102 жыл бұрын
@@sounaksaha1455 handwritten notes kaha hai🤔
@udaypratapsingh89232 жыл бұрын
bhaiyaa aapka course dhoom machane vaala hai ...
@akashdeepmaity639 Жыл бұрын
Taking 100 days DSA challenge from here on and going to comment in next videos everyday after completion........ Day -1 :: Completed
@ravivishvas36762 жыл бұрын
Incomparable efforts 🔥
@sounaksaha14552 жыл бұрын
Love you bhaiya... Hope everyone will get their dream placement
@manishabose8012Ай бұрын
To those watching this video after this comment has been posted: the question 'Reverse List in K Groups' has been changed by CodingNinja (not sure why they did it). The solution in the video won't work completely; you need to reverse it again if the last group has fewer than k nodes to restore the original order. So, you’ll need to add a few more lines of code. Code: Node* kReverse(Node* head, int k) { int cnt = 0; Node* curr = head; Node* prev = nullptr; Node* fwd = nullptr; while (curr!=nullptr && cnt < k) { fwd = curr->next; curr->next = prev; prev = curr; curr = fwd; cnt++; } //You need to add this; Note: I have used the variable name fwd instead of next. if(cntnext = prev; prev = curr; curr = fwd; cnt++; } } //Till here if(fwd != nullptr){ head->next = kReverse(fwd, k); } return prev; }
@tjstar3902 жыл бұрын
Thank you bhaiya for giving fabulous content as both Question are very easy to understand.
@pushkarchaubey83002 жыл бұрын
bhut badhiya vedio tha bhaiya mazza aa gaya ekdamm mst smjh me aaya LL
@saiyamanand13872 жыл бұрын
Maaza aa rha hai karke coding ab bohot sahi chl rha hai sab jaldi jaldi bna do Bhaiya video ab
@aryanrathi1843 Жыл бұрын
After surfing many other youtube vedios , I watched this Vedio and the explaination of the first question in the vedio told by bhaiya is crystal clear. Crazyy!! and thanks for this kind of in-depth explaination it became like an very easy problem for me now.
@parassetia49642 жыл бұрын
Lec 46 done...consistency op
@kaushalkumar012 жыл бұрын
Thanks bhaiya....mza aa gya🔥🔥🔥🔥 Aapki yhi consistency hi to motivation hai hmare liye... Aise hi vids bnate rho bhaiya💜
@srajittanwar6362 жыл бұрын
PRESENT BHAIYA ,aap bhi josh high rakho humara bhi high h
@ln-gamer9496 Жыл бұрын
BHAIYA YOU ARE MY BEST TEACHER
@code___with___me Жыл бұрын
in this question one case is missing like if the K is greater then the no. of elements in the linkedlist so we also need to count the elements in the linked list and have to made a condition that if(k>no. of elements in the linkedlist )then we will return head Node* kReverse(Node* head, int k) { if(head==NULL){ return NULL; } Node* prev=NULL; Node* forward=NULL; Node* curr=head; //checking whether the size of k is smaller then the size of the linkedlist int counter=0; Node* temp=head; while(temp){ temp=temp->next; counter++; } int count=0; if(k>counter){ return head; } while(curr && countnext; curr->next=prev; prev=curr; curr=forward; count++; } if(forward){ head->next=kReverse(forward,k); } return prev; }
@vikramlucky928 ай бұрын
you can add another case to this part for little improvement: while(temp and counter < k){ temp=temp->next; counter++;
@ThePrajaktaVlogs2 жыл бұрын
dekh rahe hai bhaiyya ! aur maja bhi aa rha h : )
@culeinfo30582 жыл бұрын
yes keep uploading daily. love ur content
@makkar.ankush Жыл бұрын
code for submission without errors regarding lenght less then k ``` Node* kReverse(Node* head, int k) { //base call if(head == NULL) { return head; } //step1: reverse first k nodes Node* next = NULL; Node* curr = head; Node* prev = NULL; int count= 0; // *ADDITIONAL CODE* // check if k nodes are available int check= 0; Node* Chk = head; while( Chk != NULL && check < k ) { Chk = Chk->next; check++; } // if not available then return head without reversing if(check != k){ return head; } // else reverse while( curr != NULL && count < k ) { next = curr -> next; curr -> next = prev; prev = curr; curr = next; count++; } //step2: Recursion dekhlega aage ke nodes ko // aur usko jod do pehle vale k sath if(next != NULL) { head -> next = kReverse(next,k); } //step3: return head of reversed list return prev; } ```
@scoc55vora15 Жыл бұрын
Very Detailedfully Explained Bhaiya on the Entire youtube
@RohitRana-tz2lr2 жыл бұрын
Thanks bhaiya for your videos... crossed 50 videos... consistency++... mja aara h bhaiya
@nikhildhiman07142 жыл бұрын
Bhiya apka motivation high h tabhi Mera bhi . App 3 video bno ge ma 3 hi dakh luga🥰🥰🥰
@shashnka Жыл бұрын
haaaaard love bhai watched till end🗣🗣
@ellis-pr7hh2 жыл бұрын
i wish and hope that your channel will grow more faster and aapka dsa course best dsa course over youtube consider kiya jaya (though i already consider that bt this course needs to be reached to lot of people) thank you for this course>>
@rajatjana Жыл бұрын
For Leetcode: class Solution { public: ListNode* reverseKGroup(ListNode* head, int k) { if(head==NULL){ return NULL; } ListNode* next=NULL; ListNode* curr=head; ListNode* prev=NULL; int c=0; while (curr != NULL && c< k) { curr = curr->next; c++; } if (c < k) { return head; } curr = head; c = 0; while(curr!=NULL&&cnext; curr->next=prev; prev=curr; curr=next; c++; } if(next!=NULL){ head->next=reverseKGroup(next,k); } return prev; } };
@nana_patekar_ Жыл бұрын
we can also solve circular LL question using Floyd's cycle detection bool isCircular(Node* head){ // Write your code here. //if head is NULL if(head==NULL) return true; //ony 1 node if(head->next==NULL) return false; Node *fast=head; Node *slow=head; while(fast->next!=NULL){ fast=fast->next; if(fast!=NULL) fast=fast->next; slow=slow->next; if(fast==slow && fast ==head) return true; else if(fast==slow && slow!=head) return false; if(fast==NULL){return false;} } return false; }
@RitikSingh-oh3sj2 жыл бұрын
bhaiya iss lecture mai maga aa gaya bhaiya kaya mast code tha bahiya
@computerguy3550 Жыл бұрын
Thanks Alot bhaiya Ek Number Content👌👌👌👌
@prathammadhani43722 жыл бұрын
Attendance marked....thanks bhaiya for love babbar contest 4
@RahulKumar-wt9qc2 жыл бұрын
Video banaiye love bhaiya hum log dekh rahe hai ❤️❤️👍👍
@krishnendubanerjee85232 жыл бұрын
What if the list is: 1,2,3,4,5 and k=3. This approach won't work. Output should be: 3,2,1,4,5. But it will give you: 3,2,1,5,4
@karankaran19162 жыл бұрын
you can compare the length with k at start
@kunalboxer4432 Жыл бұрын
It will work try trail run
@sukhendubanerjee5082 Жыл бұрын
@@karankaran1916 but on calculating the rest part of LL we want to use loop then what will be the time complexity? Plzz explain and what will be the code ...
@anmol3 Жыл бұрын
@@karankaran1916 thanks bro
@meghaiiitd4586 Жыл бұрын
You can count the remaining elements from current, ListNode* remaining=curr & count=0; then if count>=k (recursion) else head->next=curr.
@Josuke2176 ай бұрын
map can also be used , if freq of a node is 2 then it's circular linked list.
@Harshji2492 жыл бұрын
Great video for linked list question
@manojalladawar22622 жыл бұрын
Done wih previous lecture and i'm with your phase. Full dedicate hai thanks for this amazing series. Thank you bhaya.
@bheemsingh-fh1zu2 жыл бұрын
Bhaiya please daily video laado🥺🥺 Placement aapke bharoshe h. Mujhe aapse hi pdhna h😁
@sanskritiagrawal59602 жыл бұрын
Bhaiya bas aise hi padhao bhot sahi chal raha h
@anushreepaul53082 жыл бұрын
raat ke 01.38 baj rhe hai.. still mai code kar rhi.. because of you vaiya.. 😁😁 Thank you sooo much :)
@arjunyadav-kt5jr2 жыл бұрын
V kyu lagate ho be tumlog, bh ki jagah pe?
@gouravmuchhal1985 Жыл бұрын
i dont know how he breakdown things in so simple ..
@akash.vishwakarma9 ай бұрын
For those who don't have to reverse when length < k int getLength(Node* head) { int length = 0; while(head != NULL) { count ++; head = head -> next; } return length; } Node* kReverse(Node* head, int k) { if(head == NULL || head -> next == NULL) { return head; } if(getLength(head) < k) { return head; } Node* prev = NULL; Node* curr = head; int count = 0; while(curr != NULL && count < k) { Node* forw = curr -> next; curr -> next = prev; prev = curr; curr = forw; count ++; } head -> next = kReverse(curr, k); return prev; }
@iEntertainmentFunShorts2 жыл бұрын
Completed this lecture also aap jab circular list wala bta rhe thy toh mere mind m aaya tha ki yei loop bhi ho sakta h yaha pr (mtlb logic bnna start ho gya h bhaiya ) then Floyd's ka toh pta ni muje but hash map se solve ho jayega woh...Floyd's dekhuga ab sayad graph m Maine warshall , Dijkstra and Floyd's pdi h wahi hogi...
@amarnathprajapati2543 Жыл бұрын
39:58 Bahut energy hai Sirji😂😂
@mananupmanyu5440 Жыл бұрын
Updated code for reverse K nodes on @leetcode 30/30 test cases passed Node* kreverse(Node* &head,int k) { // base case if(head == NULL) { return NULL; } Node* curr = head; Node* prev = NULL; Node* forw = NULL; int cnt = 0; while( curr != NULL && cnt < k){ forw = curr->next; curr -> next = prev; prev = curr; curr = forw; cnt++; } // if the forward list's length is less than k than we simply // join the original list to the head if(getlength(forw) < k){ head->next = forw; } else if (forw != NULL && getlength(forw) >= k){ head -> next = kreverse(forw,k); } return prev; }
@priyanshusahoo82666 ай бұрын
We can also use concept of two pointers to check the circular LinkedIn list
@devsood12Ай бұрын
updated solution for Q1 int sizeLL(Node *head) { Node*temp = head ; int cnt = 0 ; while (temp !=NULL ) { cnt ++ ; temp = temp->next ; } return cnt ; } Node* kReverse(Node* head, int k) { // Write your code here. int size = sizeLL(head ) ; Node * prev = NULL ; Node * curr = head ; Node * next = NULL ; int cnt = 0 ; if ( head == NULL || head -> next == NULL || k == 1|| size < k) { return head ; } while (curr!=NULL && cnt < k ) { next = curr->next ; curr->next = prev ; prev = curr ; curr = next ; cnt ++ ; } if (next != NULL ) { head->next = kReverse(next, k) ; } return prev ; }
Dekhte Dekhte video bhai itni aage pahunchgaye ! :)
@absarahmad86252 жыл бұрын
Bhaiya becuase of uh finally i learn how to think how to improve logic. thnx bhaiya
@bhavingargyt Жыл бұрын
dekh rhe hai sir abhi bhi or khatam karke hi rahunga .... 🌟
@aparnamanna13692 жыл бұрын
Attendance marked , chalo lecture dekh te hai
@rawat_ji51832 жыл бұрын
nice explanation bhaiya easy to understand 😁😁
@somesh19342 жыл бұрын
Present Bhaiya..... And thanq bhaiya but bhaiya aap ek he video daalo ek din ki kyonki doosri studies bhi rehti hai for example agr me meri he baat krun toh me python full stack k liye react,django vgera bhi pd rha hn toh mujhe unki bhi practice krna hoti hai toh load bht bd jata hai but haan first priority aapke liye hain then python full stack k liye so bhaiya bus.....Me toh mere point of view se bta rha hn jo baaki dusro ko accha lge ek din ki kitni video? majority wins.... And thanq so much bhaiya for the video....Waiting for the next video.....
@be_happy84112 жыл бұрын
bhayia main aaj k aaj ll khtm krna chahta hoon , currently 3 videos dekhli hain ab 4th start krne wala hoon. Motivation bnaye rkhne k liye aage ki hr video complete krke comments mein aapko msg kroonga 🥲, btw boht badhiya padha rhe ho aap😀👍
@Bhagwati_Jewellers.2 жыл бұрын
Bhaiya mjaa aa rha h 🙌
@rpgaming757 Жыл бұрын
Thanks bhaiya , this video is very helpfull for me
@suranjandhara75352 жыл бұрын
Aa gya hu bhaiya...... Present bhaiya 🤗🤗🤗🤗🤗🤗 Kal contest hai.....Accha nhi hoga pata hai... Firbhi dunga...😔😔😔😔😔😔 1 week follow kar raha hu bhaiya...🤗🤗🤗🤗🤗🤗🤗🤗😊😊😊😊😊 Love you bhaiya.... Amazing 😍😍😍😍😍 content
@adityasahoo506Ай бұрын
My Solution : whenever length>k from there we call a function to calculate remaining length. if remLenght>=k then we use recurrsion. otherwise just add head->next to curr ; class Solution { public: int calc(ListNode* curr){ int count = 0 ; while(curr!=NULL){ count++; curr = curr->next; } return count; } ListNode* reverseKGroup(ListNode* head, int k) { int length = 0 ; ListNode* prev = NULL; ListNode* curr = head ; ListNode* next = NULL; while(lengthnext; curr->next = prev ; prev = curr ; curr = next ; length++; } head->next = curr; int remLength = calc(curr); if(remLength >= k ){ head->next = reverseKGroup(next , k ); } return prev; } };
@04adarshsingh472 жыл бұрын
your way of explanation is really Good ❤
@abhishekjha03039 ай бұрын
Nice explanation bhaiya!
@Shantanu_Jod2 жыл бұрын
Following The course! 😄
@dewanshyadav60332 жыл бұрын
Thanks bhaiyya 🙏🙏🙏🙏...
@AnuMessi102 жыл бұрын
Do not stop bhaiya, lecture 37 par hu, will catch up soon