Please fill the feedback form: forms.gle/52XsaRWXd2P4pBqz5
@sdeBack1
Ай бұрын
We can further optimize. Instead of storing index, we can store cost .Each time when we end at same char we store min cost
@gigachad2419
Ай бұрын
Trie+DP fails few testcases within constraints. Was expecting Rolling Hash+DP solution.
@user-ym1nv1pw8i
Ай бұрын
Yes
@apnachannelnitp1833
Ай бұрын
Yes
@virujthakur9260
Ай бұрын
Isn't the code's complexity isn't N^2 in worst case? How does it pass the constraints?
@apnachannelnitp1833
Ай бұрын
solution of question 4 will give TLE.
@inspirationalshorts2689
Ай бұрын
About question 4 their is not any another way to solve without using Trie because in my first instance it will seem familiar of recursion + memoization of pick or notPick because ultimately we have to calculate minimum cost to formed target string by using substring matching way on recursion by taking start index? Everyone only talking about using Trie to solve this question that's mean their is no another way left to solve this question.
@AMITKUMAR-sz4fg
Ай бұрын
give a try using rolling hash
@inspirationalshorts2689
Ай бұрын
@@AMITKUMAR-sz4fg Can you elaborate more about rolling hash to solve this problem it will be more beneficial.
@Cools74
Ай бұрын
@@inspirationalshorts2689 Refer Coding mohan channel He explained using rolling hash
Пікірлер: 14