Given two arrays of strings a1 and a2 return a sorted array r in lexicographical order of the strings of a1 which are substrings of strings of a2.
#Example 1: a1 = ["arp", "live", "strong"]
a2 = ["lively", "alive", "harp", "sharp", "armstrong"]
returns ["arp", "live", "strong"]
#Example 2: a1 = ["tarp", "mice", "bull"]
a2 = ["lively", "alive", "harp", "sharp", "armstrong"]
returns []
Notes:
Arrays are written in "general" notation. See "Your Test Cases" for examples in your language.
In Shell bash a1 and a2 are strings. The return is a string where words are separated by commas.
Beware: r must be without duplicates.
Don't mutate the inputs.
'매일매일개발 > Codewars' 카테고리의 다른 글
codewars #90 Cure Cancer (6kyu) (0) | 2018.08.01 |
---|---|
codewars #89 Mexican Wave (6kyu) (0) | 2018.07.31 |
codewars #87 Extract the IDs from the data set (6kyu) (0) | 2018.07.27 |
codewars #86 Remove Duplicates(7kyu) (0) | 2018.07.26 |
codewars #85 Circularly Sorted Array (6kyu) (0) | 2018.07.25 |