Question: Write a function in R to do the following: Given a list of integers and an integer target, return the indices of the two numbers

Write a function in R to do the following: Given a list of integers and an integer target, return the indices of the two numbers such which add up to target. Example: Input: inputlist = [2, 1, 7, 23], target = 8 output: [1,2] Explanation: inputlist[1] = 1, inputlist[2] = 7, 1 7 = 8, thus, return [1,2]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!