본문 바로가기
IT/알고리즘

13] Leetcode 709. To Lower Case

by 깻잎쌈 2020. 6. 25.
반응형
 

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.size();i++)
            if(str[i]>='A' && str[i]<='Z')
                str[i] +=32;
        
        //cout<<'A'-'a';
        
        return str;
    }
};

아스키코드 

반응형

댓글