Terrible Whiteboard
Terrible Whiteboard
  • 80
  • 622 571
Add Two Numbers | LeetCode 2 | Coding Interview Tutorial
Add Two Numbers solution: LeetCode 2
Code and written explanation: terriblewhiteboard.com/add-two-numbers-leetcode-2/
Link to problem: leetcode.com/problems/add-two-numbers/
Buy Me a Coffee: www.buymeacoffee.com/terriblewboard
AFFILIATE LINKS
If you're interested in learning algorithms, these are great resources.
💻 40% off Tech Interview Pro: techinterviewpro.com/terriblewhiteboard
⌨️ 20% off CoderPro: coderpro.com/terriblewhiteboard
💲 All coupons and discounts 💲
terriblewhiteboard.com/coupons-discounts/
Add Two Numbers | LeetCode 2 | Coding Interview Tutorial
#addtwonumbers #leetcode #algorithms #terriblewhiteboard #codinginterview
Click the time stamp to jump to different parts of the video.
00:00 Title
00:06 Problem readout
00:46 Whiteboard overview
02:31 Modulo operator explained
04:23 Back to whiteboarding
08:17 Whiteboard solution - sped up
10:09 Whiteboard solution - detailed
14:10 Coding solution
20:39 Result and outro
zhlédnutí: 19 542

Video

Odd Even Linked List | LeetCode 328 | Coding Interview Tutorial
zhlédnutí 4,9KPřed 4 lety
Odd Even Linked List solution: LeetCode 328 Code and written explanation: terriblewhiteboard.com/odd-even-linked-list-leetcode/ Link to problem: leetcode.com/problems/odd-even-linked-list/ Buy Me a Coffee: www.buymeacoffee.com/terriblewboard AFFILIATE LINKS If you're interested in learning algorithms, these are great resources. 💻 40% off Tech Interview Pro: techinterviewpro.com/terriblewhiteboa...
Find the Town Judge | LeetCode 997 | Coding Interview Tutorial
zhlédnutí 5KPřed 4 lety
Find the Town Judge solution: LeetCode 997 Code and written explanation: terriblewhiteboard.com/find-the-town-judge-leetcode-997/ Link to problem: leetcode.com/problems/find-the-town-judge/ Buy Me a Coffee: www.buymeacoffee.com/terriblewboard AFFILIATE LINKS If you're interested in learning algorithms, these are great resources. 💻 40% off Tech Interview Pro: techinterviewpro.com/terriblewhitebo...
Partition Equal Subset Sum | LeetCode 416 | Facebook Coding Interview Tutorial
zhlédnutí 9KPřed 4 lety
Partition Equal Subset Sum solution: LeetCode 416 Code and written explanation: terriblewhiteboard.com/partition-equal-subset-sum-leetcode-416/ Link to problem: leetcode.com/problems/partition-equal-subset-sum/ Buy Me a Coffee: www.buymeacoffee.com/terriblewboard AFFILIATE LINKS If you're interested in learning algorithms, these are great resources. 💻 40% off Tech Interview Pro: techinterviewpr...
Jump Game | LeetCode 55 | Coding Interview Tutorial
zhlédnutí 7KPřed 4 lety
Jump Game solution: LeetCode 55 Code and written explanation: terriblewhiteboard.com/jump-game-leetcode-55/ Link to problem: leetcode.com/problems/jump-game/ Buy Me a Coffee: www.buymeacoffee.com/terriblewboard AFFILIATE LINKS If you're interested in learning algorithms, these are great resources. 💻 40% off Tech Interview Pro: techinterviewpro.com/terriblewhiteboard ⌨️ 20% off CoderPro: coderpr...
Longest Consecutive Sequence | LeetCode 128 | Coding Interview Tutorial
zhlédnutí 4,7KPřed 4 lety
Longest Consecutive Sequence solution: LeetCode 128 Code and written explanation: terriblewhiteboard.com/longest-consecutive-sequence-leetcode-128/ Link to problem: leetcode.com/problems/longest-consecutive-sequence/ Buy Me a Coffee: www.buymeacoffee.com/terriblewboard AFFILIATE LINKS If you're interested in learning algorithms, these are great resources. 💻 40% off Tech Interview Pro: techinter...
Longest Substring Without Repeating Characters | LeetCode 3 | Coding Interview Tutorial
zhlédnutí 22KPřed 4 lety
Longest Substring Without Repeating Characters solution: LeetCode 3 Code and written explanation: terriblewhiteboard.com/longest-substring-without-repeating-characters/ Link to problem: leetcode.com/problems/longest-substring-without-repeating-characters/submissions/ Buy Me a Coffee: www.buymeacoffee.com/terriblewboard AFFILIATE LINKS If you're interested in learning algorithms, these are great...
Trapping Rain Water | LeetCode 42 | Coding Interview Tutorial
zhlédnutí 19KPřed 4 lety
Trapping Rain Water solution: LeetCode 42 Code and written explanation: terriblewhiteboard.com/trapping-rain-water-leetcode-42/ Link to problem: leetcode.com/problems/trapping-rain-water/ Buy Me a Coffee: www.buymeacoffee.com/terriblewboard AFFILIATE LINKS If you're interested in learning algorithms, these are great resources. 💻 40% off Tech Interview Pro: techinterviewpro.com/terriblewhiteboar...
Is Subsequence | LeetCode 392 | Google Coding Interview Tutorial
zhlédnutí 3,5KPřed 4 lety
Is Subsequence solution: LeetCode 392 Code and written explanation: terriblewhiteboard.com/is-subsequence-leetcode-392/ Link to problem on LeetCode: leetcode.com/problems/is-subsequence/ Buy Me a Coffee: www.buymeacoffee.com/terriblewboard AFFILIATE LINKS If you're interested in learning algorithms, these are great resources. 💻 40% off Tech Interview Pro: techinterviewpro.com/terriblewhiteboard...
Range Sum Query | LeetCode 303 | Coding Interview Tutorial
zhlédnutí 4,5KPřed 4 lety
Range Sum Query solution: LeetCode 303 Code and written explanation: terriblewhiteboard.com/range-sum-query-leetcode-303/ Link to problem: leetcode.com/problems/range-sum-query-immutable/ Buy Me a Coffee: www.buymeacoffee.com/terriblewboard AFFILIATE LINKS If you're interested in learning algorithms, these are great resources. 💻 40% off Tech Interview Pro: techinterviewpro.com/terriblewhiteboar...
Remove Linked List Elements | LeetCode 203 | Coding Interview Tutorial
zhlédnutí 5KPřed 4 lety
Remove Linked List Elements solution: LeetCode 203 Code and written explanation: terriblewhiteboard.com/remove-linked-list-elements-leetcode-203/ Link to problem: leetcode.com/problems/remove-linked-list-elements/ Buy Me a Coffee: www.buymeacoffee.com/terriblewboard AFFILIATE LINKS If you're interested in learning algorithms, these are great resources. 💻 40% off Tech Interview Pro: techintervie...
Intersection of Two Arrays | LeetCode 349 | Lyft Coding Interview Tutorial
zhlédnutí 7KPřed 4 lety
Intersection of Two Arrays solution: LeetCode 349 Code and written explanation: terriblewhiteboard.com/intersection-of-two-arrays-leetcode-349/ Link to problem: leetcode.com/problems/intersection-of-two-arrays/ Buy Me a Coffee: www.buymeacoffee.com/terriblewboard AFFILIATE LINKS If you're interested in learning algorithms, these are great resources. 💻 40% off Tech Interview Pro: techinterviewpr...
Missing Number | LeetCode 268 | Amazon Coding Interview Tutorial
zhlédnutí 4,9KPřed 4 lety
Missing Number solution: LeetCode 268 Code and written explanation: terriblewhiteboard.com/missing-number-leetcode-268/ Link to problem: leetcode.com/problems/missing-number/ Buy Me a Coffee: www.buymeacoffee.com/terriblewboard AFFILIATE LINKS If you're interested in learning algorithms, these are great resources. 💻 40% off Tech Interview Pro: techinterviewpro.com/terriblewhiteboard ⌨️ 20% off ...
Number of Islands | LeetCode 200 | Google Coding Interview Tutorial
zhlédnutí 10KPřed 4 lety
Number of Islands solution: LeetCode 200 Code and written explanation: terriblewhiteboard.com/number-of-islands-leetcode-200/ Link to problem: leetcode.com/problems/number-of-islands/ Buy Me a Coffee: www.buymeacoffee.com/terriblewboard AFFILIATE LINKS If you're interested in learning algorithms, these are great resources. 💻 40% off Tech Interview Pro: techinterviewpro.com/terriblewhiteboard ⌨️...
Find All Numbers Disappeared in an Array | LeetCode 448 | Google Coding Interview Tutorial
zhlédnutí 11KPřed 4 lety
Find All Numbers Disappeared in an Array solution: LeetCode 448 Code and written explanation: terriblewhiteboard.com/find-all-numbers-disappeared-in-an-array-leetcode-448/ Link to problem on LeetCode: leetcode.com/problems/find-all-numbers-disappeared-in-an-array/ Buy Me a Coffee: www.buymeacoffee.com/terriblewboard AFFILIATE LINKS If you're interested in learning algorithms, these are great re...
Balanced Binary Tree | LeetCode 110 | Coding Interview Tutorial
zhlédnutí 8KPřed 4 lety
Balanced Binary Tree | LeetCode 110 | Coding Interview Tutorial
Binary Tree Level Order Traversal | LeetCode 102 | Google Coding Interview Tutorial
zhlédnutí 4,4KPřed 4 lety
Binary Tree Level Order Traversal | LeetCode 102 | Google Coding Interview Tutorial
Factorial Trailing Zeroes | LeetCode 172 | Coding Interview Tutorial
zhlédnutí 10KPřed 4 lety
Factorial Trailing Zeroes | LeetCode 172 | Coding Interview Tutorial
Linked List Cycle | LeetCode 141 | Coding Interview Tutorial
zhlédnutí 8KPřed 4 lety
Linked List Cycle | LeetCode 141 | Coding Interview Tutorial
Most Common Word | LeetCode 819 | Amazon Coding Interview Tutorial
zhlédnutí 3,7KPřed 4 lety
Most Common Word | LeetCode 819 | Amazon Coding Interview Tutorial
House Robber | LeetCode 198 | Google Coding Interview Tutorial
zhlédnutí 10KPřed 4 lety
House Robber | LeetCode 198 | Google Coding Interview Tutorial
Valid Perfect Square | LeetCode 367 | Coding Interview Tutorial
zhlédnutí 3,1KPřed 4 lety
Valid Perfect Square | LeetCode 367 | Coding Interview Tutorial
Binary Tree Level Order Traversal II | LeetCode 107 | Coding Interview Tutorial
zhlédnutí 5KPřed 4 lety
Binary Tree Level Order Traversal II | LeetCode 107 | Coding Interview Tutorial
Minimum Depth of Binary Tree | LeetCode 111 | Coding Interview Tutorial
zhlédnutí 7KPřed 4 lety
Minimum Depth of Binary Tree | LeetCode 111 | Coding Interview Tutorial
Maximum Depth of Binary Tree | LeetCode 104 | Google Coding Interview Tutorial
zhlédnutí 5KPřed 4 lety
Maximum Depth of Binary Tree | LeetCode 104 | Google Coding Interview Tutorial
Symmetric Tree | LeetCode 101 Amazon Coding Interview Tutorial
zhlédnutí 7KPřed 4 lety
Symmetric Tree | LeetCode 101 Amazon Coding Interview Tutorial
Path Sum | LeetCode 112 | Amazon Coding Interview Tutorial
zhlédnutí 5KPřed 4 lety
Path Sum | LeetCode 112 | Amazon Coding Interview Tutorial
Same Tree | LeetCode 100 | Google Coding Interview Tutorial
zhlédnutí 3,2KPřed 4 lety
Same Tree | LeetCode 100 | Google Coding Interview Tutorial
Find the Difference | LeetCode 389 | Google Coding Interview Tutorial
zhlédnutí 1,7KPřed 4 lety
Find the Difference | LeetCode 389 | Google Coding Interview Tutorial
Palindrome Linked List | LeetCode 234 | Coding Interview Tutorial
zhlédnutí 11KPřed 4 lety
Palindrome Linked List | LeetCode 234 | Coding Interview Tutorial

Komentáře

  • @reyou7
    @reyou7 Před 2 měsíci

    Best of the best explanation. I think understanding the problem here is the biggest challenge than actually solving it. Row 1: "1" (Base case) Row 2: "11" (Previous has one 1s) Row 3: "21" (Previous has two 1s) Row 4: "1211" (Previous has one 2s and one 1s) Row 5: "111221" (Previous has one 1s and one 2s and two 1s) Row 6: "312211" (Previous had three 1s and two 2s and one 1s)

  • @valenciawalker6498
    @valenciawalker6498 Před 9 měsíci

    Thank you.

  • @Richard-yz2gy
    @Richard-yz2gy Před 10 měsíci

    how does the tree have a right side of one if they all none on the right side??

  • @TonyGAndTheWhitefish

    This was one of the best LeetCode explanations I have ever watched!

  • @SoraJustAGuy
    @SoraJustAGuy Před rokem

    im new to this and this problem , although easy, gave me a major headache , cuz i did not know how to run code, and had no idea how to implement it, just to see how it works

  • @erey2790
    @erey2790 Před rokem

    nice explanation at the end <3

  • @iiju8212
    @iiju8212 Před rokem

    Visiting your channel after 2-3 years. Hope you are good.

  • @shadmanmartinpiyal4057

    // another solution, I guess faster /** * @param {number} n * @return {string} */ var countAndSay = function (n) { if (n === 1) return "1"; let finalResult = "1" for (let i = 2; i <= n; i++) { let stringInFocus = finalResult; let currentResult = ""; let counter = 1; let prevCharacterIndex = 0; let currentCharacterIndex = 1; while (!!stringInFocus[currentCharacterIndex]) { if ( stringInFocus[currentCharacterIndex] === stringInFocus[prevCharacterIndex] ) { counter++; } else { currentResult = `${currentResult}${counter}${stringInFocus[prevCharacterIndex]}`; prevCharacterIndex = currentCharacterIndex; counter = 1; } currentCharacterIndex++; } currentResult = `${currentResult}${counter}${stringInFocus[prevCharacterIndex]}`; finalResult = currentResult; } return finalResult; };

  • @shadmanmartinpiyal4057

    // following solution is similar to "Level order travelsal ii" var minDepth = function(root) { if(!root) return 0; if(!root.left && !root.right) return 1; let q = [root], depth = 0, isFound = false; while(q.length !== 0 && !isFound){ let nodeCount = q.length; while(nodeCount !== 0){ const current = q.shift(); if(!current.left && !current.right){ isFound = true; break; } if(current.left) q.push(current.left); if(current.right) q.push(current.right); nodeCount--; } depth++ } return depth; }

  • @shadmanmartinpiyal4057

    // following solution is identical to the solution of the "Balanced binary tree" var maxDepth = function(root) { if(!root) return 0; function getHeight(node){ if(!node) return 0; let left = getHeight(node.left) let right = getHeight(node.right) return Math.max(left, right) + 1 } return getHeight(root) };

  • @shadmanmartinpiyal4057

    var isSubsequence = function(s, t) { let pS = 0, pT = 0; while(!!s[pS] && !!t[pT]){ if(s[pS] === t[pT]){ pS++; } pT++; } return (pS - 1) === (s.length - 1) };

  • @vivienpmc
    @vivienpmc Před rokem

    Well explained!

  • @shaniceshipp8677
    @shaniceshipp8677 Před rokem

    took me forever to get this

  • @GraceandWisdom
    @GraceandWisdom Před rokem

    Hello TW, I have been learning Javascript at a slow pace. I am still outside of the software engineering and development universe (I don't have a job in this field, yet.). I am in my late 50s and have desired to learn code for a while. With regard to my previous attemps of learning programming, I was quite confused by the complexity of writing instructions that a computer can comprehend. Your videos have lessened the fear and confusion that I havepreviously experienced when it comes to leetcode problems. Thank you and I hope to return the favor to you, soon.

  • @alonshlider4881
    @alonshlider4881 Před rokem

    THANK YOU FOR SPEAKING NON INDIAN ENGLISH! 🙏

  • @TekkenRoom
    @TekkenRoom Před rokem

    great explanation

  • @cupofjava5480
    @cupofjava5480 Před rokem

    didn't pay much attention and thought you coded in java :)) , anyways very good teaching , I finally understood this 1d dp

  • @antutucat8231
    @antutucat8231 Před rokem

    thanks

  • @matekimagick
    @matekimagick Před rokem

    This is fantastic and I can't thank you enough for speaking calmly enough to grasp what you are saying without having to repeatedly rewind, as so many tutorials require lol. I will definitely look for more of your videos. (subscribed✔)

  • @RAJUBHAI-ww7em
    @RAJUBHAI-ww7em Před rokem

    Thanks mate

  • @RAJUBHAI-ww7em
    @RAJUBHAI-ww7em Před rokem

    Hmmmm

  • @TheCaioFreitas
    @TheCaioFreitas Před rokem

    Dude, this was so helpful with the visuals on the left side breaking down the code! liked and subbed

  • @chips-n-salsa
    @chips-n-salsa Před rokem

    thank you for making these! Still helpful 2 years later! Your explanations are super helpful!

  • @shadmanmartinpiyal4057

    var lengthOfLastWord = function(s) { return s.trim().split(" ").filter(each => each !== "").slice(-1)[0].length };

  • @dinner4chiahao
    @dinner4chiahao Před rokem

    Super clear explanation!

  • @shadmanmartinpiyal4057

    var majorityElement = function(nums) { const half = nums.length / 2; let charMap = {} for(let each of nums){ !charMap[each] ? charMap[each] = 1 : charMap[each] += 1 if(charMap[each] > half) return each; } return -1 };

  • @shadmanmartinpiyal4057

    // this beats 74.79% of the leetcode solutions var intersection = function(nums1, nums2) { return Array.from(new Set(nums1.filter(each => nums2.includes(each)))) };

  • @shadmanmartinpiyal4057

    var intersection = function(nums1, nums2) { let finalResult = [] let nums1_uniques = new Set(nums1); for(let each of nums2){ if(!finalResult.includes(each) && nums1_uniques.has(each)){ finalResult.push(each) } } return finalResult };

  • @IRLVaporwave
    @IRLVaporwave Před rokem

    Here is my regex approach to the isValidCharacter function: _function_ isValidCharacter(char) { *return* char.length === 1 && char.toLowerCase().match(/[a-z0-9]/i); }

  • @IRLVaporwave
    @IRLVaporwave Před rokem

    The intro song pulls me in every time. Anyone know the name of it?

  • @IRLVaporwave
    @IRLVaporwave Před rokem

    I think you should rebrand to "Terrific Whiteboard"

  • @leetcode2233
    @leetcode2233 Před rokem

    Why did you stop making videos?

  • @Inf1nity0
    @Inf1nity0 Před rokem

    Thank you. EXCELLENT explanation! Interview prep is such a grind sometimes... When you have questions about a problem and you can watch a 25m video and come away crystal clear.. its invaluable

  • @6lack-Echo
    @6lack-Echo Před rokem

    Have some of the best explaination on CZcams rlly learned a lot, you should post more man would love a watch a whole DS&A playlist by you and the way you explain things with the drawings! cheers.

  • @seth_king_codes
    @seth_king_codes Před rokem

    fantastic explanation

  • @modamo_yt
    @modamo_yt Před rokem

    Slight improvement (?): You don't need the break keyword, you can just return lastWordLength and it will break out the loop

  • @mahinarafat1447
    @mahinarafat1447 Před rokem

    This was the best explanation among all others!

  • @seth_king_codes
    @seth_king_codes Před rokem

    simple explanation, made a lot of sense to me

  • @HackeyTube
    @HackeyTube Před rokem

    Explain why you used this mid point calculation formula.. getting confused with regular binary search

  • @itsamialessandro402

    Dude. Such a great job with the explanation! Thanks so much! Also, see you haven't posted in about 2 years, hope you're doing well.

  • @melanieprevot4926
    @melanieprevot4926 Před rokem

    Super explanation ! Watched many videos, yours is definitely the clearest one. Thank you so much !

  • @sunevolve
    @sunevolve Před rokem

    I only understood your sol after searching all over, the way u name the var as pointer actually helped me a lot.

  • @ycchne
    @ycchne Před rokem

    the best explanation I’ve ever seen so far. Great work! Thank you

  • @Ww-ul8oe
    @Ww-ul8oe Před rokem

    Underrated channel. You are the best. Please upload more videos.

  • @lodashnotebook5390
    @lodashnotebook5390 Před rokem

    beautiful.

  • @leetcode2233
    @leetcode2233 Před rokem

    Hi. Why did you stop making videos?

  • @buzzyso
    @buzzyso Před 2 lety

    That was really confusing to understand.

  • @juanceja899
    @juanceja899 Před 2 lety

    i love your explanations and videos. subscribed!

  • @ytshorts1277
    @ytshorts1277 Před 2 lety

    Thank you for great explanation

  • @algocodes
    @algocodes Před 2 lety

    Thanks Whiteboard... your not that terrible dude hahaha