当前位置:网站首页>Leetcode 709, convert to lowercase
Leetcode 709, convert to lowercase
2022-04-23 20:26:00 【Die in a trap】
709、 Convert to lowercase
1) Title Description
Give you a string s
, Convert the uppercase letters in the string to the same lowercase letters , Returns a new string .
Example 1:
Input :s = "Hello"
Output :"hello"
Example 2:
Input :s = "here"
Output :"here"
Example 3:
Input :s = "LOVELY"
Output :"lovely"
Tips :
1 <= s.length <= 100
s
from ASCII Composition of printable characters in the character set
2) analysis
Traversal string , In case of uppercase characters , Add 32 Convert to lowercase .
3)C++
Code
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;
}
};
版权声明
本文为[Die in a trap]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204232023107334.html
边栏推荐
- go-zero框架数据库方面避坑指南
- 【PTA】L2-011 玩转二叉树
- LeetCode 74、搜索二维矩阵
- How do BIM swindlers cheat? (turn)
- 【PTA】L1-002 打印沙漏
- On BIM data redundancy theory
- [graph theory brush question-5] Li Kou 1971 Find out if there is a path in the graph
- BMP JPEG picture to vector image contourtrace
- Solve the Chinese garbled code of URL in JS - decoding
- Imitation Baidu map realizes the three buttons to switch the map mode by automatically shrinking the bottom
猜你喜欢
考研英语唐叔的语法课笔记
[talkative cloud native] load balancing - the passenger flow of small restaurants has increased
WordPress plug-in: WP CHINA Yes solution to slow domestic access to the official website
Sqoop imports tinyint type fields to boolean type
[graph theory brush question-5] Li Kou 1971 Find out if there is a path in the graph
Numpy mathematical function & logical function
The construction and use of Fortress machine and springboard machine jumpserver are detailed in pictures and texts
DOS command of Intranet penetration
LeetCode 116. 填充每个节点的下一个右侧节点指针
BMP JPEG 图片转换为矢量图像 ContourTrace
随机推荐
一. js的深拷贝和浅拷贝
How does onlyoffice solve no route to host
DNS cloud school | quickly locate DNS resolution exceptions and keep these four DNS status codes in mind
Handwritten Google's first generation distributed computing framework MapReduce
Still using listview? Use animatedlist to make list elements move
The market share of the financial industry exceeds 50%, and zdns has built a solid foundation for the financial technology network
6-5 字符串 - 2. 字符串复制(赋值) (10 分)C语言标准函数库中包括 strcpy 函数,用于字符串复制(赋值)。作为练习,我们自己编写一个功能与之相同的函数。
[problem solving] 'ASCII' codec can't encode characters in position XX XX: ordinal not in range (128)
[PTA] l2-011 play with binary tree
Notes of Tang Shu's grammar class in postgraduate entrance examination English
论文写作 19: 会议论文与期刊论文的区别
BMP JPEG picture to vector image contourtrace
A useless confession artifact
Implementation of mypromise
LeetCode 709、转换成小写字母
Install MySQL 5.0 under Linux 64bit 6 - the root password cannot be modified
Three. Based on ply format point cloud voxel model JS upload interface writing
2022DASCTF Apr X FATE 防疫挑战赛 CRYPTO easy_real
【PTA】L1-006 连续因子
DNS cloud school | analysis of hidden tunnel attacks in the hidden corner of DNS