To LowerCase - Leetcode
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:
Option 1:
Each character can be checked and changed to lowercase. It is the longest way when we are doing with Java. Because in Java there are more simple steps.
Option 2:
String has in-build method of toLowerCase().
For more Leetcode Problems
Input: "LOVELY" Output: "lovely"
class Solution { public String toLowerCase(String str) { return str.toLowerCase(); } }
Click this link to try it on Leetcode
Here string can be changed to lowercase in many ways.
Option 1:
Each character can be checked and changed to lowercase. It is the longest way when we are doing with Java. Because in Java there are more simple steps.
Option 2:
String has in-build method of toLowerCase().
For more Leetcode Problems
Comments
Post a Comment