[프로그래머스 Level 2, C++] 최댓값과 최솟값


[프로그래머스 Level 2, C++] 최댓값과 최솟값

문제 : 최댓값과 최솟값 풀이 방법 if else 문으로 숫자일 경우를 배열에 넣고 최댓값과 최솟값만 구해주면 된다 소스 코드 #include #include #include using namespace std; string solution(string s) { string answer = ""; vector arr; string temp; for(char & c : s) { if(c == '-' || c != ' ') { temp.push_back(c); } else if (c == ' ') { arr.push_back(stoi(temp)); temp.clear(); } } arr.push_back(stoi(temp)); answer.append(to_string(*min_element(arr.begi..


원문링크 : [프로그래머스 Level 2, C++] 최댓값과 최솟값