An Interest In:
Web News this Week
- April 19, 2024
- April 18, 2024
- April 17, 2024
- April 16, 2024
- April 15, 2024
- April 14, 2024
- April 13, 2024
November 23, 2021 01:33 am GMT
Original Link: https://dev.to/coderduck/code-every-day-with-me-27gd
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:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To