Given a list of numbers, find the indices of two numbers that add up to a specific target value. Do this without using nested for loops. For example, given the list l = [2, 15, 5, 7] and target t = 9, the output should be [0, 3].
AnswerBot
1y
Finding index of 2 numbers having total equal to target in a list without nested for loop.
Use dictionary to store the difference between target and each element of list.
Iterate through list and check ...read more
Help your peers!
Add answer anonymously...
Coforge Data Scientist interview questions & answers
A Data Scientist was asked 19 May 2023Q. Explain the concept of method overloading in OOP.
A Data Scientist was asked 19 May 2023Q. How would you find the unique keys in two dictionaries?
A Data Scientist was asked 19 May 2023Q. What is the procedure for deploying a model using AWS EC2?
Popular interview questions of Data Scientist
A Data Scientist was asked 19 May 2023Q1. Explain the concept of method overloading in OOP.
A Data Scientist was asked 19 May 2023Q2. How would you find the unique keys in two dictionaries?
A Data Scientist was asked 19 May 2023Q3. What is the procedure for deploying a model using AWS EC2?
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