Skip to content

Instantly share code, notes, and snippets.

@peterschussheim
Last active September 4, 2016 15:55
Show Gist options
  • Save peterschussheim/fc034cea663e50dd3c7ca44f461b19a5 to your computer and use it in GitHub Desktop.
Save peterschussheim/fc034cea663e50dd3c7ca44f461b19a5 to your computer and use it in GitHub Desktop.
Sets
const longest = (s1, s2) => [...new Set(s1 + s2)].sort().join('') ///Create a function that accepts two strings s1 and s2, that returns a new string that is sorted and as long as possible, only using unique letters from s1 and s2.
a = "xyaabbbccccdefww"
b = "xxxxyyyyabklmopq"
longest(a, b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment