ComputerBread
ComputerBread
  • 22
  • 137 732
Leetcode 21. Merge Two Sorted Lists (2 solutions)
Hey guys, welcome back to another leetcode video.
Today, we look at the easy leetcode problem 21. Merge Two Sorted Lists
The goal is to merge two sorted linked list into a single one.
This problem can be a bit tricky, but by carefully thinking about it, we can come up with 2 solutions.
An iterative solution and a recursive solution.
I hope you will enjoy it!
Leetcode playlist: ua-cam.com/play/PLuJfrVx3aQbG1_9k3khnuR0r2RaxExxse.html
JavaScript playlist: ua-cam.com/play/PLuJfrVx3aQbGQMDbtGcuIDY2892FA09b2.html
Leetcode question: leetcode.com/problems/merge-two-sorted-lists/description/
Code: github.com/ComputerBread/leetcode/tree/5a2858e1d8500697c86ca165b9d2a3ca658957b7/21_merge-two-sorted-lists
To support me (if you feel like it): ko-fi.com/computerbread/
Cheatcheet/mindmap: ko-fi.com/s/34966c8fb1
Twitter: ComputerBread
Subscribe: www.youtube.com/@ComputerBread?sub_confirmation=1
Chapters:
00:00 Introduction
00:24 Solution 1 (iterative)
05:31 Solution 2 (recursive)
08:19 Comparison
08:57 Conclusion
(for the algorithm)
Every software engineer, developer, programmer, computer science student looking for a high paying job, 6 figures, millionaire, should spend time to grind leetcode to ace technical interviews. If you want to be cracked, you need to crack leetcode!
Linked list, list, abstract data type,
#javascript #leetcode #c #cprogramming
Переглядів: 197

Відео

