cpp implementation of Two Sum