This is the problem in hackerrank. I sloved it using couple way.But,first time it passed test case 0 but not fully submitted cause other test case not passed.I read this problem many time but i can’t figure out what is the different of my first solution and ultimate solution.
The way i solve it first time,
Number 01:
n = int(input())
l = list(map(int,input().split()))
for x in l:
if l.count(x) == 1:
print(x)
and ultimately this problem solved this,
Number 02:
k,arr = int(input()),list(map(int, input().split()))
myset = set(arr)
print(((sum(myset)*k)-(sum(arr)))//(k-1))
I solved it.But i still don’t understand that,why number 01 is fail?
I thought, it’s the easy way to fix this