Very well explained. Very useful. Thank you very much.
@MiravMehtaishere
3 жыл бұрын
Loved it. Keep doing, waiting for more...!
@johnthompson4011
2 жыл бұрын
Cheers for this guy
@shawnfrank5303
2 жыл бұрын
Nice explanation. The only confusion I have is that while you rightfully mention, we need to handle the odd and even case. I am just a bit confused, there does not seem to be an if condition to differentiate if we are in an odd or even scenario and it seems that we just run the odd and even case regardless ... I feel like I do not grasp that part properly.
@akx_edits3374
2 жыл бұрын
i hv the same doubt,how does it even work that way
@shawnfrank5303
2 жыл бұрын
@@akx_edits3374 after working on this on my own in (Swift) , I realized you have to check the even and odd condition always. Let me try my best to explain. For example abbbd. The length is 5 which is odd and so we think the midpoint should be 1 character. Using that approach as we follow the algorithm in this video, when we reach the b at position 3(index 2) to give us the biggest palindrome bbb which is 3. However, for another 5 character string abbda, the same approach will fail because we think odd length strings should have 1 character midpoints so we will miss bb of length 2. The only way to succeed is to run the check with 1 character midpoints and 2 character midpoints because the palindrome itself can be of even or odd lengths and that is why we need to do this dual check. Hope this clarifies your question. Good luck
Пікірлер: 11