question: single entry
akshya is given a list of N integers. Each number in the list appears exactly for one number. help akshya by identifying the numbers which appeared exactly once in the list.
input:-
2 2 1
output:-
1
input:
8 9 2 8 9 2 5
output:
5
explanation:
in the example the given integers are 2 2 1 as the number 1 has appeared only once.
so the output should be 1.
cnt = [0] * 10
print("Enter list of integers:")
arr = input().split()
for i in range(len(arr)):
arr[i] = int(arr[i])
cnt[arr[i]] += 1
for i in range(10):
if cnt[i] == 1:
print(i, end=" ")
Comments
Leave a comment