Advertisement
gowtham900

Untitled

Sep 29th, 2021
957
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. import math
  2. import os
  3. import random
  4. import re
  5. import sys
  6.  
  7. #
  8. # Complete the 'lonelyinteger' function below.
  9. #
  10. # The function is expected to return an INTEGER.
  11. # The function accepts INTEGER_ARRAY a as parameter.
  12. #
  13.  
  14. def lonelyinteger(a):
  15.     # Write your code here
  16.     val=0
  17.     for i in a:
  18.         val=val^i
  19.     return val
  20.    
  21.  
  22. if __name__ == '__main__':
  23.     fptr = open(os.environ['OUTPUT_PATH'], 'w')
  24.  
  25.     n = int(input().strip())
  26.  
  27.     a = list(map(int, input().rstrip().split()))
  28.  
  29.     result = lonelyinteger(a)
  30.  
  31.     fptr.write(str(result) + '\n')
  32.  
  33.     fptr.close()
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement