当前位置:网站首页>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
边栏推荐
- [graph theory brush question-5] Li Kou 1971 Find out if there is a path in the graph
- SQL Server Connectors By Thread Pool | DTSQLServerTP plugin instructions
- Servlet learning notes
- Recognition of high-speed road signs by Matlab using alexnet
- Recommend an open source free drawing software draw IO exportable vector graph
- selenium.common.exceptions.WebDriverException: Message: ‘chromedriver‘ executable needs to be in PAT
- Shanghai responded that "flour official website is an illegal website": neglect of operation and maintenance has been "hacked", and the police have filed a case
- Some basic knowledge of devexpress report development
- On BIM data redundancy theory
- 【栈和队列专题】—— 滑动窗口
猜你喜欢
Matlab analytic hierarchy process to quickly calculate the weight
Don't bother tensorflow learning notes (10-12) -- Constructing a simple neural network and its visualization
Building the tide, building the foundation and winning the future -- the successful holding of zdns Partner Conference
Scripy tutorial - (2) write a simple crawler
JDBC tool class jdbcfiledateutil uploads files and date format conversion, including the latest, simplest and easiest way to upload single files and multiple files
An error is reported when sqoop imports data from Mysql to HDFS: sqlexception in nextkeyvalue
ArcGIS JS version military landmark drawing (dovetail arrow, pincer arrow, assembly area) fan and other custom graphics
DTMF双音多频信号仿真演示系统
Five minutes to show you what JWT is
Rt-1052 learning notes - GPIO architecture analysis
随机推荐
Shanghai responded that "flour official website is an illegal website": neglect of operation and maintenance has been "hacked", and the police have filed a case
上海回應“面粉官網是非法網站”:疏於運維被“黑”,警方已立案
【栈和队列专题】—— 滑动窗口
三十.什么是vm和vc?
On BIM data redundancy theory
6-5 字符串 - 2. 字符串复制(赋值) (10 分)C语言标准函数库中包括 strcpy 函数,用于字符串复制(赋值)。作为练习,我们自己编写一个功能与之相同的函数。
Some basic configurations in interlij idea
Numpy - creation of data type and array
PostgreSQL basic functions
上海回应“面粉官网是非法网站”:疏于运维被“黑”,警方已立案
Five minutes to show you what JWT is
2022 - Data Warehouse - [time dimension table] - year, week and holiday
论文写作 19: 会议论文与期刊论文的区别
[problem solving] 'ASCII' codec can't encode characters in position XX XX: ordinal not in range (128)
Analysis of the relationship between generalized Bim and CAD under the current background
Numpy mathematical function & logical function
Three. Based on ply format point cloud voxel model JS upload interface writing
R language uses the preprocess function of caret package for data preprocessing: BoxCox transform all data columns (convert non normal distribution data columns to normal distribution data and can not
Latest investigation and progress of building intelligence based on sati
Notes of Tang Shu's grammar class in postgraduate entrance examination English