2
def isPossibleDivide(self, nums: List[int], k: int) -> bool:3
# if we see x, we expect to see x+1 later4
# and then x+2 after that5
# and then x+3 after that7
# so maybe we can enqueue (x+1, k-2) === (next number expected, count after x+1)8
# e.g. k == 2: find x, enqueue (x+1, 0)11
# if front of queue has x, pop it. Re-enqueue with rem-1 if rem, else we finished a length k sequence12
# if front of queue has x' < x, we have a gap. return False13
# otherwise we found the start of a new sequence: append (x+1, k-2)14
# meaning we found x (1), we're looking for x+1 (another 1), and after that we should find another k-2 numbers17
return True # length 1 sequences are trivial22
if not q or q[0][0] > n:23
q.append((n + 1, k - 2))27
q.append((n + 1, rem - 1))28
# else: end of len k sequence30
return False # found n > next expected, so we can't complete an earlier sequence33
return False # expected at least one more element to finish a sequence