【LeetCode】To Lower Case(转换成小写字母) 这道题是LeetCode里的第709道题。 题目要求: 实现函数 ToLowerCase(),该函数接收一个字符串参数 str,并将该字符串中的大写字母转换成小写字母,之后返回新的字符串。 示例 1: 示例 2: 示例 3: 这么简单的题,还要啥解析啊! 解题代码: 提交结果: 个人总结: 这...
[LeetCode]709. To Lower Case Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. 将字符串的大写字母转成小写字母字符串。 Example 1: Example 2: Example 3: 思路: ASCII码中大写字母比小写字母小32,直接加上32变成小写字母。......
709. To Lower CaseImplement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase.Example 1:Input: "Hello" Output: "hello" Example 2:Input: "here" Output: "here" Example 3:Input: "LOVELY" Output: "lovely" 题目描述:实现一个 ToLowerCase 函数,...
*@param{string}str*@return{string} */vartoLowerCase =function(str) {returnstr.toLowerCase() }; ↑↑↑这是 JavaScript 的懒人解法。↑↑↑ #@param{String} str#@return{String}defto_lower_case(str)down ="abcdefghijklmnopqrstuvwxyz"up ="ABCDEFGHIJKLMNOPQRSTUVWXYZ"result =""str.each_chardo|...
709. To Lower Case(Easy) Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. Example 1: Input: "Hello" Output: "hello" Example 2: Input: "here" Output: "here" Example 3: Input: "LOVELY" Output: "lovely" Note: there are many...
简介:LeetCode 709. To Lower Case 709. To Lower Case Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. Example 1: Input: "Hello"Output: "hello" Example 2: Input: "here"Output: "here" ...
Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. Example 1: Input: "Hello" Output: "hello" 1. 2. Example 2: Input: "here" Output: "here" 1. 2. Example 3: Input: "LOVELY" ...
To Lower Case(转换成小写字母) * 实现函数 ToLowerCase(),该函数接收一个字符串参数 str,并将该字符串中的大写字母转换成小写字母,之后返回新的字符串。 */ public class Solution709 { public static void main(String[] args) { Solution709 solution709 = new Solution709(); String str = "Hello"; ...
LeetCode 709 To Lower Case 解法 根据ASCII码判断并返回即可,大写 A - Z 为 065 - 090,小写 a - z 为 097 - 122,正好相隔 32,当为大写时,将 ASCII 码 + 32 即可。 代码语言:javascript 代码 classSolution{publicStringtoLowerCase(String str){char[]chars=str.toCharArray();for(int i=0;i<...
709. To Lower Case # 题目 # Given a string s, return the string after replacing every uppercase letter with the same lowercase letter. Example 1: Input: s = "Hello" Output: "hello" Example 2: Input: s = "here" Output: "here" Example 3: Input: s = "LOVE