Leetcode 20. Valid Parentheses (but I am losing my mind)
Переглядів 805Місяць тому
Hey guys, welcome back to another leetcode video. Today, we look at the easy leetcode problem 20. Valid Parentheses It's a fun one, we are going to solve it in javascript with a stack and then in C using a recursive function and the "memory stack"! A stack is a basic data structure that every developer should know about, it has a LIFO behavior Last In First Out. This was fun to make, I hope you...
Leetcode 1. Two Sum (Why brute force might be enough!)
Переглядів 861Місяць тому
Leetcode number 1. Two Sum (easy) Let's go back to the leetcode grind, with an easy problem. In this video, we explore how to solve this problem using 4 different algorithms. I lead you through the entire thought process from basic brute force to the hashmap solution. I also explore why brute force is not necessarily a bad idea!!! Leetcode playlist: ua-cam.com/play/PLuJfrVx3aQbG1_9k3khnuR0r2Rax...
Should you use AI as a developer?
Переглядів 5682 місяці тому
CursorAI, Claude Sonnet 3.5, GPT-4, OpenAI... should you, as a developer, use AI to do your job? In this filler episode, I am giving my opinion on whether or not developers should use AI to help them do their job. Check my previous videos about string algorithms & data structures: ua-cam.com/play/PLuJfrVx3aQbFFYhYkCHLQjHEf5bmFmYAN.html Support me: ko-fi.com/computerbread Cheatcheet/mindmap: ko-...
6 easy steps to get started with Neovim
Переглядів 5 тис.3 місяці тому
Hello, today I wanted to share what is probably the easiest & sane way to get started with Neovim. We go over 6 steps ( 2 bonus ones) to go from 0 to hero. I hope this can be useful, please enjoy :) Links: neovim.io github.com/nvim-lua/kickstart.nvim ua-cam.com/video/rT-fbLFOCy0/v-deo.html www.lua.org/manual/5.4/ nvchad.com Check my previous videos about string algorithms & data structures: ua-...
They spent $1.8 million for you to have a friend
Переглядів 8183 місяці тому
This video is for entertainment purposes only. friend is your new AI-powered wearable that is always listening to you and texts you like a real friend. They spent $1.8 million on the domain name. Tech bros are fighting over this! What do you guy think about this? Just wanted to try making a "funnE" video about this questionable product I saw on x (twitter), maybe I should stick to tutorials! An...
Aho-Corasick Algorithm - JavaScript Implementation (pt. 2)
Переглядів 3784 місяці тому
Hello, welcome back to part 2 of the Aho-Corasick algorithm, today we implement it in JavaScript. Part 1: ua-cam.com/video/XWujo7KQL54/v-deo.html code: github.com/ComputerBread/algorithms/blob/8fb7aa96543faa5589fda486077fb84213b1e1c7/Aho-Corasick/aho-corasick-part-2.js Videos I recommend you to watch to help you understand this one: - Intro to state machines: ua-cam.com/video/5KJtYMjeY4U/v-deo....
Ctrl+F on steroids - Aho-Corasick Algorithm (pt. 1)
Переглядів 8704 місяці тому
Hello, today we dive into the Aho-Corasick algorithm that allows us to find multiple patterns in a text. This algorithm can be seen as a generalized version of the KMP algorithm. Part 2 (implementation): ua-cam.com/video/jsgLCvOW6Vo/v-deo.html Videos I recommend you to watch to help you understand this one: - Intro to state machines: ua-cam.com/video/5KJtYMjeY4U/v-deo.html - KMP algorithm: ua-c...
Compressed trie
Переглядів 1,3 тис.4 місяці тому
Hello, in the previous video, we learnt about tries, today, we learn how we can decrease the number of nodes in a trie by defining a "compressed trie" aka "compact prefix tree" aka "radix tree". This video can be helpful to solve the medium Leetcode problem "208. Implement Trie (Prefix Tree)": leetcode.com/problems/implement-trie-prefix-tree/description/ There are different variations of tries,...
Trie - The data structure behind autocomplete (Prefix tree)
Переглядів 7045 місяців тому
Hello, today, we learn about "tries" aka "prefix trees", a simple data structure that can be used to store & search for strings. We implement a simple "autocomplete english dictionary" in JavaScript. This video can be helpful to solve the medium Leetcode problem "208. Implement Trie (Prefix Tree)": leetcode.com/problems/implement-trie-prefix-tree/description/ There are different variations of t...
KMP - The optimal string matching algorithm
Переглядів 1,1 тис.6 місяців тому
Hello, today, we learn about the Knuth-Morris-Pratt exact string matching algorithm. It has the optimal worst-case time complexity of Big-O of m n. Where m is the length of the pattern and n is the length of the text. And it requires a reasonable extra space of Big-theta of m. This video is based on the previous video in which we constructed a Deterministic Finite Automaton (DFA) to find a patt...
The most fundamental string matching algorithm (introduction to Finite Automata)
Переглядів 3437 місяців тому
Hello, today, we’ll discover some of the most fundamental ideas in Computer Science applied to string matching. Learning and knowing about finite state automata, deterministic and non-deterministic is fundamental if we want to be able to explore more advanced algorithms like the KMP algorithm, tries, suffix trees, Aho-Corasick, RegEx engines… Previous video about the Boyer-Moore algorithm: ua-c...
The algorithm behind Ctrl+F (Boyer-Moore String Matching Algorithm)
Переглядів 3,3 тис.7 місяців тому
Hello, today we start our journey into “string algorithms” with the Boyer-Moore string matching algorithm. This algorithm is considered to be the most efficient one in usual applications. It uses two rules: the bad character rule & the good suffix rule. In this video I explain how they work, and how to implement them in JavaScript. You can find the full source code on github: github.com/Compute...
The unexpected complexity of characters (Unicode, UTF-8, UTF-16, UTF-32, Glyphs, Fonts)
Переглядів 5139 місяців тому
Hello, before making videos about string algorithms, I wanted to talk about characters, how they are encoded in a binary format, what are ASCII, EBCDIC, and Unicode. What is UTF, and how UTF-8, UTF-16 and UTF-32 works. I also wanted to know how fonts work, and how characters are printed on a screen! This is an introduction before the real stuff, I hope you will enjoy it! Cheatcheet/mindmap: ko-...
Leetcode 503. Next Greater Element II
Переглядів 492Рік тому
Welcome back to another boring leetcode video :) Today, it's leetcode problem 503. "Next greater element II"! leetcode.com/problems/next-greater-element-ii/ With C code explanation! I swear this is the last boring video I make, next one will be better, trust. I made a first version of this video 3 years ago, but it was bad and I didn't published it. But when I watched it recently, I decided to ...
How to draw a perfect circle (using rust)
Переглядів 12 тис.Рік тому
How to draw a perfect circle (using rust)
How "super" works in JavaScript
Переглядів 109Рік тому
How "super" works in JavaScript
The hidden details of JavaScript Classes
Переглядів 332Рік тому
The hidden details of JavaScript Classes
Master JavaScript Objects
Переглядів 310Рік тому
Master JavaScript Objects
Leetcode 46. Permutations : Introduction to backtracking
Переглядів 105 тис.4 роки тому
Leetcode 46. Permutations : Introduction to backtracking
Largest rectangle in a histogram [Coding Interview]
Переглядів 2 тис.4 роки тому
Largest rectangle in a histogram [Coding Interview]

