Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import heapq
- ch = 'ACGT'
- k = 7
- heap = []
- heapq.heappush(heap, '')
- while len(heap):
- seq = heapq.heappop(heap)
- if len(seq) - k + 1 == len(ch) ** k:
- print seq, len(seq)
- break
- for c in ch:
- n = seq + c
- if len(n) < k or n[-k:] not in seq:
- heapq.heappush(heap, n)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement