전체 글333 [프로그래머스/C++] 문자열의 앞의 n글자 문제문자열 my_string과 정수 n이 매개변수로 주어질 때, my_string의 앞의 n글자로 이루어진 문자열을 return 하는 solution 함수를 작성해 주세요. 솔루션#include #include using namespace std;string solution(string my_string, int n) { string answer = ""; for(int i = 0; i https://school.programmers.co.kr/learn/courses/30/lessons/181907 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 2025. 2. 17. [프로그래머스/C++] 배열 만들기 1 문제정수 n과 k가 주어졌을 때, 1 이상 n이하의 정수 중에서 k의 배수를 오름차순으로 저장한 배열을 return 하는 solution 함수를 완성해 주세요. 솔루션#include #include using namespace std;vector solution(int n, int k) { vector answer; for(int i = k; i https://school.programmers.co.kr/learn/courses/30/lessons/181901 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 2025. 2. 17. [프로그래머스/C++] 카운트 다운 문제정수 start_num와 end_num가 주어질 때, start_num에서 end_num까지 1씩 감소하는 수들을 차례로 담은 리스트를 return하도록 solution 함수를 완성해주세요. 솔루션#include #include using namespace std;vector solution(int start_num, int end_num) { vector answer; for(int i = start_num; i >= end_num; i--){ answer.push_back(i); } return answer;} https://school.programmers.co.kr/learn/courses/30/lessons/181899 프로그래머스SW개발자를 위한 평가, 교.. 2025. 2. 17. [프로그래머스/C++] 가까운 1 찾기 문제정수 배열 arr가 주어집니다. 이때 arr의 원소는 1 또는 0입니다. 정수 idx가 주어졌을 때, idx보다 크면서 배열의 값이 1인 가장 작은 인덱스를 찾아서 반환하는 solution 함수를 완성해 주세요. 단, 만약 그러한 인덱스가 없다면 -1을 반환합니다. 솔루션#include #include using namespace std;int solution(vector arr, int idx) { int answer = -1; for(int i = idx; i https://school.programmers.co.kr/learn/courses/30/lessons/181898 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베.. 2025. 2. 17. [프로그래머스/C++] 첫 번째로 나오는 음수 문제정수 리스트 num_list가 주어질 때, 첫 번째로 나오는 음수의 인덱스를 return하도록 solution 함수를 완성해주세요. 음수가 없다면 -1을 return합니다. 솔루션#include #include using namespace std;int solution(vector num_list) { int answer = -1; for(int i = 0; i https://school.programmers.co.kr/learn/courses/30/lessons/181896 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 2025. 2. 15. [프로그래머스/C++] n 번째 원소부터 문제정수 리스트 num_list와 정수 n이 주어질 때, n 번째 원소부터 마지막 원소까지의 모든 원소를 담은 리스트를 return하도록 solution 함수를 완성해주세요. 솔루션#include #include using namespace std;vector solution(vector num_list, int n) { vector answer; for(int i = n-1; i https://school.programmers.co.kr/learn/courses/30/lessons/181892 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 2025. 2. 15. [프로그래머스/C++] 순서 바꾸기 문제정수 리스트 num_list와 정수 n이 주어질 때, num_list를 n 번째 원소 이후의 원소들과 n 번째까지의 원소들로 나눠 n 번째 원소 이후의 원소들을 n 번째까지의 원소들 앞에 붙인 리스트를 return하도록 solution 함수를 완성해주세요. 솔루션#include #include using namespace std;vector solution(vector num_list, int n) { vector answer; for(int i = n; i https://school.programmers.co.kr/learn/courses/30/lessons/181891 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠.. 2025. 2. 15. [프로그래머스/C++] n 번째 원소까지 문제정수 리스트 num_list와 정수 n이 주어질 때, num_list의 첫 번째 원소부터 n 번째 원소까지의 모든 원소를 담은 리스트를 return하도록 solution 함수를 완성해주세요. 솔루션#include #include using namespace std;vector solution(vector num_list, int n) { vector answer; for(int i = 0; i https://school.programmers.co.kr/learn/courses/30/lessons/181889 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 2025. 2. 15. [프로그래머스/C++] n개 간격의 원소들 문제정수 리스트 num_list와 정수 n이 주어질 때, num_list의 첫 번째 원소부터 마지막 원소까지 n개 간격으로 저장되어있는 원소들을 차례로 담은 리스트를 return하도록 solution 함수를 완성해주세요. 솔루션#include #include using namespace std;vector solution(vector num_list, int n) { vector answer; for(int i = 0; i https://school.programmers.co.kr/learn/courses/30/lessons/181888 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 2025. 2. 15. [프로그래머스/C++] 홀수 vs 짝수 문제정수 리스트 num_list가 주어집니다. 가장 첫 번째 원소를 1번 원소라고 할 때, 홀수 번째 원소들의 합과 짝수 번째 원소들의 합 중 큰 값을 return 하도록 solution 함수를 완성해주세요. 두 값이 같을 경우 그 값을 return합니다. 솔루션#include #include using namespace std;int solution(vector num_list) { int even = 0; int odd = 0; for(int i = 0; i odd){ return even; } else{ return odd; }} https://school.programmers.co.kr/learn/courses/30/lessons/1818.. 2025. 2. 15. 이전 1 ··· 5 6 7 8 9 10 11 ··· 34 다음