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 should just return false whenever its invalid, then return true if it's passed. Then the solution is more elegant.
Yes for sure!
Alternatively, why don't you look at the sample tests, and notice the existence of a suspicious predefined variable there?
If you don't look at the sample tests, who is it to blame when there are problems? ;-)
Thanks for the compliment :D
Why "Y" is not a vowel?
This is clearly a bug...
@jtauri,
Please note that a Kata Description is exactly that - a description for a Kata which helps the user understand what is to be expected in the coding exercise. It is NOT necessarily a teaching tool as you seem to expect, teaching the user how to implement every single step of the algorithm with links and references to EVERY SINGLE BUILT-IN FUNCTION AND CONSTANT EVER that the user may happen to need to use in the exercise. Before I continue, I would like you to note that approximately at least 90% of all Kata ever authored on Codewars do NOT even have as much of a "Lesson" section in their descriptions teaching all the fundamentals required to complete the Kata task. It just so happens that I feel ESPECIALLY GENEROUS when authoring my PHP Kata Series that I WILLINGLY DECIDE (not out of obligation) to include an entire "Lesson" section in each of my Kata so novice PHP programmers who have (perhaps) just completed a PHP course on Codecademy (for example) can learn something new and interesting about the topic at hand before proceeding to the actual Kata task instead of searching the World Wide Web for answers which may contain disinformation and bad code examples. I repeat, I have NO OBLIGATION WHATSOEVER to so much as include an entire "Lesson" section in the Description of my Kata. This is NOT Codecademy where they teach PHP (or another scripting language) from the ground-up, leading you through the very basics from setting variables to defining your "Hello World" function to learning how to use built-in functions to learning the syntax for defining classes in PHP. If you want THAT level of guidance, you are free to leave Codewars for now and complete a crash course in PHP on Codecademy (or some online coding learning institution) to solidify your understanding and skills before returning here to REFINE your coding skills and learn best and efficient programming practices.
The aim of Codewars, Kata on Codewars and Kata Descriptions aside, the "Lesson" in this Kata is designed to teach EXACTLY that - default arguments in PHP and some of their behaviours and properties - nothing more, nothing less. I didn't mention the pi constant in PHP (which is
M_PI
if you haven't done your research already) in this Lesson because it is irrelevant to the aim of this Kata. As for theM_PI
constant which was required in the task for this Kata, I naturally assumed that you would already have come across it at some point (hell, it's even mentioned in one of the Codecademy PHP lessons). If not, I expected that (at least) 95% of users would at least be computer-literate enough (if that is a term) to GOOGLE the keywords "Math Pi PHP" to figure it out for themselves?End of rant. Peace out.
Signed,
donaldsebleung
There is a predefined constant in PHP that holds the value of pi to a high degree of accuracy.
I agree, I was confused by it too; assumed it to be sorted by the alphabetical character only, and not the whole substring.
But apart from that, looking at other solutions… wtf, that complexity of the solutions.
The sort part is a bit difficult but it is the interesting one!
I think he meant the length of the string. The instructions say length and then alphabetically, which got me at first too bc it's only length and then alphabetically if they have the same prefix. Otherwise, it's 1 > 2 > =. Which are in ascending order if you go by codepoint but I didn't really get that from the instructions.
I've marked this as resolved.
Thank you for pointing this out, it should be fixed now.
1 - letters have all same length: one
2 - prefix are part of the resulting string, no special thing needed
3 - most often strings are sorted in alphabetical order, increasing or decreasing
I am not at all sure that your description is better than mine.
Your problem is not in the description but in the algorithm needed.
There is an issue with publishing for some users that I am working on. Sorry for the inconvenience. Did you get a publish timeout error when you tried to publish?