g0701_0800.s0709_to_lower_case.Solution Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leetcode-in-java Show documentation
Show all versions of leetcode-in-java Show documentation
Java-based LeetCode algorithm problem solutions, regularly updated
The newest version!
package g0701_0800.s0709_to_lower_case;
// #Easy #String #Programming_Skills_I_Day_9_String
// #2022_03_23_Time_1_ms_(71.74%)_Space_42_MB_(52.94%)
public class Solution {
public String toLowerCase(String s) {
char[] c = s.toCharArray();
for (int i = 0; i < s.length(); i++) {
if (c[i] <= 'Z' && c[i] >= 'A') {
c[i] = (char) (c[i] - 'A' + 'a');
}
}
return new String(c);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy