We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I didn't understand why you need 2*commonLength in your first condition.
Kmin = commonLength + delete_bigger_word + add_small_word
delete_bigger_word = number of delete operations required in longer word.
add_small_word = number of addition operations required in smaller word to be equal to larger_word
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Append and Delete
You are viewing a single comment's thread. Return to all comments →
I didn't understand why you need
2*commonLength
in your first condition.Kmin = commonLength + delete_bigger_word + add_small_word
delete_bigger_word
= number of delete operations required in longer word.add_small_word
= number of addition operations required in smaller word to be equal to larger_word