Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Hi seraph776! Your solution appears to be quite creative, but regrettably, it is SLOWER and INEFFICIENT.
The time complexity of your function is O(n^2), while mine is O(n). With that being said, yours is SLOWER.
Let's see if is WAY SLOWER. Don't believe me, just watch, come on!
Both functions used the same text for the tests, and the text was generated randomly using:
Besides, as you can see, YOUR FUNCTION DOES NOT SUPPORT LONG STRING CHAINS.
Why?
Happy to help you, nice try! 😁
Hmph, I think my version is way faster than yours! 😁
Thx snoopythekid! Glad you liked it! This is an old debate; I simply used acquired knowledge.
I tried making a faster version, but yours is faster than everythng I tried. Congrats
import codewars_test as test
x = lambda a: ''.join(reversed(a))
@test.describe("Main")
def main_tests():
@test.it("Test 1")
def test1():
test.assert_equals(x("hello"), "olleh")
test.run_tests()