6 kyu

Which are in?

2,712 of 82,592g964

Description:

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: In some languages r must be without duplicates.
Arrays
Lists
Strings
Refactoring

More By Author:

Check out these other kata created by g964

Stats:

CreatedMar 15, 2015
PublishedMar 15, 2015
Warriors Trained175887
Total Skips30053
Total Code Submissions356551
Total Times Completed82592
Ruby Completions2971
C# Completions4893
Python Completions27752
Java Completions8954
Clojure Completions451
Haskell Completions775
JavaScript Completions23094
CoffeeScript Completions77
Elixir Completions456
TypeScript Completions2518
C++ Completions3406
PHP Completions2712
Crystal Completions47
F# Completions168
C Completions605
Swift Completions972
R Completions181
Shell Completions150
OCaml Completions40
Julia Completions82
Scala Completions402
PowerShell Completions107
Kotlin Completions1085
Go Completions1759
Nim Completions33
Racket Completions38
Rust Completions878
Lua Completions94
Pascal Completions14
Perl Completions22
Elm Completions15
D Completions8
Erlang Completions11
Prolog Completions14
Total Stars1552
% of votes with a positive feedback rating87% of 6987
Total "Very Satisfied" Votes5394
Total "Somewhat Satisfied" Votes1425
Total "Not Satisfied" Votes168
Ad
Contributors
  • g964 Avatar
  • jhoffner Avatar
  • ZozoFouchtra Avatar
  • john_2 Avatar
  • bkaes Avatar
  • GiacomoSorbi Avatar
  • imjasonmiller Avatar
  • kazk Avatar
  • Blind4Basics Avatar
  • Voile Avatar
  • kdmatrosov Avatar
  • monadius Avatar
  • hobovsky Avatar
  • user8436785 Avatar
  • KayleighWasTaken Avatar
Ad