• 문제 링크
To Lower Case - LeetCode
Can you solve this real interview question? 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: "he
leetcode.com
• 풀이 코드
public class Solution {
public String toLowerCase(String s) {
char[] arr = s.toCharArray();
for (int i = 0; i < arr.length; i++) if (arr[i] > 64 && arr[i] < 91) arr[i] |= 32;
return new String(arr);
}
}'Problem Solving > LeetCode' 카테고리의 다른 글
| [LeetCode] 724. Find Pivot Index - Java (0) | 2026.10.04 |
|---|---|
| [LeetCode] 717. 1-bit and 2-bit Characters - Java (0) | 2026.10.03 |
| [LeetCode] 706. Design HashMap - Java (0) | 2026.10.01 |
| [LeetCode] 705. Design HashSet - Java (0) | 2026.09.30 |
| [LeetCode] 704. Binary Search - Java (0) | 2026.09.29 |
댓글