Array Summary
Array
1. Two Sum Hash table (map<int, int> hashMap; // first is the value, second is the index),ffind(target - numbers[i]);
167 Two Sum II - Input array is sorted
// Utilize the fact that the array is sorted, sum from both left and right side.
// If the summation is too large, decrease the high index, else if the summation
// is too low, increase the low index. else if the summation is the target value,
// create the vector<int> and return the vector<int>({low + 1, hight + 1})
170. Two Sum III - Data structure design
Solution: Two Sum III
Comments
Post a Comment