알고리즘/프로그래머스 2단계 43

프로그래머스 - 최솟값 만들기 - C++

https://school.programmers.co.kr/learn/courses/30/lessons/12941 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr #include #include#include using namespace std;int solution(vector A, vector B){ int sum=0; sort(A.begin(),A.end()); sort(B.begin(),B.end(),greater()); for(int i=0;i 두 벡터가 주어졌을 때 원소의 순서를 바꿔서 최소값이 되는 경우를 찾는 문..

프로그래머스 - 올바른 괄호 - C++

https://school.programmers.co.kr/learn/courses/30/lessons/12909?language=cpp 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr #include#include using namespace std;bool solution(string s){ bool answer = true; int oN=0,cN=0; for(int i=0;i 괄호가 올바르게 돼있는지를 판별하는 문제이다.짝이 안맞거나 ) 이게 ( 보다 먼저있거나 하면 올바르지 않은것이다. 따라서 ( , ) 을 각각 카운트하며 ( 의 개수보..

프로그래머스 - 최댓값과 최소값 - C++

https://school.programmers.co.kr/learn/courses/30/lessons/12939#qna 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr #include #include using namespace std;string solution(string s) { string answer = ""; int max = -2147483648; int min = 2147483647 ; while(true) { int idx = s.find(' '); string im = s.subst..