Skip to content

Instantly share code, notes, and snippets.

@in1yan
Created March 24, 2025 15:05
slothbytes
def bridge_shuffle(a1, a2):
shuffle = []
i,j = 0,0
while i<len(a1) and j<len(a2):
shuffle.append(a1[i])
shuffle.append(a2[i])
i += 1
j += 1
while i<len(a1):
shuffle.append(a1[i])
i += 1
while j<len(a2):
shuffle.append(a2[j])
j += 1
return shuffle
if __name__ == "__main__":
print(bridge_shuffle(["A", "A", "A"], ["B", "B", "B"]))
print(bridge_shuffle(["C", "C", "C", "C"], ["D"]))
print(bridge_shuffle([1, 3, 5, 7], [2, 4, 6]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment