- Time : O(min(n, m)) where n is size of array, m is size of sequence
- Space : O(1)
c++
1 | using namespace std; |