Have been looking at multiple tutorial videos and found none that is as clear and straight forward like yours!
@NafBlu
3 жыл бұрын
OMG! thanks for this answer. optimal and simple and elegant answer
@timc3406
3 жыл бұрын
You're very welcome!
@udayptp
2 жыл бұрын
Saw many videos for this, all of them were confusing a lot. I watched videos of length 20min, 32 mins but i was not satisfied with their explanation. I understood this algo from your video. Thanks.
@jacknjrzy3965
3 жыл бұрын
Dude this is so easy to understand, thank you very much.
@gunahawk6893
2 жыл бұрын
u deserve more subscribers bruh
@edwardteach2
3 жыл бұрын
Man you must be thinking all day about that spaghetti code
@timc3406
3 жыл бұрын
LOL
@elegentt2900
4 жыл бұрын
Great work!
@chands.3207
3 жыл бұрын
Great! looking for it for 2 days.
@gunahawk6893
2 жыл бұрын
man this is great
@thiru9923
4 жыл бұрын
maxlength=0 maxvalue="" for i in range(len(s)): for j in range(i+1,len(s)+1): a=s[i:j] if a==a[::-1] and len(a)>maxlength: maxlength=len(a) maxvalue=a print(maxvalue) Is this solution is same time complexity as yours?
@timc3406
4 жыл бұрын
Hmmm I think it is same time complexity but best case will be n^2 while mine is worst case n^2, I'm not positive though
@kaustubh.sharma
3 жыл бұрын
it's time complexity is n^3 i think
@juanmoscoso0
3 жыл бұрын
no this is n^3
@yuqingwang3593
3 жыл бұрын
@@timc3406 Why your time complexity is not O(nlogn)? Why the check from the middle is O(n) instead of O(logn)?
@mamtakumari-ud7in
3 жыл бұрын
Is it the same thing that the helper function returns s[l:r+1] instead because python lists are 0 indexed and thus putting the ending index to r+1 would ensure that we slice string till r and it's not excluded. Putting starting index as l+1 isn't making sense to me. Could you please confirm?
@timc3406
3 жыл бұрын
I think so!
@nielskjer9415
2 жыл бұрын
doesnt work that way in this solution
@tonynguyen6124
2 жыл бұрын
You have the right idea, but it doesn't work in this solution because in the helper method, when it reaches the fully palindromic substring, it still pushes the pointers 1 more time. e.g. qabaz b, then a-a, then q-z, then it fails the check and loop ends. now the pointers are at q-z, we use l+1, then r since python's slicing is [inclusive: not inclusive]
@fabio336ful
Жыл бұрын
@@tonynguyen6124 Thanks for your answer, now it has sense to me!
@JohnDoe19754
3 жыл бұрын
Thanks for the simple solution
@timc3406
3 жыл бұрын
You're welcome!
@aadishjain6838
3 жыл бұрын
that's beautiful
@kevinsun3958
3 жыл бұрын
nice tyyy
@geetchoudhari7708
4 жыл бұрын
great
@timc3406
4 жыл бұрын
Thanks!
@huanchenli4137
4 жыл бұрын
You code returns empty result...
@timc3406
4 жыл бұрын
Really? It seems to work for me, here is the code: c = Counter(s) output = 0 for count in c.values(): output += int(count/2) * 2 if output % 2 == 0 and count % 2 == 1: output+=1 return output
@experimentalhypothesis1137
4 жыл бұрын
nice
@timc3406
4 жыл бұрын
Thanks!
@arpanroychowdhury2961
4 жыл бұрын
What is that filter?! lol thanks for this solution
@timc3406
4 жыл бұрын
No problem!
@maganaluis92
4 жыл бұрын
The thing here is that you're not doing any memoization or DP, while it makes sense it's not very helpful.
@timc3406
4 жыл бұрын
Sorry about that, always open to suggestions!
@CEOofTheHood
4 жыл бұрын
yeah, but those are really needed in a question like this. It's an optimal solution. That's all that should matter. no need to over complicate.
Пікірлер: 38