Y is Y considered to be a consonant?

  • 4


    Forgive the cheeky title, but I couldn't resist. I was puzzled at the rejection of my solution when presented with the following Test case:

    "yo! Bottoms Up, u.S. Motto, boy!"

    which is apparently expected to output:

    "Yo! Bottoms up, U.S. Motto, boy!"

    My own solution switched the location of the two Y's - which fails to pass the test case.

    A quick google lead me to find that despite my own schooling, teaching Y as a vowel, it can also be regarded as a consonant. Given this somewhat broad ambiguity, I think the question should be updated to either state that Y is considered a consonant, or specify exactly which letters are considered to be vowels.


  • 0

    And for input string "Yo! BOttOms up U.S. Motto boy!"
    Expected answer is "Yo! Bottoms Up u.S. MOttO boy!"

    So it's expects me to switch 'O' but not 'Y'


    Additional case:
    Input : "AEYUIOoiuyea"
    Expected: "aeYuioOIUyEA"

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.