当前位置:网站首页>LeetCode 709、转换成小写字母
LeetCode 709、转换成小写字母
2022-04-23 20:23:00 【亡于灬】
709、转换成小写字母
1)题目描述
给你一个字符串 s
,将该字符串中的大写字母转换成相同的小写字母,返回新的字符串。
示例 1:
输入:s = "Hello"
输出:"hello"
示例 2:
输入:s = "here"
输出:"here"
示例 3:
输入:s = "LOVELY"
输出:"lovely"
提示:
1 <= s.length <= 100
s
由 ASCII 字符集中的可打印字符组成
2)分析
遍历字符串,若是大写字符,加32转换成小写字母。
3)C++
代码
class Solution {
public:
string toLowerCase(string s) {
for(int i=0;i<s.length();i++){
if(s[i]>='A'&&s[i]<='Z')
s[i]+=32;
}
return s;
}
};
版权声明
本文为[亡于灬]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_38342510/article/details/124360505
边栏推荐
- 【问题解决】‘ascii‘ codec can‘t encode characters in position xx-xx: ordinal not in range(128)
- 三十一. `prototype`显示原型属性和`__proto__`隐式原型属性
- I JS deep copy and shallow copy
- What is the difference between a host and a server?
- Mathematical modeling column | Part 5: MATLAB optimization model solving method (Part I): Standard Model
- 16MySQL之DCL 中 COMMIT和ROllBACK
- ABAQUS script email auto notification
- 【PTA】整除光棍
- How do BIM swindlers cheat? (turn)
- How can matlab obtain the truncated image in trainingimagelabeler
猜你喜欢
Sqoop imports tinyint type fields to boolean type
【目标跟踪】基于帧差法结合卡尔曼滤波实现行人姿态识别附matlab代码
Matlab analytic hierarchy process to quickly calculate the weight
Tensorflow 2 basic operation dictionary
2022DASCTF Apr X FATE 防疫挑战赛 CRYPTO easy_real
Handwritten Google's first generation distributed computing framework MapReduce
Actual measurement of automatic ticket grabbing script of barley network based on selenium (the first part of the new year)
Some basic knowledge of devexpress report development
selenium.common.exceptions.WebDriverException: Message: ‘chromedriver‘ executable needs to be in PAT
PCL点云处理之计算两平面交线(五十一)
随机推荐
bounding box iou
一. js的深拷贝和浅拷贝
R语言使用timeROC包计算存在竞争风险情况下的生存资料多时间AUC值、使用cox模型、并添加协变量、R语言使用timeROC包的plotAUCcurve函数可视化多时间生存资料的AUC曲线
中金财富公司怎么样,开户安全吗
16MySQL之DCL 中 COMMIT和ROllBACK
上海回应“面粉官网是非法网站”:疏于运维被“黑”,警方已立案
堡垒机、跳板机JumpServer的搭建,以及使用,图文详细
SIGIR'22 "Microsoft" CTR estimation: using context information to promote feature representation learning
[PTA] get rid of singles
微信中金财富高端专区安全吗,证券如何开户呢
The flinkcdc reports an error: but this is no longer available on the server
Unity 模型整体更改材质
Plato Farm元宇宙IEO上线四大,链上交易颇高
WordPress插件:WP-China-Yes解决国内访问官网慢的方法
XXXI` Prototype ` displays prototype properties and`__ proto__` Implicit prototype properties
How to protect ECs from hacker attacks?
Matlab analytic hierarchy process to quickly calculate the weight
Remote code execution in Win 11 using wpad / PAC and JScript 1
考研英语唐叔的语法课笔记
[PTA] l1-006 continuity factor