Problem
Problem URL : 최댓값과 최솟값
[1] Answer Code (18. 07. 25)
string solution(string s) {
string answer = "";
istringstream iss(s);
vector<int> v;
/*
// [1] : Type : string
for(string _s; iss >> _s; ){
v.push_back(stoi(_s));
}
*/
// [2] : Type : int
for(int _s; iss >> _s; ){
v.push_back(_s);
}
sort(v.begin(), v.end());
answer = to_string(v[0]) + " " + to_string(v[v.size()-1]);
return answer;
}
[1] Answer Code (18. 07. 25)
- [1]으로 했을 시
stoi
,istringstream
사용 !