Reverse Nodes in k-Group (NO EXTRA SPACE) | EP 12

  Рет қаралды 22,492

Fraz

Fraz

Күн бұрын

Lecture Notes: leadcoding.in/...
Watch the complete Linked List Series • Linked List Series
Crio.Do
Get 10% discount Crio.do www.crio.do/red...
Question (codestudio) bit.ly/3u2fYgH
Question (leetcode) leetcode.com/p...
Placement Preparation Roadmap • Roadmaps for Placement
Hi, I am Fraz.
I am Software Engineer working at Curefit and I love teaching.
This is my Channel where I upload content related to Interviews and my personal experiences.
My contact details
Instagram :- / frazmohammad
Connect with me on LinkedIn :- / mohammad-f-bb4886157
Telegram Group t.me/LeadCoding

Пікірлер: 80
@kritarthsharma3126
@kritarthsharma3126 2 жыл бұрын
Amazing content Faraz. Enjoying every bit of your work and learning through the series. Keep up the good work 🔥👍
@mohammadfraz
@mohammadfraz 2 жыл бұрын
Thank you so much. I hope you understood this lecture too
@garrycranston4606
@garrycranston4606 2 жыл бұрын
Huge thanks to fraz Bhaiya for providing this series probably one of the best sereis on Linked List. Thanks
@abdulrehmanamer4252
@abdulrehmanamer4252 Жыл бұрын
Amazing content Fraz. A beginner can understand these things easily as you broke the things into the simpler terms.....
@dhirajaswani4343
@dhirajaswani4343 2 жыл бұрын
Thanks, @FRAZ for this wonderful explanation. Here is my code for the same question, would really appreciate it if you would review it, Thanks. Language: JAVA class Solution { public int computeLengthOfList(ListNode head){ ListNode temp = head; int size = 0; while(temp != null){ size++; temp = temp.next; } return size; } public ListNode reverseKGroup(ListNode head, int k) { if(head == null || head.next == null) return head; if(k == 1) return head; int l = 1; int r = k; ListNode dummy = new ListNode(-1); dummy.next = head; ListNode nodeBeforeSubList = dummy; ListNode left = head; int lengthOfLL = computeLengthOfList(head); int NumberOfTimesToReverseGroups = lengthOfLL/k; for(int i = 0; i < NumberOfTimesToReverseGroups; i++){ while(l < r){ ListNode nodeToBeExtracted = left.next; left.next = nodeToBeExtracted.next; nodeToBeExtracted.next = nodeBeforeSubList.next; nodeBeforeSubList.next = nodeToBeExtracted; l++; } nodeBeforeSubList = left; left = left.next; l = 1; } return dummy.next; } }
@sakshammaheshwari6542
@sakshammaheshwari6542 2 жыл бұрын
well done bro 👏
@sowdub9445
@sowdub9445 Жыл бұрын
can you pls tell how dummy got the address of the new head ?
@ShyamalDas-kd5vt
@ShyamalDas-kd5vt 2 жыл бұрын
God of linked list🔥🥰
@syedFAHIM-el1wr
@syedFAHIM-el1wr Жыл бұрын
really ab yeh video samajh aya(no extra space wala),kafi sari dekhi, lekin clear nhi ho rhe the wo intution . koi yeh nhi bataya ki hum aisa kar kyu rhe h , really samajh gya Thanks for help bas logic and intution clear ho jaye to code to bas halwa hai
@rydham8252
@rydham8252 2 жыл бұрын
A big thanks to you for this series. I really appreciate your efforts and your way of teaching. Thank you :)
@Idgaffffffffffffffffboi
@Idgaffffffffffffffffboi 2 жыл бұрын
Kardiya sir Like aur Thank you so very much for these videos Love you sir ,Office ka kaam ,ghar ke kaam aur videos bhi banana , You're so awesome sir❤️🙏
@mohammadfraz
@mohammadfraz 2 жыл бұрын
Thank you so much , always keep supporting. 😌
@Idgaffffffffffffffffboi
@Idgaffffffffffffffffboi 2 жыл бұрын
@@mohammadfraz Hum toh hai sir baas aap sikhate raho 🙏
@raghvendrakhatri5848
@raghvendrakhatri5848 2 жыл бұрын
Lect - 13 completed, sir love♥️ the way you explain each and every concept, please keep creating such wonderful content 💯 your playlist are helping me alot in understanding the topics and improving my skills. Thankyou bhaiya ♥️
@desihiphop4998
@desihiphop4998 2 жыл бұрын
Other's season suspense - Bahubali ne katappa ko kyu maara hoga janne ke liye dekhiye season 2 !!!! 😲😲 Linked List Season Suspense - Ye question recursion se hogya !!!! Par iteration se kaise hoga janne ke liye dekhiye season 2 😂😂
@mohammadfraz
@mohammadfraz 2 жыл бұрын
hehe are wah bro amazing
@sowdub9445
@sowdub9445 Жыл бұрын
but after all these changing the links how did dummy get the address of the new head ?? someone pls explain
@desihiphop4998
@desihiphop4998 2 жыл бұрын
Bhaiya ye bhe hogya !!!!!!! bhut tgdi video thi question tricky tha but smjh aagya !!!!!!!
@mohammadfraz
@mohammadfraz 2 жыл бұрын
ye baaat
@arifashumbul
@arifashumbul 2 жыл бұрын
Awesome explanation!
@mohammadfraz
@mohammadfraz 2 жыл бұрын
Thanks ☺️
@afnankhan8854
@afnankhan8854 2 жыл бұрын
Much needed explanation
@fardeenshaikh6434
@fardeenshaikh6434 2 жыл бұрын
wah bhaiya bhut badiya maza aagaya like addicted to Netflix i am addicted to your videos season 1 and coming season 2 apke web show bhut mast hai
@mohammadfraz
@mohammadfraz 2 жыл бұрын
Ye vala totally samaj aaya ?
@fardeenshaikh6434
@fardeenshaikh6434 2 жыл бұрын
@@mohammadfraz ha bhaiya samaj mai aaya sham mai aur ek baar revision karunga to hojayega
@ianujkumark
@ianujkumark 2 жыл бұрын
appreciate your efforts
@sumit49
@sumit49 Жыл бұрын
can't understand how dummy is pointing to 2 in starting it is pointing to 1,like i cant understand how the trasistion happend.please help
@manavgusain9912
@manavgusain9912 2 жыл бұрын
why are we returning dummy->next, it is pointing to head and it is reversed.
@sowdub9445
@sowdub9445 Жыл бұрын
same doubt, you got the answer ??
@tanmaythaker2905
@tanmaythaker2905 2 жыл бұрын
Excited !
@mohammadfraz
@mohammadfraz 2 жыл бұрын
🔥 Give me feedback about this session.
@tanmaythaker2905
@tanmaythaker2905 2 жыл бұрын
@@mohammadfraz Enjoying every bit of it. It would be great if you can add the code in the description so that we can review it later. Apart from that, its a bang ON series. Waiting for more episodes.
@rajuprajapati712
@rajuprajapati712 2 жыл бұрын
Hi Faraz, thanks for this type of content. But I have a doubt. mera doubt ye hai ki jab 3 - 4 ko exchange kiye to next ki value change ho gyi but what about 1 - 2 wo bhi to same exchage kiye hai na to usme bhi to next ka issue aana chahiye na?
@jmann2885
@jmann2885 2 жыл бұрын
Great explanation bhaiya ….Ajj season2 krdo ga sara upload ?😅🙏🏻
@mohammadfraz
@mohammadfraz 2 жыл бұрын
Sara weekend pe kar sakta hu. Because weekdays me time nahi rehta
@jmann2885
@jmann2885 2 жыл бұрын
@@mohammadfraz bhaiya ess weekend pehh krdo
@ratnasanjay
@ratnasanjay 2 жыл бұрын
Thankyou bhaiya for this video
@vipulsharma1897
@vipulsharma1897 Жыл бұрын
Bhai sabki video dekhi lekin apki hi samajh aai honestly. But agar last group me me less than k nodes ho to usme apka code galat answer nahi dega?
@ganeshanganesh5982
@ganeshanganesh5982 2 жыл бұрын
How dummy-> next is storing address of new head address
@sowdub9445
@sowdub9445 Жыл бұрын
same doubt, did you get the answer ??
@jeevan999able
@jeevan999able 2 жыл бұрын
Thank you
@Music-tp8gg
@Music-tp8gg 2 жыл бұрын
keep up the good work
@madhusudandadhich3407
@madhusudandadhich3407 Жыл бұрын
bhaiya how e=temp will work when k=3 beacuse then temp -> next will not be the end node??
@JRK_RIDES
@JRK_RIDES Жыл бұрын
Bhai agar yaha k ki value agar 3 hogi na tho pahile iteration may tho usko obviously ek element milega but jo dusra iteration hoga na vaha par e null ko point karega aur jab bhi e null ko point karega na hum loop ke bahar ajayenge tho koi issue nahi hoga. Bohot late reply hai but I hope it helps.
@yuvrajrawat6549
@yuvrajrawat6549 2 жыл бұрын
just after the reversal function how we get the "e" pointing to 4 ??
@anshugupta3269
@anshugupta3269 2 жыл бұрын
e pointed to 4 when we were in while loop. After reversal the internal linking changed but e still points to 4. Please refer to reverse function while(p!=e) e always points to 4. e->next points to 3 after reversal.
@peterwayneparker9677
@peterwayneparker9677 2 жыл бұрын
Bhai. Simply e->next!=null karkdijiye while liip. kam kar jayga
@dhairyashiil
@dhairyashiil 2 жыл бұрын
Thank you : )
@amanmarothiyashorts6618
@amanmarothiyashorts6618 2 жыл бұрын
Me BCA final year me hu Muje Koi programming language nhi aati h muje python sikhni h to python se Fresher bande ki job lg skti h
@tech_wizard9315
@tech_wizard9315 2 жыл бұрын
Please give link to your Microsoft interviews series ??
@Xp-Sam
@Xp-Sam 2 жыл бұрын
bhaiyya dummy->next toh abhi bhi node 1 ka hi address store kiya hoga na, kyunki hamne dummy ka next to kabhi change hi nahi kiya, fir kaise answer sahi aa reha. Please explain bhaiya, I'm pretty sure I'm missing some basics
@iamrahulpanchal
@iamrahulpanchal 2 жыл бұрын
Even i have the same question. Did you got any answer for this?
@amansingh.h716
@amansingh.h716 Жыл бұрын
just mujha ek questtion tha ki jab hum link list ko reverse kara hai then usna apna sara connections lose kar dia haii. so like beforeStart.next=end; isko ya end kaise milaga. like Ram ma end pointer kahi pada hoga usko point karega kya ya . if Yes then how ?
@ankit-ry3cz
@ankit-ry3cz 2 жыл бұрын
Complete playlist kb tak uploaded hoygi sir
@mohammadfraz
@mohammadfraz 2 жыл бұрын
mamta bas dekhte jao jo bhi upload krdia sath sath
@SunnyGupta00
@SunnyGupta00 2 жыл бұрын
Reach++🔥
@shyaamaltripathi5373
@shyaamaltripathi5373 2 жыл бұрын
Bhaiyya last mein dummy->nest return karne ka samajh nahi aaya
@mdnadeem6343
@mdnadeem6343 2 жыл бұрын
Op bhaiya 🔥
@mohammadfraz
@mohammadfraz 2 жыл бұрын
Thanks Nadeem
@ashishm2974
@ashishm2974 2 жыл бұрын
Hi Fraz aapka Codechef Dsa Lecture Incomplete Hai kya Beginnera ke liye hai
@saifsdin1
@saifsdin1 2 жыл бұрын
Seating arrangement : facing problem , how to approach this type of question
@saifsdin1
@saifsdin1 2 жыл бұрын
I mailed also
@mayankjoshi8888
@mayankjoshi8888 2 жыл бұрын
Bhaiya app dsa ke sare topic per ese hi video banei na plz 🙏
@mohammadfraz
@mohammadfraz 2 жыл бұрын
Everything was clear in this episode ?
@soft_skyh
@soft_skyh 2 жыл бұрын
hi!
@mohammadfraz
@mohammadfraz 2 жыл бұрын
Hi Amirah
@saurabhnayak3352
@saurabhnayak3352 2 жыл бұрын
Sir codetribe pr live nhi kr rhe kyu?
@mohammadfraz
@mohammadfraz 2 жыл бұрын
Yes , abhi vaha live classes nahi ho rahi hai
@Sonu-tg6tg
@Sonu-tg6tg 2 жыл бұрын
Please make videos using JAVA
@desihiphop4998
@desihiphop4998 2 жыл бұрын
Bhaiya iteration waala java mein 39.3 MB lera hai aur recursion waala 39.1 !!! Aisa kyu ??
@mohammadfraz
@mohammadfraz 2 жыл бұрын
ignore karo ise
@mgdesire9255
@mgdesire9255 2 жыл бұрын
bhaiya sikkaa chamkegaa.....:)
@mohammadfraz
@mohammadfraz 2 жыл бұрын
zaroor
@mgdesire9255
@mgdesire9255 2 жыл бұрын
Ameen 🙏🏻
@Nikita-lv7lo
@Nikita-lv7lo 2 жыл бұрын
Please don't add videos 1 by 1 Atleast 10-12 daal diya karo 1 baari me🥺
@mohammadfraz
@mohammadfraz 2 жыл бұрын
Weekend pe try Karuna nada dalne ka
@SH_987
@SH_987 2 жыл бұрын
Bhaiya please iss message Ko Yash garg bhaiya ya ajay raj bhaiya tk pahucha do. JAC DELHI CHOICE FILLING pe Video. Because iss saal new College DSEU bhi add hua hai, JAC DELHI m. Please help bhaiya, ye message pahucha do. Sirf aap he ho jo reply krte hai 😅🙏🙏 Please bhaiya.
@mohammadfraz
@mohammadfraz 2 жыл бұрын
Okay bro
@SH_987
@SH_987 2 жыл бұрын
@@mohammadfraz thank you so much bhaiya 🙏
Reverse Linked List | EP 10
22:27
Fraz
Рет қаралды 35 М.
L21. Reverse Nodes in K Group Size of LinkedList
24:31
take U forward
Рет қаралды 85 М.
Teaching a Toddler Household Habits: Diaper Disposal & Potty Training #shorts
00:16
Новый уровень твоей сосиски
00:33
Кушать Хочу
Рет қаралды 4,1 МЛН
АЗАРТНИК 4 |СЕЗОН 1 Серия
40:47
Inter Production
Рет қаралды 1,4 МЛН
Tier 3 to Google 40LPA | 2024 Batch Pass Out
26:44
Fraz
Рет қаралды 41 М.
Design HashSet | EP 8
24:31
Fraz
Рет қаралды 32 М.
Reverse Nodes in K-Group - Linked List - Leetcode 25
12:20
NeetCode
Рет қаралды 105 М.
Reverse Nodes in k-Group | Among the toughest problems of LinkedList
20:05
2876. Count Visited Nodes in a Directed Graph |  Weekly Leetcode 365
19:37
Swap Nodes in Pairs - Apple Interview Question - Leetcode 24
8:43
Design Browser History | EP 21
14:21
Fraz
Рет қаралды 14 М.
Teaching a Toddler Household Habits: Diaper Disposal & Potty Training #shorts
00:16