코딩테스트

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

[프로그래머스/C++] Lv.0 소문자로 바꾸기

문제 코드 #include #include #include #include using namespace std; string solution(string myString) { transform(myString.begin(), myString.end(), myString.begin(), ::tolower); return myString; }

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

[프로그래머스/C++] Lv.0 대문자로 바꾸기

문제 코드 #include #include using namespace std; string solution(string myString) { string answer = ""; transform(myString.begin(), myString.end(), myString.begin(), ::toupper); return myString; }

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

[프로그래머스/C++] Lv.0 원하는 문자열 찾기

문제 코드 #include #include using namespace std; int solution(string myString, string pat) { int answer = 0; transform(myString.begin(), myString.end(), myString.begin(), ::tolower); transform(pat.begin(), pat.end(), pat.begin(), ::tolower); if (myString.find(pat) != string::npos) { return 1; } return answer; } https://modoocode.com/275 https://artist-developer.tistory.com/28 C++ transform std::tran..

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

[프로그래머스/C++] Lv.0 길이에 따른 연산

문제 코드 #include #include using namespace std; int solution(vector num_list) { int answer = 0; if (num_list.size() >= 11) { for (int n : num_list) { answer += n; } } else if (num_list.size()

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

[프로그래머스/C++] Lv.0 1로 만들기

문제 코드 #include #include #include using namespace std; int solution(vector num_list) { int answer = 0; for (int n : num_list) { int temp = n; while (temp != 1) { if (temp & 1) { temp = (temp - 1) / 2; } else { temp /= 2; } answer++; } } return answer; }

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

[프로그래머스/C++] Lv.0 조건에 맞게 수열 반환하기 1

문제 코드 #include #include #include using namespace std; vector solution(vector arr) { vector answer; for (int n : arr) { if (n & 1 && n = 50) { answer.emplace_back(n * 0.5f); continue; } answer.emplace_back(n); } return answer; }

mane
'코딩테스트' 카테고리의 글 목록 (6 Page)