Skip to content

Instantly share code, notes, and snippets.

@thmain
Last active May 21, 2023 23:41
Show Gist options
  • Save thmain/748e1f5091f86da0c1bcf089da9272c7 to your computer and use it in GitHub Desktop.
Save thmain/748e1f5091f86da0c1bcf089da9272c7 to your computer and use it in GitHub Desktop.
def get_extra_element(arrA, arrB):
extra_element = 0
for num in arrA:
extra_element ^= num
for num in arrB:
extra_element ^= num
print("Array A:", arrA)
print("Array B:", arrB)
print("Extra Element:", extra_element)
if __name__ == "__main__":
arrA = [3, 4, 5, 2, 9, 6]
arrB = [4, 3, 2, 9, 5, 7, 6]
get_extra_element(arrA, arrB)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment