Count and Say | LeetCode 38 | Coding Interview Tutorial

Sdílet
Vložit
  • čas přidán 7. 09. 2024

Komentáře • 32

  • @TerribleWhiteboard
    @TerribleWhiteboard  Před 4 lety +8

    If there are any videos you'd like me to make or if you have any ideas on how to optimize this solution, let me know!

  • @hennadiikasian4389
    @hennadiikasian4389 Před 4 lety +29

    Thanks for the explanation. I had never got the point of this problem, until I saw this video. You can see it from the problem description. This task has ~200 likes and ~7000 dislikes on Leetcode.

    • @TerribleWhiteboard
      @TerribleWhiteboard  Před 4 lety +13

      You're welcome! Yeah, it took me a while to understand the solution and I couldn't find an explanation anywhere.

    • @pratiks29
      @pratiks29 Před 3 lety

      yes thats true, the description of this problem is actually the worst

  • @reyou7
    @reyou7 Před 3 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)

  • @lingyundai964
    @lingyundai964 Před 4 lety +5

    great explanation, the slower the clearer I personally feel

  • @DS-Academy
    @DS-Academy Před 4 lety +7

    Thnaks Buddy, You did amazing!

  • @amitbhattacharyya5925
    @amitbhattacharyya5925 Před 4 lety +4

    great explanation , i dint understand the question at first place

  • @abigaillee9759
    @abigaillee9759 Před 3 lety

    Thank you so much!!! I watched so many videos but couldnt understand how to write the code. After watching yours I understand it now!

  • @nora8200
    @nora8200 Před 3 lety

    Best explanation for this question! Thank you for uploading!

  • @quirkyquester
    @quirkyquester Před 3 lety

    amazing video, your video made it so clear and easy to understand, thank you so much! I really appreciate it!

  • @piyushupadhyay8361
    @piyushupadhyay8361 Před 2 lety

    great explanation....!!! thanks

  • @lingyundai964
    @lingyundai964 Před 4 lety +4

    why are we decreasing n in the ned? I thought since the row is starting from the beginning so it should be increasing n?

    • @TerribleWhiteboard
      @TerribleWhiteboard  Před 4 lety +3

      It's just used to count the number of rows, and in this solution, I'm counting backwards from n to 1. When n is 1, I return the answer. I could have started from row 1 and counted up, but I did it the other way instead.

  • @aymanibrahim1928
    @aymanibrahim1928 Před 4 lety +4

    very good explanation :+1

  • @sergekov3804
    @sergekov3804 Před 4 lety +11

    What app is that the one you use?

    • @TerribleWhiteboard
      @TerribleWhiteboard  Před 4 lety +14

      It's just the Notes app on the iPad and I draw using the Apple Pencil.

  • @Shiva-zy7jq
    @Shiva-zy7jq Před 3 lety

    Great explanation. What is the time complexity for this problem?

  • @sunidhihegde242
    @sunidhihegde242 Před 3 lety

    could you code it in c++ ,it would be better to understand ,though the logic pretty clear .

  • @shekbake4389
    @shekbake4389 Před 3 lety +1

    good explanation

  • @codingandmusical6542
    @codingandmusical6542 Před 3 lety

    Great solution, what is the time complexity of this solution?

  • @Turnpost2552
    @Turnpost2552 Před 3 lety

    lol damn 7516 poeple hate this question.

  • @financewithsom485
    @financewithsom485 Před 4 lety +4

    you explain fine but its a little boring

  • @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