๋ฌธ์
์ฝ๋
#include <string>
#include <vector>
#include <map>
using namespace std;
vector<int> solution(vector<int> numbers) {
vector<int> answer;
map<int,int>m;
for(int i=0; i<numbers.size()-1; i++){
for(int k=i+1; k<numbers.size(); k++){
m[numbers[i]+numbers[k]]++;
}
}
for(auto i=m.begin(); i!=m.end(); i++){
answer.push_back(i->first);
}
return answer;
}
'Algorithm ๐ง๐ปโ๐ป > ํ๋ก๊ทธ๋๋จธ์ค(Programmers)' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[c++] ํ๋ก๊ทธ๋๋จธ์ค - ๋ฌธ์์ด ๋ด p์ y์ ๊ฐ์( Level 1) (0) | 2021.10.21 |
---|---|
[c++] ํ๋ก๊ทธ๋๋จธ์ค - ๋ชจ์๊ณ ์ฌ( Level 1) (0) | 2021.10.21 |
[c++] ํ๋ก๊ทธ๋๋จธ์ค - ๋ก๋์ ์ต๊ณ ์์์ ์ต์ ์์( Level 1) (0) | 2021.10.20 |
[c++] ํ๋ก๊ทธ๋๋จธ์ค - ๋ ๋งต๊ฒ( Level 2) (0) | 2021.10.20 |
[c++] ํ๋ก๊ทธ๋๋จธ์ค - ๋จ์ฒด์ฌ์ง ์ฐ๊ธฐ( Level 2, 2017 ์นด์นด์ค์ฝ๋ ๋ณธ์ ) (0) | 2021.10.20 |
[c++] ํ๋ก๊ทธ๋๋จธ์ค - ๋จ์ด๋ณํ( Level 3) (0) | 2021.10.20 |
๋๊ธ