Find and Replace Pattern | Leetcode 890 | Live coding session

preview_player
Показать описание
Here is the solution to "Find and Replace Pattern" leetcode question. Hope you have a great time going through it.

Chapters
1) 0:00 Explaining the problem out loud
2) 1:10 Algorithm walkthrough
3) 2:00 Test case walk through
4) 5:00 Coding it up

For discussion/feedback

PS : Please increase the speed to 1.25X
Рекомендации по теме
Комментарии
Автор

din acha nahi gaya tha raat me smiling image dekh ke achanak hasi aa gayi :-)

Noob_Engineer
Автор

Hi Bhai,
Thanks for this solution. Please correct me if I am wrong about the TC here:
1. normalize method would take O(wordLen) + equals method would take O(wordLen) + O(N) for all the words. So shouldn't this be O(N*wordLen^2) solution, right? This gives runtime of 5ms.
2. Instead of returning String in normalize method, we can create an integer value and return it. This would compare the 2 integers in constant time and TC would just be O(N*wordLen). Also with this, runtime improves to 2ms.

abhishekjain
Автор

in india, it should be 01203, instead of 01213,
correct me if i am wrong

_danishranjan
Автор

Bhaiya this is giving wrong output for test case ["abcdefghijkba"], "qwertyuiopwqa". I dry ran it several times and everything seems to be fine but donno why it doesn't work. Please have a look!

sourin.majumdar
welcome to shbcf.ru