Skip to content

Instantly share code, notes, and snippets.

@hassan-maavan
Created September 17, 2020 08:05
Show Gist options
  • Save hassan-maavan/ee6dd014007e44aeee7caf9f23096edf to your computer and use it in GitHub Desktop.
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…
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