Deloitte Logo

Asked in Deloitte

Given an array of numbers, find the positions of the numbers whose sum is 9.

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
7mo
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
4y
Hint :- only position not a number. Use hashmap.
Select
Add answer anonymously...

Top Analyst Interview Questions Asked at Deloitte

Q. What are the concepts of Object-Oriented Programming (OOP) and its pillars?
Q. What is the process to reverse a string?
Q. Given an array of integers and a target sum, find two numbers in the array that ...read more
Analyst Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits