Created
September 17, 2020 08:05
-
-
Save hassan-maavan/ee6dd014007e44aeee7caf9f23096edf to your computer and use it in GitHub Desktop.
String array duplicates In this Kata, you will be given an array of strings and your task is to remove all consecutive duplicate letters from each string in the array. For example: dup(["abracadabra","allottee","assessee"]) = ["abracadabra","alote","asese"]. dup(["kelless","keenness"]) = ["keles","kenes"]. Strings will be lowercase only, no spac…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dup(s) { | |
return s.map((str) => Array.from(str).filter((v, i, arr) => arr[i - 1] !== v).join('')) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment