Hello, how to optimize the code because it takes too much time | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hello, how to optimize the code because it takes too much time

https://code.sololearn.com/ct8IP8yj6gl0/?ref=app I try to find out if it is possible to construct string b out of string a. If it is possible, output is true else false.

30th May 2022, 10:03 AM
TeaserCode
1 Answer
+ 2
your algorithm complexity is O(n²). this is why it takes too much time to run. Try this code. https://code.sololearn.com/cqkl4ySEJJIE I think this is much more simple
30th May 2022, 10:49 AM
Christian Fare T.
Christian Fare T. - avatar