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 just got my similarish Python code to pass, and perhaps the differences between our two implementations make the difference. On that basis, I would suggest:
a. Changing S to a List data-type instead of leaving it as a String. Lists are mutable, strings are not, and this would cause performance differentials.
b. Avoiding Python's splice operators and instead using plain old loops with pop() or del. The slice operators are known to be slow.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Simple Text Editor
You are viewing a single comment's thread. Return to all comments →
I just got my similarish Python code to pass, and perhaps the differences between our two implementations make the difference. On that basis, I would suggest:
a. Changing S to a List data-type instead of leaving it as a String. Lists are mutable, strings are not, and this would cause performance differentials.
b. Avoiding Python's splice operators and instead using plain old loops with pop() or del. The slice operators are known to be slow.