КОМЕНТАРІ

  • @juanandresnunez658
    @juanandresnunez658 День тому

    I'm going to say something controversial I think enlightenment is going Vim > Emacs > Nvim with NvChad lol

  • @alejandrosepulvedaposada8471
    @alejandrosepulvedaposada8471 6 днів тому

    you are the best bro, everything was clear, i love you

  • @FernandoTellez-im9jt
    @FernandoTellez-im9jt 7 днів тому

    Thank you very much for your work, you do not have the amount of help that have served on important dates. I just discovered your channel and it is helping me to understand complex concepts in such a simple way. Thanks for knowing how to deliver the content in such a great way. Excellent job in putting videos of previous recommendations to understand the more complex ones. Ctrl+F on steroids - Aho-Corasick Algorithm (pt. 1) -> THE SAVING OF MY SCHOOL CAREER.

  • @matiasrafaelaltamiranda8689
    @matiasrafaelaltamiranda8689 7 днів тому

    thanks so much!

  • @avs6362
    @avs6362 10 днів тому

    Subscribed brother! Thanks a lot.

  • @ComputerBread
    @ComputerBread 15 днів тому

    Thank you everyone for watching this video For more leetcode videos check out this playlist: ua-cam.com/play/PLuJfrVx3aQbG1_9k3khnuR0r2RaxExxse.html

  • @ComputerBread
    @ComputerBread 15 днів тому

    Another day, another leetcode video! Have fun

  • @MrBrainsYT
    @MrBrainsYT 15 днів тому

    Love this guy! He's funny and knowledgable. No dull movements, very interesting and engaging video. One of the coolest youtuber for Leetcode. I Highly recommend learning from him. :)

  • @markwilson6387
    @markwilson6387 18 днів тому

    This is a good video. I wish it existed a year ago.

  • @kailashkatheth1871
    @kailashkatheth1871 22 дні тому

    emacs

  • @ИмяФамилия-д3ь9ъ
    @ИмяФамилия-д3ь9ъ 27 днів тому

    Kickstart is really helpful thing.

  • @kushagrashuklaietlucknowst5642
    @kushagrashuklaietlucknowst5642 Місяць тому

    There is also an alternate way of just using two pointers method to mimic what stack is doing, rest logic is same. Auxiliary space is optimized i.e. no stack needed just 2 variables. Would be great if you cover that in a follow up video.

  • @Not_slime330
    @Not_slime330 Місяць тому

    yotsuba mentioned 🗣 good vid thoroughly enjoyed

  • @dreamerslab
    @dreamerslab Місяць тому

    More leet code please 🙂

  • @benjaminkaufman3914
    @benjaminkaufman3914 Місяць тому

    I already have white friends and I don’t need to pay for them!

  • @benjaminkaufman3914
    @benjaminkaufman3914 Місяць тому

    Subscribed because I’m beautiful

  • @dothedeedbro-qn4eb
    @dothedeedbro-qn4eb Місяць тому

    dude this deserves way more views, not dissapointed that clicked on a video with small amount of views, it was very good high quality content, thank you and keep going!

    • @ComputerBread
      @ComputerBread Місяць тому

      Thank you so much, seeing such kind messages really helps staying motivated!

  • @yarburart7242
    @yarburart7242 Місяць тому

    I heard from a random old guy that if you imagine JS runs directly on hardware, then in V8 the stack will be implemented in hardware like in CPU. Will this code be faster if we use the stack as in V8 but not as in function calls and is it possible?

    • @ComputerBread
      @ComputerBread Місяць тому

      I am not really sure I understand what you mean. But in JavaScript you can't really access the underlying "features" of the V8 engine. But I think it should be possible to write an assembly program to directly manipulate the stack using the stack pointer. (I am probably going to try it & do another video!)

  • @xecreth7211
    @xecreth7211 Місяць тому

    This made me want to go do crack on the corner, but atleast I know objects now

  • @ComputerBread
    @ComputerBread Місяць тому

    Hello! Here's a new leetcode video! The end is a bit silly, but it was pretty fun to make! I hesitated between different options to explain the solution to this problem, I am not sure I picked the best one. What do you think? is it ok? Should I just explain the solution without trying to show the thought process?

  • @na50r24
    @na50r24 Місяць тому

    Apparently this is the one that is used in grep GNU, so now I know why it's able to find Regex expression so fast. Thanks.

  • @Zlaio
    @Zlaio Місяць тому

    This is true and often (I think) overlooked when determining which algorithm implementation to use. N matters a lot. Computers LOVE arrays (cache locality). If N is small enough, use an array (you find this out by profiling)

  • @taherpatrawala_
    @taherpatrawala_ Місяць тому

    you're doing great, never stop making such good videos

  • @ash-nf6yy
    @ash-nf6yy Місяць тому

    Your videos are easy to understand! Please please make more videos. Much Appreciated!

    • @ComputerBread
      @ComputerBread Місяць тому

      I am planning on making more :) If you would like me to cover a specific topic, please tell me!

  • @solaimanhosen
    @solaimanhosen 2 місяці тому

    Good to see you are making leetcode videos. I always wanted to make videos related to computer programming but couldn’t do it.

    • @ComputerBread
      @ComputerBread Місяць тому

      I am going to make more! What's stopping you from making videos?

  • @lekamarade
    @lekamarade 2 місяці тому

    Thx for vids on leet code!

  • @johnk6757
    @johnk6757 2 місяці тому

    Like them or not, you will be left behind if you don't learn to use them efficiently.

  • @user-lx2ep9hd4k
    @user-lx2ep9hd4k 2 місяці тому

    Can't wait when bunch of black suits realize how their mutli billion company is crashing down because it's entire infrastructure consists of millions of lines of code and nobody knows how it works. But unfortunately for them, this realization comes too late when all the slapped together code starts struggling.

  • @rachelsnijders817
    @rachelsnijders817 2 місяці тому

    No, don't use a AI for anything serious, except if you have absolutely no clue what you're doing and you just want to know what a piece of code is doing. And even then it's better to ask a human than a large language model. As the person in the video noted, if you use a LLM to generate code, you should know what the code is doing. Then, you need to take out the bad, buggy code and replace it with something that works. The end result: you've spent more time reading and fixing an LLM's code and you haven't thought of a meaningful solution yourself, meaning you'll feel less satisfied with the solution. One exception to the rule is if you hate the creativity that comes with programming and love the frustration that comes with debugging. Then absolutely use LLMs when programming.

    • @johnk6757
      @johnk6757 2 місяці тому

      I have found that AI seems to emit relatively few bugs (certainly fewer bugs than any random human developer), but it's great for doing tasks you've done many times before and won't learn from doing. Debugging can be extra frustrating indeed - but learning how to work efficiently with the AI output is a skill itself I do think there's something to the idea of stagnating your growth by leaning too heavily on it but I also think it can have the opposite effect, empowering developers to move MUCH more quickly and build more interesting projects to actually learn about interesting things

    • @Serizon_
      @Serizon_ 2 місяці тому

      agreed

    • @rachelsnijders817
      @rachelsnijders817 2 місяці тому

      @@johnk6757 But if you've already done something, then surely you've made a component out of it? I can't think of anything that can be automated with LLMs but not with traditional code.

  • @Xtreme-yb9yo
    @Xtreme-yb9yo 2 місяці тому

    i dont think i can run an llm locally on my 2019 macbook with a whopping 4gb vram

    • @ComputerBread
      @ComputerBread 2 місяці тому

      Yeah, you're cooked, even with a RTX3080 I am struggling to run one!

  • @thoniasenna2330
    @thoniasenna2330 2 місяці тому

    hahahah i love you! best regards from brazil!

  • @lekamarade
    @lekamarade 2 місяці тому

    Ok

  • @bd_dev
    @bd_dev 2 місяці тому

    Excellently explain! and +1 for the animations 👍

  • @mustafabouras-r5w
    @mustafabouras-r5w 2 місяці тому

    dude you are the best

  • @f4zer_
    @f4zer_ 2 місяці тому

    simple & easy !! loved it, we need more. thanks.

  • @stoup8778
    @stoup8778 3 місяці тому

    I really like your soln, very clear explanation. I didnt think of using a seperate vector to keep track of used elements either - I tried to used a set when I was implementing on my own and failed miserably haha

  • @harshchauhan5514
    @harshchauhan5514 3 місяці тому

    Kickstart is amazing and should be starting point of each vimmer tbh. Also the kickstart-modulor fork is great too.

  • @DevInDetour
    @DevInDetour 3 місяці тому

    Great video! Thanks for this

  • @grandparick3176
    @grandparick3176 3 місяці тому

    Problem: I have windows

    • @ComputerBread
      @ComputerBread 3 місяці тому

      Time to switch to linux! But you should be able to make it work on Windows, I think, maybe?

    • @lekamarade
      @lekamarade 3 місяці тому

      Maybe in wsl?

    • @harshchauhan5514
      @harshchauhan5514 3 місяці тому

      I have windows I first started with kickstart first two months before and then after in wsl I'm configuring my own. I have done half configured to this point (started this Sunday). Once you are done with kickstart move to kickstart go in kickstart-modulor fork it's more ezy to understand stages of config.

    • @rajmajumdar5253
      @rajmajumdar5253 Місяць тому

      ​@@harshchauhan5514 there's another kickstart?

    • @average-dev69
      @average-dev69 Місяць тому

      I’ve used windows all my life, tried neovim with kickstart everything was broke, couldn’t fix it, tried on Mac, not that bad but I couldn’t get it right, I had to make a dual boot for my windows and Ubuntu, I finally make it work there. Now I just play games on Windows 😅 (all of this has happened this week 😂)

  • @christianjt7018
    @christianjt7018 3 місяці тому

    The backtracking recipe is pure golden, this is a superb explanation, thank you.

  • @Tlj10144
    @Tlj10144 3 місяці тому

    What's up with the 188 dislikes lol

    • @ComputerBread
      @ComputerBread 3 місяці тому

      it's 191 now T_T

    • @Tlj10144
      @Tlj10144 3 місяці тому

      @@ComputerBread fuck them, you should do more videos like this

  • @WearyWayfarer
    @WearyWayfarer 3 місяці тому

    Yikes

  • @popcornbuster752
    @popcornbuster752 3 місяці тому

    CIA's listening device

  • @mac3362
    @mac3362 3 місяці тому

    whup. we are fucked. good luck, humanity. it's been fun

  • @kevinz3200
    @kevinz3200 3 місяці тому

    Looks like the end of social interaction, please delete it.

    • @phillipsmusic3871
      @phillipsmusic3871 3 місяці тому

      That's the only right thing to do in this sad situation.

  • @ComputerBread
    @ComputerBread 4 місяці тому

    Part 2 is available here: ua-cam.com/video/jsgLCvOW6Vo/v-deo.html

  • @Yarin5879
    @Yarin5879 4 місяці тому

    thank you so much

  • @trimansinghtuteja4199
    @trimansinghtuteja4199 4 місяці тому

    That was a great explanation!!

  • @robertkovac7824
    @robertkovac7824 4 місяці тому

    thanks

  • @ayomide-michael
    @ayomide-michael 4 місяці тому

    Subscribed!