Question: Language is Python Write the optimal solution for question you had in Class work 1: #hint1 : using only one for loop- #hint 2: you
Write the optimal solution for question you had in Class work 1: \#hint1 : using only one for loop- \#hint 2: you can use dictionary. Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. Example 1: Input: Arr =[1,7,3,6,5,9], target= 11 Output: [3,4] Explanation: Arr[3]=6 Arr[4]=5 Arr[3]+Arr[4]=5+6=11 target Example 2: Input: Arr =[1,0,7,6,2,4], target =5 Output: [0,5] Explanation: Arr [0]=1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
