프로그래머스

코딩테스트/프로그래머스(C++)_Level.0

[프로그래머스/C++] Lv.0 세로 읽기

문제 코드 #include using namespace std; string solution(string my_string, int m, int c) { string answer = ""; for(int i = 0; i

코딩테스트/프로그래머스(C++)_Level.0

[프로그래머스/C++] Lv.0 접두사인지 확인하기

문제 코드 int solution(string my_string, string is_prefix) { int answer = 0; string s; if (my_string.length() >= is_prefix.length()) { s.assign(my_string.begin(), my_string.begin() + is_prefix.length()); answer = (s == is_prefix) ? 1 : 0; } else { answer = 0; } return answer; // return (my_string.find(is_prefix) == 0); }

코딩테스트/프로그래머스(C++)_Level.0

[프로그래머스/C++] Lv.0 문자열의 앞의 n글자

문제 코드 string solution(string my_string, int n) { string answer = ""; for(int i = 0; i

코딩테스트/프로그래머스(C++)_Level.0

[프로그래머스/C++] Lv.0 접미사인지 확인하기

문제 코드 int solution(string my_string, string is_suffix) { int answer = 0; if (my_string.length() >= is_suffix.length()) { if (my_string.substr(my_string.length() - is_suffix.length()) == is_suffix) { return true; } } return answer; }

코딩테스트/프로그래머스(C++)_Level.0

[프로그래머스/C++] Lv.0 접미사 배열

문제 코드 #include using namespace std; vector solution(string my_string) { vector answer; for(int i = 0; i

코딩테스트/프로그래머스(C++)_Level.0

[프로그래머스/C++] Lv.0 주사위 게임 3

문제 코드 int solution(int a, int b, int c, int d) { int answer = 0; vector numbers = { a,b,c,d }; sort(numbers.begin(), numbers.end()); if (numbers[0] == numbers[3]) { return 1111 * numbers[0]; } else if (numbers[0] == numbers[1] && numbers[2] == numbers[3]) { return (numbers[0] + numbers[2]) * abs(numbers[0] - numbers[2]); } else if (numbers[1] == numbers[2] && (numbers[0] == numbers[1] || numbers..

mane
'프로그래머스' 태그의 글 목록 (10 Page)