Implemented 2Sum and 3Sum methods.