input: Write a function to validate a spectrum sequence where each element increases by 1 or 2.
  assert is_valid_spectrum([1, 2, 3, 5, 7]) == True
  assert is_valid_spectrum([1, 3, 4, 6]) == True
  assert is_valid_spectrum([1, 2, 4, 6, 9]) == False
output: def is_valid_spectrum(sequence):
      for i in range(1, sequence.length):
          if sequence[i] - sequence[i - 1] not in [1, 2]:
              return False
      return True