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.
I've never knew about these methods before, very nice one!!
Fork rewriting description
It's probably far from perfect but I do think its much better. I am open to suggestions on it though.
Duplicate issue. And also fixed now anyway
.
Needs better random tests: https://www.codewars.com/kata/reviews/5966fb94ccb55fb44b000e55/groups/62b1cf68c67c0d00015ceb04
The description does not really explain how the algorithm works. It doesn't just combine the last/first
1
character, but as many as are common from the beginning and end of the separate words.For example,
'fat ata tape' => 'fatape'
.The description has no such example, even though it's made mostly clear by the test cases. This makes it a little more challenging.
Done.
There is the eternal tension between performance and simplicity, readability and maintainability, in the light of the ranking of the kata.
I tried once, for a too short while, to achieve what you did, but didn't think it through enough and gave up too quickly; I never got there. Kudos for your solution.
But being disappointed in less performant but correct and readable solutions to a
7kyu
kata seems setting yourself up for a lot of disappointment. :PHaskell probably doesn't need specific description even with
Maybe Like
- it'll be in the function signature, and Haskellers should be used to throwing inJust
, even if not explicitly specified, when they seeNothing
in the description andMaybe
in the initial code signature.Enumerations are newest php 8.1 (8.0 latest on codewars) feature so i can just preload consts?
I'm pretty disappointed to see everyone's solution running in (best case)
Ω(n)
time instead of (worst case)O(n)
and average expected value ofO(2)
for large random tests.WOW!!You're a genius!!!
Commenting so it saves this solution on my account. This is truly genius, thank you
pig_it("I agree!!!")