Problem 1: TwoSum
The problem is as follows: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. Example: Given nums = [2, 7, 11, 15], target = 9, Because nums[ 0 ] + nums[ 1 ] = 2 + 7 = 9, return [ 0 , 1 ]. There are several ways to achieve this. The straightforward solution is to use brute-force search. 1. Brute-Force Search C++: To declare and create an object of a class, either following way is ok: (1). Solution a; Num_output = a.twoSum(...) (2). Solution *a = new Solution(); Num_output = a->twoSum(...) The vector in C++ is written as {x1,x2,...} . Indexing an element: nums.at(i) . Get vector size: nums.size() . Note: in C++, the int main() is a must. For main function it cannot be changed to other types except int. Java: Use Solution a = new Solution() to create an object...