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.
Common source of long execution is the complexity of + operator (or append method) for strings. It's of Appending two strings, one of length N, other of M, is of complexity O(N+M). Here it's repeatitive addition, so it can be of quadratic complexity.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
String Mingling
You are viewing a single comment's thread. Return to all comments →
Hi @blowkj, sorry can't find your solution.
Common source of long execution is the complexity of
+
operator (or append method) for strings. It's of Appending two strings, one of length N, other of M, is of complexityO(N+M)
. Here it's repeatitive addition, so it can be of quadratic complexity.