Goat Latin
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You are given a sentence made of words separated by single spaces, where each word contains only uppercase and lowercase English letters. Convert it to Goat Latin by transforming each word:
1. If the word starts with a vowel (a, e, i, o, u, in either case), append "ma".
2. Otherwise, move the first letter to the end of the word, then append "ma".
3. Then append the letter 'a' repeated k times, where k is the word's 1-based position in the sentence.
Return the transformed words joined by single spaces. Keep every letter's original case.
Examples
Constraints
- 1 <= sentence.length <= 150
- `sentence` consists of English letters and spaces
- `sentence` has no leading or trailing spaces
- Words are separated by exactly one space
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.