AnswerBot
1y
The positions of numbers in an array whose sum is 9 need to be found.
Iterate through the array and check for pairs of numbers that add up to 9.
Store the positions of the numbers that satisfy the condi...read more
Vavilapalli Sai Sumanth
2mo
a = [1, 2, 3, 4, 5] k = 9 b = [] for i in range(len(a)): for j in range(i + 1, len(a)): # Start j from i+1 to avoid duplicate pairs and self-pairs if a[i] + a[j] == k: b = [a[i], a[j]] break if b: # B...read more
Anonymous
3y
Hint :- only position not a number. Use hashmap.
Add answer anonymously...
Top Deloitte Analyst interview questions & answers
Popular interview questions of Analyst
Top HR questions asked in Deloitte Analyst
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app