본문 바로가기

코딩 테스트/프로그래머스 코딩테스트

(26)
올바른 괄호 #include #include using namespace std; bool solution(string s) { bool answer = true; int openCnt = 0; int closeCnt = 0; // 예외 처리 if(s[0] == ')') { cout
신규 아이디 추천 - 미해결... #include #include #include #include #include // 특정 문자 제거를 위한 라이브러리 using namespace std; string solution(string new_id) { string answer = ""; string str_lower; // 1 단계 : 대문자 -> 소문자 for(int i=0; i= 'A' && new_id.at(i) = 'a' && cCheck = '0' && cCheck = 1) { if(str_cpy[idx-1] == '.' && str_cpy[idx] == '.') { str_cpy.replace(str_cpy.find(find_str), find_str.length(), replace_str); idx--; } } idx++; }..
행렬의 곱셈 #include #include #include using namespace std; vector solution(vector arr1, vector arr2) { vector answer; cout
성격 유형 검사하기 https://school.programmers.co.kr/learn/courses/30/lessons/118666 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr #include #include #include #include using namespace std; string solution(vector survey, vector choices) { string answer; const int SCORES[7] = {3, 2, 1, 0, 1, 2, 3}; // R, T // C, F // J, M // A, N // -> 4 x 2 행렬 map m; m...
최댓값과 최솟값 https://school.programmers.co.kr/learn/courses/30/lessons/12939 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr #include #include #include #include #include #include #include #include using namespace std; string solution(string s) { string answer = ""; int length = s.size(); int minVal = 10000; int maxVal = -10000; char s1[10000]; st..
숫자 문자열과 영단어 풀이 https://school.programmers.co.kr/learn/courses/30/lessons/81301 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr #include #include #include #include using namespace std; #define MAX_NUM 10 int solution(string s) { int answer = 0; int length = s.size(); string lookUpTable[MAX_NUM] = {"zero", "one", "two", "three", "four", "five", "six"..