+ 12
Coding Challenge#5: Are we Alternate? (Code included)
Are we alternate? (By: Jafca) Create a function isAlt() to validate whether a string of letters has alternate consonants and vowels. Vowels are a, e, i, o and u. e.g. isAlt("amazon") // true e.g. isAlt("cheeze") // false e.g. isAlt("banana") // true e.g. isAlt("ghost") // false https://code.sololearn.com/cHT29NRY4XF1/?ref=app
32 Answers
+ 4
https://code.sololearn.com/c2aptyHnQ62S/?ref=app
+ 7
A solution constructing a RegEx, should also work for any other set of non-meta characters:
https://code.sololearn.com/cN9aWvujLzi4
+ 7
https://code.sololearn.com/cPN2e1m380O9/?ref=app
+ 6
@Tamas. Actually. Me too. For the original question by Jafca, I did not check explicitly for one letter inputs. Maybe I should have specified it in the question
+ 5
JS Version:
https://code.sololearn.com/WYk359Nt3rul/?ref=app
+ 5
https://code.sololearn.com/cSqBLyNphJB0/?ref=app
+ 5
@pixie i have made the changes please have a look
+ 5
what about single consonant char? should they also be true??
+ 5
@pixie should 'b' also be true?
or rule is only for vowels?
+ 5
@Riman. Only for vowels
+ 5
@Tamas. The output for 'b' should be false as there are no vowels in the input.
+ 5
Me too, then. Maybe you should add the requirement that the word must contain a vowel in the description, as this is logically independent of the alternating rule.
+ 5
https://www.sololearn.com/Discuss/403500/?ref=app
New challenge
+ 4
A couple alternate approaches (flipping in the correct validator, and swapping all letters into a binary sequence):
https://code.sololearn.com/cz2wjbzC74OH/?ref=app
https://code.sololearn.com/cCn9v5CQ6T6w/?ref=app
+ 4
Let me use this to shamelessly plug my own challenge. Cookies for every correct solution. ;)
https://www.sololearn.com/Discuss/392289
+ 4
@pixie i can't understand why?
+ 4
@pixie there is not any consonant in a single letter 'a' so it is not alternate
+ 4
@Pixie: then I misunderstood the problem