Understanding Leetcode: The Two Sum Problem
The problem: Given an array of integers, return indices of the two numbers such that they add up to specific target. Assume that there exists exactly one solution, and that you may not use the same element twice.
The Naive Approach
Before starting to program a solution, we always want to think about what the problem is asking, and how we would solve it on paper. This will reveal the algorithm used to solve the problem.
So, let’s start with an example instance of the problem. Suppose you are given the…