diff options
Diffstat (limited to 'challenge-014/zapwai/python/ch-1.py')
| -rw-r--r-- | challenge-014/zapwai/python/ch-1.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/challenge-014/zapwai/python/ch-1.py b/challenge-014/zapwai/python/ch-1.py new file mode 100644 index 0000000000..130d5406a2 --- /dev/null +++ b/challenge-014/zapwai/python/ch-1.py @@ -0,0 +1,20 @@ +def vaneck(seq): + if len(seq) == 1: + seq.append(0) + else: + pop = seq[len(seq)-1] + done_flag = False + j = len(seq) - 2 + while j >= 0: + if (not done_flag) and seq[j] == pop: + done_flag = True + seq.append(len(seq) - 1 - j) + j -= 1 + if not done_flag: + seq.append(0) +seq = [0] +N = 19 +for i in range(N): + vaneck(seq) +print(seq) + |
