Very nice explanation. Pura ka pura logic samajh gaya. Apke logic se code maine khud hi solve kar diya. Thanks Sir!!! (That superbike sound in the BG tho...)
Just started strings playlist.😊 As per question its hard to understand but after your explanation it is easy for me to understand... Thank you for making such a great videos for us🙏
Today i sit in a OA of a company ,and it is the 1st question out of 3 , i could not understand this question, i totally got panicked and won't able to solve a single question.;)
bhai tera explaination poora dekhne se pehle hi karliya if n ==1: return str(1) else : temp = str(self.countAndSay(n-1)) prev = temp[0] length=1 ans="" for i in range(1,(len(temp))): if prev == temp[i] : length+=1 else : ans =ans+str(length) ans +=prev prev = temp[i] length =1 ans +=str(length) ans +=prev return ans
sir pheli baar hindi dekhi coding ke question ... pura 1-12th ka hindi medium school yaad agya
Very nice explanation. Pura ka pura logic samajh gaya. Apke logic se code maine khud hi solve kar diya. Thanks Sir!!! (That superbike sound in the BG tho...)
😇🙌🙏
Thanks a lot
Damn I saw so many explanations but couldn't understand anyone, you explained in a magical way, it was so amazing, thank you!!
whats the time and space complexity?
Just started strings playlist.😊
As per question its hard to understand but after your explanation it is easy for me to understand... Thank you for making such a great videos for us🙏
So glad it helped
Thank you 😇🙏
Dude this became so easy. Thanks
Very nice handwriting
Very Great Explaination ❤❤👋👋
great explanation! hidden gem of a video
Understood and code it on my own thanks bro
Amazing !
.
.
.
.
.
.
class Solution:
def countAndSay(self, n: int) -> str:
if n == 1 :
return '1'
def helper(n) :
if n == 1 :
return '1'
say = helper(n - 1)
# processing
i,j = 0,1
res = ''
count = 1
while j < len(say) :
if say[i] == say[j] :
count += 1
else:
res += str(count) + say[i]
count = 1
i = j
j += 1
res += str(count) + say[i]
return res
return helper(n)
bdiya smjha ya apne
Such a fine explanation man. 🙌
why length is say.length() instead of i
Today i sit in a OA of a company ,and it is the 1st question out of 3 , i could not understand this question, i totally got panicked and won't able to solve a single question.;)
Thank you for sharing but it’s ok, keep practising and soon you will be able to crack interviews.
Would you mind sharing which company’s OA was it ?
@@codestorywithMIK it is on-campus company name is zessta.
great teacher
One of the best explanation and as you said explanation on Leetcode is Pathetic, Keep it up
Excellent explanation!
Glad it was helpful! ❤️❤️
please came up with " Remove Outermost Parentheses" solution
nice bhaiya tgra logic build and inituiton
Thank you so much ❤️
bro but this goes off to exponential complexity (2^n) , if interviewer expects us to optimize it then ?
class Solution:
def rec(self,n):
if n==1:
return "1"
temp=self.rec(n-1)
count=1
ch=temp[0]
ns=""
for i in range(1,len(temp)):
if temp[i]==ch:
count+=1
elif ch!=temp[i]:
ns+=str(count)+ch
ch=temp[i]
count=1
ns+=str(count)+ch
return ns
def countAndSay(self, n: int) -> str:
return self.rec(n)
Done✅
what about the follow up question ?
Thank you sir 😊
Appreciate your comments ❤️
what is the time complexity for this question?
What is the time complexity for this?
please explain time ans space complexity
Thanks alot.. feedback- you need to level up your thumbnail game
Bhaiya java me solve karvao pls
I coded the same solution with typescript but got a low score on time and space complexity.
why recursion, why not a for loop?
You can loop this too i guess.
Recursion seems more easy to me . So i choose Recursion mostly
Paypal asked this question in it's offcampus interview😅😅
Noise cancellation wala mic use✅Please✅
Sure ❤️
bhai tera explaination poora dekhne se pehle hi karliya if n ==1:
return str(1)
else :
temp = str(self.countAndSay(n-1))
prev = temp[0]
length=1
ans=""
for i in range(1,(len(temp))):
if prev == temp[i] :
length+=1
else :
ans =ans+str(length)
ans +=prev
prev = temp[i]
length =1
ans +=str(length)
ans +=prev
return ans
var countAndSay = function (n) {
if (n === 1) return '1';
return countAndSay(n - 1)
.match(/1+|2+|3+/g)
.reduce((acc, nums) => acc += `${nums.length}${nums[0]}`, '')
}; much simpler