-
Notifications
You must be signed in to change notification settings - Fork 253
Subsequence
Sar Champagne Bielert edited this page Apr 6, 2024
·
9 revisions
Understand what the interviewer is asking for by using test cases and questions about the problem.
- Will either list ever be empty?
- Potentially, yes. Your code should allow for this.
Plan the solution with appropriate visualizations and pseudocode.
General Idea: TODO
1) TODO
def is_subsequence(array, sequence):
seq_idx = 0
for num in array:
if seq_idx == len(sequence):
return True
if sequence[seq_idx] == num:
seq_idx += 1
return False