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.
Who said code can't be sexy.
We might introduce a new voting system: Best practice, clever, code resembels boobs. ;-)
This comment is hidden because it contains spoiler information about the solution
Agreed, more like 2-3 for the field size around 40. If it was just 4, you could bruteforce your way through.
Thanks! So it's time to learn Python :-)
On topic:
Are there any requirements to see black Katas, or are ther none such?
I finished all but one purples for PHP and I'm kinda stalling at 3Kyu.
This comment is hidden because it contains spoiler information about the solution
I'd consider a solution a cheat if:
errorneous testing
The solution exploits the fact that not all written requirements are enforced by the unit tests.
Example: You are to return 0,75 as the fraction 3/4, and instead return (3/4)*1000 / 1000.
Error: Test did not enforce reduced and integer return.
Reason why this is a cheat: While passing the test, it doesn't pass the Kata.
Hardcoding beyond reason
You know that there are only so many valid inputs, and you hardcode all possible return values.
Example: The task requires you to do some searching on the first 1000 primes, and instead of generating them, you copy&paste them.
Error: Test did not / cannot enforce sane memory limitations.
Reason why this is a cheat: The solution exploits the fact that codewars wcannot execute scripts taking minutes to run, so sometimes the scope of input must be limited. This shall not be used to circumvent major parts of the workload
I would not consider it a cheat if:
copy&paste
Copy & paste of minor helper functions from the web e.g. stack overflow. This is a gray area and "minor helper function" isn't an exact definition. But if I need to split a string into arrays while working ona Kyu2-Kata, I have no hard feelings about just googling that custom function instead of writing it from scratch.
usage of buildt-in functions
Sometimes your language offers you a funciton to solve a "hard" Kata in mere seconds. Not a cheat: In your specific language, that Kata wasn't hard after all.
You can't avoid recursion withouth avoiding recursion.
Beautiful kata. Short, with a clear idea, and withouth wasting our time with edge-cases and input caludation.
That's the most straight-forward solution, but it kept timing out for me, so I had to optimize further. :/
I've set it as Kyu 5, which is probably about right, but I can't really tell a 5 from a 6 or a 4.
Ok, let's keep it simple: We agree that the actual coding is trivial, so I don't really mind wether there are hints in the code, as long as we keep the hints on the algo in the explanation. Currently I removed them from the PHP version as per your request, so let's keep it that way this time. Just don't remove the description, as I really want folks to attempt this Kata who never thought about such tasks before.
Zed's solution was possible due to a bug in the tests (mea culpa), i.e. his return value was not checked to be integer. That is now solved, so with both divisor and divident being integers, it't impossible to find "incorrect" solutions. Most algoritms that findd ANY solution Will find the reduced one first.
Thanks for your continued effort.
@Johan:
I appreciate your help with ironing out technical issues. I really do.
But please keep in mind that people posting katas have a certain goal in mind. I see how you with your experience want to make Katas harder, but this one was not intended to show of what a cool developer you are. This was intended to be approachable for lower experience develeopers, who are taken by the hand to discover, learn and apply a new concept. It's categorized as fairly easy, and mosre experienced developers can just skip it. Please do not open issues for a Kata not matching the difficulty you would have choosen, and just accept that there are Katas for every skill level.
Thanks
I am not sure how broken tests could be end up in the Kata, as to the best of my knowledge the Kata is validated / executed before publishing.
Either way, solved.
Loading more items...