Convert Binary Number in a Linked List to Integer | EP 6

  Рет қаралды 26,429

Fraz

Fraz

Күн бұрын

Lecture Notes: leadcoding.in/...
Watch the complete Linked List Series • Linked List Series
Get 10% discount Crio.do www.crio.do/red...
Question (leetcode) leetcode.com/p...
Placement Preparation Roadmap • Roadmaps for Placement
Explore Code Studio here:bit.ly/39Y9ZjO
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

Пікірлер: 66
@ScienceSeekho
@ScienceSeekho 2 жыл бұрын
For those who want O(2N) and O(N). change the method name when you submit. // Method 1: TC: O(2N) SC: O(1) // Find length and then iterate the linkedlist with ans = ans + 2^(--n) int getDecimalValue1(ListNode* head) { ListNode* temp = head; int n = 0; while(temp != NULL) { n++; temp = temp->next; } temp = head; int ans = 0; while(temp != NULL) { ans += (temp->val) * pow(2, --n); temp = temp->next; } return ans; } // Method 2: TC: O(N) SC: O(1) int getDecimalValue2(ListNode* head) { ListNode *temp = head; int ans = 0; while(temp != NULL) { ans *= 2; ans += (temp->val); temp = temp->next; } return ans; }
@ashishkashyap1872
@ashishkashyap1872 2 жыл бұрын
I learned the last approach today, I had solved it with the second approach by counting the number of nodes then traversed the list.
@geekySRM
@geekySRM 2 жыл бұрын
Last wala approach is awesome :)
@raghvendrakhatri5848
@raghvendrakhatri5848 2 жыл бұрын
Lect - 7 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 ♥️
@purushottamkumar3140
@purushottamkumar3140 2 жыл бұрын
Lec-7 Finished. I only thought 2 approaches will be there but third one was absolutely amazing.
@Jack_Sensei
@Jack_Sensei 2 жыл бұрын
Wonderful explanation
@piyushsagar8380
@piyushsagar8380 3 жыл бұрын
mast series...op 🔥 aise hi tree, stack and heap , episode wise dijiyega.. Netflix wali feeling aa ja rhi hai.. 😂
@mohammadfraz
@mohammadfraz 3 жыл бұрын
thank you Piyush. Bas enjoy karte raho mai daalta rahunga
@MdFaisal-kj1ck
@MdFaisal-kj1ck 2 жыл бұрын
@@mohammadfraz thanks bro!
@codewithayaz6404
@codewithayaz6404 2 жыл бұрын
bhaiyya pls add more playlist like linked list what a great playlist hats off to u
@vatsalkudecha2746
@vatsalkudecha2746 2 жыл бұрын
Seriously telling, even though I have solved these questions previously, I still find new solution approaches from your videos. Thanks bhaiya.....
@mohammadfraz
@mohammadfraz 2 жыл бұрын
Bas yar I tried to make it fun. When someone says that he enjoyed , it makes me feel cool 😎
@soubhagyamohapatra7249
@soubhagyamohapatra7249 25 күн бұрын
Solid explanation bro
@mohammadfraz
@mohammadfraz 25 күн бұрын
Glad you liked it
@vakhariyajay2224
@vakhariyajay2224 Жыл бұрын
Thank you very much. You are a genius.
@ratnasanjay
@ratnasanjay 2 жыл бұрын
Thankyou bhaiya for this video
@utkarshsingh6778
@utkarshsingh6778 3 жыл бұрын
Sir please add these series in the playlist so it will be very helpful for us
@mohammadfraz
@mohammadfraz 3 жыл бұрын
Check description
@CSe_IT_Guy
@CSe_IT_Guy 2 жыл бұрын
Please start this type of series bhaiya.... Interview me bhut help hoga.... it's humble request 🙏🙏
@HarshRaj-kp7gk
@HarshRaj-kp7gk 3 жыл бұрын
Please 🙏🙏 continue sir it's humble request sir
@mohammadfraz
@mohammadfraz 3 жыл бұрын
Yes pakka bro
@VaibhavSingh-wl4gd
@VaibhavSingh-wl4gd 2 жыл бұрын
bhaiya please make series on graph theory please
@chetanpatil2473
@chetanpatil2473 2 жыл бұрын
make video on time complicity
@gengar_13
@gengar_13 2 жыл бұрын
Looking forward more series on other data structures like stacks quoues trees graphs please
@akshayupadhayay4594
@akshayupadhayay4594 2 жыл бұрын
7/feb/22 Today i watched 7 videos of this playlist and it is awesome Thank you Bhaiya for this
@btDhanjay
@btDhanjay 3 жыл бұрын
OP🔥🔥 I tried counting the number of nodes and then in second iteration converted binary to decimal but this approach was just 🔥🔥🔥
@mohammadfraz
@mohammadfraz 3 жыл бұрын
🔥 code bhi karte rehna
@btDhanjay
@btDhanjay 2 жыл бұрын
@@mohammadfraz yes I am coding along
@ShyamalDas-kd5vt
@ShyamalDas-kd5vt 2 жыл бұрын
God level explanation 🥰🥳
@rupampakhira8132
@rupampakhira8132 3 жыл бұрын
Thank You So Much Bhaiya❤ Completed this lecture😊
@namansaraswat9691
@namansaraswat9691 2 жыл бұрын
This approach do not require us to use inbuilt Math.pow() .Thanks for this video.
@reetikgandate606
@reetikgandate606 2 жыл бұрын
loved the series❤❤❤❤
@girdhar3224
@girdhar3224 Жыл бұрын
It was a bit tricky to understand the optimal solution but finally... done....
@thenewway416
@thenewway416 2 жыл бұрын
Nice 👍
@desihiphop4998
@desihiphop4998 2 жыл бұрын
Dope Approach bhaiya !!!!!!!!!!!!!!!
@mohammadfraz
@mohammadfraz 2 жыл бұрын
Thanks bro ❤️❤️
@amandixit8342
@amandixit8342 2 жыл бұрын
Maza aa gya bhaiya bas abhi ke liye thi khaunga maza toh aa raha baki ka puri playlist khatam karke bataunga kesa laga 😃
@MohitSharma-ur8pl
@MohitSharma-ur8pl 6 ай бұрын
should I try to solve the questions before completing the playlist?
@vasuarora8775
@vasuarora8775 3 жыл бұрын
mast series...op 🔥
@TechUnboxing00
@TechUnboxing00 3 жыл бұрын
Tried both approaches
@mohammadfraz
@mohammadfraz 3 жыл бұрын
Finish all the episodes
@35_pandey_shubham89
@35_pandey_shubham89 11 ай бұрын
good approach with better explaination but kindly dry run the apparoach with more than one example
@atozgyaaan8162
@atozgyaaan8162 2 жыл бұрын
Nice approach bhaiya❤
@mohammadfraz
@mohammadfraz 2 жыл бұрын
Thanks 😊
@saurabhnayak3352
@saurabhnayak3352 3 жыл бұрын
Very good quality.
@mohammadfraz
@mohammadfraz 3 жыл бұрын
Binge watch karrahe ho kya ?
@keshavpranshul1262
@keshavpranshul1262 2 жыл бұрын
love it
@mdnadeem6343
@mdnadeem6343 3 жыл бұрын
simple and effective 🔥
@mohammadfraz
@mohammadfraz 3 жыл бұрын
🙌
@yourbestie4138
@yourbestie4138 2 жыл бұрын
op series brother
@mohammadfraz
@mohammadfraz 2 жыл бұрын
Thanks Bestie
@KhushwantSinghZzzz
@KhushwantSinghZzzz 3 жыл бұрын
Learnt new logic🤘
@mohammadfraz
@mohammadfraz 3 жыл бұрын
Nice Khushwant
@vinitranjan2665
@vinitranjan2665 Жыл бұрын
class Solution { public: int getDecimalValue(ListNode* head) { ListNode* temp; int ans=0; while(head!=NULL){ temp=head; ans*=2; ans+=(temp->val); head=head->next; //delete temp; } return ans; } }; Bhaiya ,Why we can't delete the temp here?
@ieltsbaba8400
@ieltsbaba8400 2 жыл бұрын
why can't we do as follows? //n is the size of LL int result=0; while(head.next!=null){ result+=head.data*(Math.pow(2,n-1)); head = head.next; n--; }
@SunnyGupta00
@SunnyGupta00 2 жыл бұрын
Reach++🔥
@alishasoni2937
@alishasoni2937 3 жыл бұрын
Thankyou sir🔥🔥
@mohammadfraz
@mohammadfraz 3 жыл бұрын
You're welcome ❤️🔥 do share it
@nitishkumarmiranam7098
@nitishkumarmiranam7098 2 жыл бұрын
I able to find brutforce solution and code according to brutforce but even for single problem i am not able to get optimum approach or solution 😓what i can do waiting for your reply fraz bhaiya ❤
@evelynsummer4020
@evelynsummer4020 Жыл бұрын
I wish you do a video in English :(
@sujaltamrakar827
@sujaltamrakar827 2 жыл бұрын
Bhaiya jo questions aap bate ho vo hota hai or hum new question try karte hai to nahi hota hai esa kyo??? But linked list series was OP 🔥🔥❤️❤️
@mohammadfraz
@mohammadfraz 2 жыл бұрын
series ke baad linked List ke ho jaenge sare questions
@dp-ev5me
@dp-ev5me 2 жыл бұрын
you can also use ans
@rajkrishna8294
@rajkrishna8294 3 жыл бұрын
I always used this formula but never know the reason behind it! XD Thank you SIr
@mohammadfraz
@mohammadfraz 3 жыл бұрын
You are most welcome Krishna , keep sharing ❤️
@aryan_01793
@aryan_01793 2 жыл бұрын
I learned the last approach today, I had solved it with the second approach by counting the number of nodes then traversed the list.
Doubly Linked List and STLs | EP 7
9:01
Fraz
Рет қаралды 18 М.
Design HashSet | EP 8
24:31
Fraz
Рет қаралды 32 М.
Fake watermelon by Secret Vlog
00:16
Secret Vlog
Рет қаралды 16 МЛН
SCHOOLBOY. Мама флексит 🫣👩🏻
00:41
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 7 МЛН
отомстил?
00:56
История одного вокалиста
Рет қаралды 5 МЛН
Reverse Nodes in k-Group (NO EXTRA SPACE) | EP 12
19:51
Reverse Nodes in k-Group | EP 11
23:04
Fraz
Рет қаралды 33 М.
Reverse Linked List | EP 10
22:27
Fraz
Рет қаралды 35 М.
LeetCode Convert Binary Linked List to Integer - JavaScript
6:46
Read Write Exercise
Рет қаралды 1 М.
Intersection of Two Linked List | EP 18
14:08
Fraz
Рет қаралды 18 М.
Fake watermelon by Secret Vlog
00:16
Secret Vlog
Рет қаралды 16 МЛН