my easy to understant python code


  • 0
    C

    '''
    class Solution(object):
    def reverseVowels(self, s):
    """
    :type s: str
    :rtype: str
    """
    a=[]
    b=[]
    s= list(s)
    seen=set(['a','e','i','o','u','A','E','I','O','U'])
    j = 0
    for i in s:
    if i in seen:
    a.append(i)
    b.append(j)
    j = j+1
    else:
    j = j+1
    continue
    a.reverse()
    for j in range (0,len(a)):
    s[b[j]] = a[j]
    return "".join(s)
    '''


Log in to reply
 

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