Danil Negrienko 1ae69450e8 | ||
---|---|---|
.. | ||
.exercism | ||
lib | ||
test | ||
.formatter.exs | ||
.gitignore | ||
HELP.md | ||
README.md | ||
mix.exs |
README.md
Sublist
Welcome to Sublist on Exercism's Elixir Track.
If you need help running the tests or submitting your code, check out HELP.md
.
Instructions
Given any two lists A
and B
, determine if:
- List
A
is equal to listB
; or - List
A
contains listB
(A
is a superlist ofB
); or - List
A
is contained by listB
(A
is a sublist ofB
); or - None of the above is true, thus lists
A
andB
are unequal
Specifically, list A
is equal to list B
if both lists have the same values in the same order.
List A
is a superlist of B
if A
contains a sub-sequence of values equal to B
.
List A
is a sublist of B
if B
contains a sub-sequence of values equal to A
.
Examples:
- If
A = []
andB = []
(both lists are empty), thenA
andB
are equal - If
A = [1, 2, 3]
andB = []
, thenA
is a superlist ofB
- If
A = []
andB = [1, 2, 3]
, thenA
is a sublist ofB
- If
A = [1, 2, 3]
andB = [1, 2, 3, 4, 5]
, thenA
is a sublist ofB
- If
A = [3, 4, 5]
andB = [1, 2, 3, 4, 5]
, thenA
is a sublist ofB
- If
A = [3, 4]
andB = [1, 2, 3, 4, 5]
, thenA
is a sublist ofB
- If
A = [1, 2, 3]
andB = [1, 2, 3]
, thenA
andB
are equal - If
A = [1, 2, 3, 4, 5]
andB = [2, 3, 4]
, thenA
is a superlist ofB
- If
A = [1, 2, 4]
andB = [1, 2, 3, 4, 5]
, thenA
andB
are unequal - If
A = [1, 2, 3]
andB = [1, 3, 2]
, thenA
andB
are unequal
Slow tests
One or several of the tests of this exercise have been tagged as :slow
, because they might take a long time to finish. For this reason, they will not be run on the platform by the automated test runner. If you are solving this exercise directly on the platform in the web editor, you might want to consider downloading this exercise to your machine instead. This will allow you to run all the tests and check the efficiency of your solution.
Source
Contributed to by
- @angelikatyborska
- @Cohen-Carlisle
- @dalexj
- @devonestes
- @jason-kerney
- @kytrinyx
- @lpil
- @lsimoneau
- @MarcosX
- @neenjaw
- @parkerl
- @pminten
- @rubysolo
- @sotojuan
- @Teapane
- @waiting-for-dev