릿코드(LEETCODE)
709. To Lower Case
cepiloth
2020. 2. 3. 19:02
반응형

https://leetcode.com/problems/to-lower-case/
To Lower Case - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
주어진 문자열을 소문자로 취환 하는 문제
아스키 코드값을 이용하여 풀이
class Solution {
public:
string toLowerCase(string str) {
for(int i=0;i<str.length();i++){
if(str.at(i) >= 65 && str.at(i) <= 90){
str.at(i) = int(str.at(i)) + 32;
}
}
return str;
}
};
반응형