Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
November 23, 2021 01:33 am GMT

code every day with me

--DAY 26--

Hi, I am going to make #100DaysOfCode Challenge. Everyday I will try solve 1 problem from leetcode or hackerrank. Hope you can go with me until end.
Now let's solve problem today:
Problem: Isomorphic Strings
Detail: here
My solution (javascript):

var reverseVowels = function(s) {    s=s.split('');    let vowel = ['a','e','i','o','u','A','E','I','O','U'];    let i=0,j=s.length-1;    while(i<j){        if(!vowel.includes(s[i])) i++;        else if(!vowel.includes(s[j])) j--;        if(vowel.includes(s[i])&&vowel.includes(s[j])){            [s[i],s[j]]=[s[j],s[i]];            i++;            j--;        }    }    return s.join('');};

-->If you have better solution or any question, please comment below. I will appreciate.


Original Link: https://dev.to/coderduck/code-every-day-with-me-27gd

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To