diff options
| author | Solathian <horvath6@gmail.com> | 2025-08-02 16:28:12 +0200 |
|---|---|---|
| committer | Solathian <horvath6@gmail.com> | 2025-08-02 16:28:12 +0200 |
| commit | 4014f0eb1fa46f39fee72c2add76ca47f2dd1637 (patch) | |
| tree | 07ed523115445f773f90f3d0f08c83456457e54e /challenge-014/zapwai/python | |
| parent | 83179303806e75ac6aa4c786cefbb89ab6ddeaf7 (diff) | |
| parent | 698c027e7ef73ac2753c97d4e64d7fba2b2ddc95 (diff) | |
| download | perlweeklychallenge-club-4014f0eb1fa46f39fee72c2add76ca47f2dd1637.tar.gz perlweeklychallenge-club-4014f0eb1fa46f39fee72c2add76ca47f2dd1637.tar.bz2 perlweeklychallenge-club-4014f0eb1fa46f39fee72c2add76ca47f2dd1637.zip | |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'challenge-014/zapwai/python')
| -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) + |
