zl程序教程

您现在的位置是:首页 >  其他

当前栏目

[LeetCode]709. 转换成小写字母

LeetCode 转换成 小写字母
2023-09-11 14:18:49 时间

题目来源 LeetCode

算法标签 ASCII

题目描述

实现函数 ToLowerCase(),该函数接收一个字符串参数 str,并将该字符串中的大写字母转换成小写字母,之后返回新的字符串。

示例 1:

输入: “Hello”
输出: “hello”

示例 2:

输入: “here”
输出: “here”

示例 3:

输入: “LOVELY”
输出: “lovely”

思路

利用ASCII转换

AC代码

class Solution {
public:
    int ans;
    int busyStudent(vector<int>& startTime, vector<int>& endTime, int queryTime) {
        for(int i=0;i<startTime.size();i++)
            if(startTime[i]<=queryTime&&endTime[i]>=queryTime)ans++;
    return ans;
    }
};