LeetCode 2181 : Merge Nodes in Between Zeros

  Рет қаралды 954

Engineering Digest

Engineering Digest

4 ай бұрын

🟡 Get 1 to 1 coaching with me: topmate.io/engineeringdigest
🟡 Donate: paypal.me/engineeringdigest
🟡 Perks: www.youtube.com/@EngineeringD...
🔴 Discord: / discord
🔴 Twitch: / engineeringdigest
🔴 Personal KZfaq Channel: / @thevipulvats
🔴 Instagram: / thevipulvats
🔴 Twitter: / thevipulvats
🔴 LinkedIn: / thevipulvats
🔴 Website: engineeringdigest.net
🟢 Description:

Пікірлер: 3
@aaaappppsjhd
@aaaappppsjhd Ай бұрын
nice explanation bro
@a-55omkarnilawar16
@a-55omkarnilawar16 Ай бұрын
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next(nullptr) {} * ListNode(int x, ListNode *next) : val(x), next(next) {} * }; */ class Solution { public: ListNode* mergeNodes(ListNode* head) { ListNode* prev = head; ListNode* nexti = head->next; int count = 0; while(nexti != nullptr) { if(nexti->val != 0) { count += nexti->val; } if(nexti->val == 0) { prev->next->val = count; count = 0; prev->next->next = nexti->next; prev = nexti; } nexti = nexti->next; } return head->next; } };
@rohitpachauri2372
@rohitpachauri2372 2 ай бұрын
thnx
LeetCode 2074: Reverse Nodes in Even Length Groups
18:22
Engineering Digest
Рет қаралды 528
Ouch.. 🤕
00:30
Celine & Michiel
Рет қаралды 20 МЛН
Викторина от МАМЫ 🆘 | WICSUR #shorts
00:58
Бискас
Рет қаралды 4,4 МЛН
1,000 Diamonds! (Funny Minecraft Animation) #shorts #cartoon
00:31
toonz CRAFT
Рет қаралды 38 МЛН
❌ Don't Run Behind 500 LEETCODE Problems ❌ Focus on QPCD
8:31
#LeetCode 2923 | Find Champion I #Java
4:31
Sleepy Cracker
Рет қаралды 8
Python for javascript developers
14:53
Chai aur Code
Рет қаралды 34 М.
Python vs JavaScript: Which one to Learn in 2024? (For Jobs)
8:25
CodeWithHarry
Рет қаралды 465 М.
The  Ultimate Python Programming Roadmap (Before you Start)🐍
11:39
CodeWithHarry
Рет қаралды 460 М.
Java Strings are Immutable - Here's What That Actually Means
7:06
Coding with John
Рет қаралды 609 М.
Ouch.. 🤕
00:30
Celine & Michiel
Рет қаралды 20 МЛН