Leetcode Weekly contest 356 - Medium - Shortest String That Contains Three Strings

preview_player
Показать описание
In this video we discuss the third problem of Leetcode Weekly contest 356

Рекомендации по теме
Комментарии
Автор

Hi,
Thank you for posting the great solution.
I used your approach only to solve the problem but instead of merging a and b first I merged b and c first then merged a with merged b and c.
In your code you did this : merge ( merge (a, b), c)
What I did : merge ( a, merge (b, c))
and I am getting wrong answer for the below input:
a = "aba"
b = "c"
c = "b"

output : caba
expected: abac


does the merge order matter? Not able to understand why i should do merge ( merge (a, b), c) instead of merge ( a, merge (b, c)).

abhaykatiyar
Автор

at 7:04, sir isn't it kmp algo??

prathampahad
Автор

Loved the beautiful way of writing code ❤

decostarkumar
Автор

What a explanation ❤❤❤ seriously u made it easy for me to understand thank you sir
Keep encouraging us

karthiknayak
Автор

suppose we have 2 string as "aaaab" and "baaaa", after merging according to your code the ans is "aaaabaaaa" but the smallest length ans shold be "baaaab" after merging. What about this???
You are using only one way of merging the strings. Strings should be merged both ways for calculating shortest length ig. Can anyone explain????

bhushanasutkar
Автор

thank you bhaiya for the simple solution

siddhantdwivedi
join shbcf.ru