We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d89ac46 commit 5eeac54Copy full SHA for 5eeac54
linked_lists/zipper_lists/__init__.py
linked_lists/zipper_lists/zipper_lists_v1.py
@@ -0,0 +1,23 @@
1
+def zipper_lists(head_1, head_2):
2
+ tracker = head_1
3
+ current_1 = head_1.next
4
+ current_2 = head_2
5
+ count = 0
6
+
7
+ while current_1 is not None and current_2 is not None:
8
+ if count % 2 == 0:
9
+ tracker.next = current_2
10
+ current_2 = current_2.next
11
+ else:
12
+ tracker.next = current_1
13
+ current_1 = current_1.next
14
15
+ tracker = tracker.next
16
+ count += 1
17
18
+ if current_1 is not None:
19
20
+ if current_2 is not None:
21
22
23
+ return head_1
0 commit comments