How to Check for All Inclusive in C
The challenge
Input:
- a string
strng
- an array of strings
arr
Output of function contain_all_rots(strng, arr) (or containAllRots or contain-all-rots)
:
- a boolean
true
if all rotations ofstrng
are included inarr
false
otherwise
Examples:
Note:
Though not correct in a mathematical sense
- we will consider that there are no rotations of
strng == ""
- and for any array
arr
:contain_all_rots("", arr) --> true
The solution in C
Option 1:
|
|
Option 2:
|
|
Option 3:
|
|
Test cases to validate our solution
|
|