Two Sum
This commit is contained in:
27
include/s1_two_sum.hpp
Normal file
27
include/s1_two_sum.hpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef S1_TWO_SUM_HPP
|
||||
#define S1_TWO_SUM_HPP
|
||||
|
||||
#include <iostream>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
class Solution {
|
||||
public:
|
||||
/**
|
||||
* @brief Two Sum
|
||||
*
|
||||
* Given an array of integers `nums` and an integer `target`, return indices
|
||||
* of the two numbers such that they add up to `target`.
|
||||
*
|
||||
* You may assume that each input would have **exactly one solution**, and you
|
||||
* may not use the same element twice.
|
||||
*
|
||||
* You can return the answer in any order.
|
||||
*
|
||||
* @param nums the array of integers to be summed
|
||||
* @param target the target integer
|
||||
*/
|
||||
std::vector<int> twoSum(std::vector<int>& nums, int target);
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user