How to check if an ordered non-consecutive subsequence is in array? Python

Viewed 1190

I'd be surprised if this hasn't been asked yet.

Let's say I have an array [5,6,7,29,34] and I want to check if the sequence 5,6,7 appears in it (which it does). Order does matter.

How would I do this?

3 Answers
Related