Skip to content

Commit 6513083

Browse files
'''
1 parent 551359b commit 6513083

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'''
2+
find pair whose sum is equal to target sum
3+
'''
4+
from collections import defaultdict
5+
n=int(input())
6+
a=defaultdict(list)
7+
8+
a1=list(map(int,input().split()))
9+
le=len(a1)
10+
11+
i=0
12+
while i<le:
13+
a[a1[i]]=i
14+
i+=1
15+
16+
i=0
17+
while i<le:
18+
if a[n-a1[i]]!=[]:
19+
print(i,a1[i],n-a1[i])
20+
break
21+
i+=1

0 commit comments

Comments
 (0)