The following code work well and finds the missing number of contiguous array using XOR.
I would like to ask why the first loop starts at 1 and ends at n and the second starts at 2 and ends at n+2?
a = [1, 2, 3,4, 5, 6,8]
n = len(a)
x1 = a[0]
x2 = 1
for i in range(1, n):
## print (i)
#print (' ')
for i in range(1, n):
x1 = x1 ^ a[i]
print (a[i],x1)
print (' ')
for i in range(2, n + 2):
x2 = x2 ^ i
## print (i,x2)
##print (' ')
print (x1 ^ x2 )
for i in range(1, n)andfor i in range(2, n + 2)...