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.
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)
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.
// 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
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!
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.
You're welcome! Yeah, it took me a while to understand the solution and I couldn't find an explanation anywhere.
yes thats true, the description of this problem is actually the worst
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)
great explanation, the slower the clearer I personally feel
Thanks!
Thnaks Buddy, You did amazing!
Thanks!
great explanation , i dint understand the question at first place
Thanks!
Thank you so much!!! I watched so many videos but couldnt understand how to write the code. After watching yours I understand it now!
Best explanation for this question! Thank you for uploading!
Thanks!
amazing video, your video made it so clear and easy to understand, thank you so much! I really appreciate it!
You're welcome!
great explanation....!!! thanks
why are we decreasing n in the ned? I thought since the row is starting from the beginning so it should be increasing n?
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.
very good explanation :+1
Thanks!
What app is that the one you use?
It's just the Notes app on the iPad and I draw using the Apple Pencil.
Great explanation. What is the time complexity for this problem?
could you code it in c++ ,it would be better to understand ,though the logic pretty clear .
good explanation
Thanks!
Great solution, what is the time complexity of this solution?
lol damn 7516 poeple hate this question.
you explain fine but its a little boring
Thanks!
// 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