Skip to content

Latest commit

 

History

History
16 lines (11 loc) · 435 Bytes

(7 kyu) Two to One.md

File metadata and controls

16 lines (11 loc) · 435 Bytes

Two to One (7 kyu)

https://www.codewars.com/kata/two-to-one/

Take 2 strings s1 and s2 including only letters from ato z. Return a new sorted string, the longest possible, containing distinct letters, each taken only once - coming from s1 or s2.

Examples:

a = "xyaabbbccccdefww"
b = "xxxxyyyyabklmopq"
longest(a, b) -> "abcdefklmopqwxy"

a = "abcdefghijklmnopqrstuvwxyz"
longest(a, a) -> "abcdefghijklmnopqrstuvwxyz"