[LeetCode] 709. To Lower Case(C++)
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"
class Solution { public: string toLowerCase(string str) { for (int i = 0; i < str.size(); i++) { if (str[i] >= 'A' && str[i] <= 'Z') { str[i] = str[i] - 'A' + 'a'; } } return str; } };
我的提交執行用時
已經戰勝 100.00 % 的 cpp 提交記錄
相關推薦
[LeetCode] 709. To Lower Case(C++)
Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. Example 1: Input: "Hello" Out
[LeetCode]709. To Lower Case
out parameter imp () inpu love ++ strong UNC Implement function ToLowerCase() that has a string parameter str, and returns the same strin
leetcode 709. To Lower Case(水,大寫轉小寫)
Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowe
LeetCode 709 To Lower Case 解題報告
題目要求 Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. 題目分析及思路 題目要求返回一個字串的小寫形式。可以直接使用lower()函式
Leetcode——709. To Lower Case
題目原址 題目描述 Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. Exampl
LeetCode 709 To Lower Case 轉換成小寫字母
class Solution { public: string toLowerCase(string str) { for(auto &c:str) { if(c>='A' && c
LeetCode 709.To Lower Case
字母 put NPU 轉化 沒有 運行 des image 分享 Description Implement function ToLowerCase() that has a string parameter str, and returns the same strin
【LeetCode】709. To Lower Case題解(C++)
【LeetCode】709. To Lower Case(C++) 709. To Lower Case Describe: Implement function ToLowerCase() that has a string parameter str, a
【Leetcode】709. To Lower Case
clas esc scrip int builder cte func pre 遍歷 To Lower Case Description Implement function ToLowerCase() that has a string parameter str, an
【Leetcode】To Lower Case
題目大意:把所有的大寫字母轉化為小寫字母 解題方法:判斷字元是否在‘A’-‘Z’中,如果是,則轉換為小寫,如果不是,保留不變既可 Python解法: class Solution(object): def toLowerCase(self, str):
leetcode ( To Lower Case)
Title: To Lower Case 709 Difficulty:Easy 原題leetcode地址: https://leetcode.com/problems/to-lower-case/ 1. 大寫字元加3
709 to lower case 及字串方法總結
/** * @param {string} str * @return {string} */ var toLowerCase = function(str) { var result = ''; for(var i =0; i<
709. To Lower Case
uri 小寫 urn 得到 The public input amp 差值 Algorithm to-lower-case https://leetcode.com/problems/to-lower-case/ 1)problem Implement function T
C#LeetCode刷題之#709-轉換成小寫字母(To Lower Case)
問題 實現函式 ToLowerCase(),該函式接收一個字串引數 str,並將該字串中的大寫字母轉換成小寫字母,之後返回新的字串。 輸入: "Hello" 輸出: "hello" 輸入: "here" 輸出: "here" 輸入:
【LeetCode】709(Java)To Lower Case
Question: Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. 實現函式ToLowerCase st
leetcode 709. 轉換成小寫字母(To Lower Case)
string return class lis 函數 目錄 res lower 大寫 目錄 題目描述: 示例 1: 示例 2: 示例 3: 解法:
[LeetCode] To Lower Case 轉為小寫
Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. Example 1: Input: "Hello"
Leetcode709.To Lower Case轉換成小寫字母
實現函式 ToLowerCase(),該函式接收一個字串引數 str,並將該字串中的大寫字母轉換成小寫字母,之後返回新的字串。 示例 1: 輸入: "Hello" 輸出: "hello" 示例 2: 輸入: "here" 輸出: "here" 示例 
leetcode709. To Lower Case
Example 1: Input: "Hello" Output: "hello" Example 2: Input: "here" Output: "here" Example 3: Input: "LOVELY" Output: "lovely" 1
leetcode709—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" Exam