Solution of leetcode first problem — TL;DR If you just want the O(n) solution, click here Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. Input: nums = [2,7,11,15], target = 22
Output: [1,3]
Output: Because nums[1] + nums[3] == 22, we return [1, 3]. 1. O(n²) Solution To kick start, we calculate all the…