Ad
  • Default User Avatar

    I should just return false whenever its invalid, then return true if it's passed. Then the solution is more elegant.

  • Default User Avatar
  • Custom User Avatar

    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? ;-)

  • Custom User Avatar
  • Custom User Avatar

    Why "Y" is not a vowel?
    This is clearly a bug...

  • Custom User Avatar

    @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 the M_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

  • Custom User Avatar

    There is a predefined constant in PHP that holds the value of pi to a high degree of accuracy.

  • Custom User Avatar

    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.

  • Default User Avatar

    The sort part is a bit difficult but it is the interesting one!

  • Custom User Avatar

    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.

  • Custom User Avatar

    I've marked this as resolved.

  • Custom User Avatar

    Thank you for pointing this out, it should be fixed now.

  • Default User Avatar

    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.

  • Custom User Avatar

    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?