Two Sum Problem

[Question] : Given an array of integers nums and an integer target, find indices of the two numbers which addition equals to target.Example: Input: nums = [2,7,11,15], target = 13 Output: [0,2] Explanation: Because nums[0] + nums[2] == 13, we return [0, 2]. Approach #1 : Using Two pointers: – Step 1: First sort array thenStep 2: If arr[left] …

Two Sum Problem Read More »