0
点赞
收藏
分享

微信扫一扫

【Leetcode_easy】709. To Lower Case

转角一扇门 2022-07-12 阅读 63
编程语言

problem

​​709. To Lower Case​​

solution1:

class Solution {
public:
string toLowerCase(string str) {
string res = "";
for(auto ch:str)
{
if(ch>='A'&&ch<='Z') ch +=32;
res += ch;
}
return res;
}
};

solution2:

class Solution {
public:
string toLowerCase(string str) {
for(auto &ch:str)
{
if(ch>='A'&&ch<='Z') ch +=32;
}
return str;
}
};

参考

1. ​​Leetcode_easy_709. To Lower Case​​;

2. ​​Grandyang​​;

举报

相关推荐

0 条评论