| .. | ||
| .exercism | ||
| src | ||
| tests | ||
| .gitignore | ||
| Cargo.toml | ||
| HELP.md | ||
| README.md | ||
Sublist
Welcome to Sublist on Exercism's Rust 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
Ais equal to listB; or - List
Acontains listB(Ais a superlist ofB); or - List
Ais contained by listB(Ais a sublist ofB); or - None of the above is true, thus lists
AandBare 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 contiguous sub-sequence of values equal to B.
List A is a sublist of B if B contains a contiguous sub-sequence of values equal to A.
Examples:
- If
A = []andB = [](both lists are empty), thenAandBare equal - If
A = [1, 2, 3]andB = [], thenAis a superlist ofB - If
A = []andB = [1, 2, 3], thenAis a sublist ofB - If
A = [1, 2, 3]andB = [1, 2, 3, 4, 5], thenAis a sublist ofB - If
A = [3, 4, 5]andB = [1, 2, 3, 4, 5], thenAis a sublist ofB - If
A = [3, 4]andB = [1, 2, 3, 4, 5], thenAis a sublist ofB - If
A = [1, 2, 3]andB = [1, 2, 3], thenAandBare equal - If
A = [1, 2, 3, 4, 5]andB = [2, 3, 4], thenAis a superlist ofB - If
A = [1, 2, 4]andB = [1, 2, 3, 4, 5], thenAandBare unequal - If
A = [1, 2, 3]andB = [1, 3, 2], thenAandBare unequal
Source
Created by
- @EduardoBautista
Contributed to by
- @ashleygwilliams
- @coriolinus
- @cwhakes
- @eddyp
- @EduardoBautista
- @efx
- @ErikSchierboom
- @IanWhitney
- @kytrinyx
- @lutostag
- @mkantor
- @nfiles
- @petertseng
- @rofrol
- @stringparser
- @xakon
- @ZapAnton