Reverse Vowels of a String

Problem Summary

Key Observations

Main Concepts Used

Time & Space Complexity

Code

class Solution:
    def reverseVowels(self, s: str) -> str:
        vowels = ["a", "e", "i", "o", "u"]
        l, r = 0, len(s) - 1
        word = list(s)

        while l < r:
            if word[l].lower() not in vowels:
                l += 1
                continue
            if word[r].lower() not in vowels:
                r -= 1
                continue

            word[l], word[r] = word[r], word[l]
            l += 1
            r -= 1
        return "".join(word)

Common Mistakes / Things I Got Stuck On