Question
Given a string s, reverse only all the vowels in the string and return it.
The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both cases.
Example 1:
Input: s = "hello" Output: "holle"
Example 2:
Input: s = "leetcode" Output: "leotcede"
Constraints:
1 <= s.length <= 3 * 105sconsist of printable ASCII characters.
Python Solution
class Solution:
def reverseVowels(self, s: str) -> str:
s=list(s)
vowels = set(list('aeiouAEIOU'))
l=0
r=len(s)-1
while l<r:
if s[l] in vowels and s[r] in vowels:
s[l],s[r] = s[r],s[l]
l+=1
r-=1
if s[l] not in vowels:
l+=1
if s[r] not in vowels:
r-=1
return (''.join(s))

![[Solved] You are given an integer n and an integer start. Define an array nums where nums[i] = start + 2 * i (0-indexed) and n == nums.length. Return the bitwise XOR of all elements of nums.](https://machinelearningprojects.net/wp-content/uploads/2022/09/Leetcode-solutions-MLP-Feature-Image-1024x536.webp)