bugfree Icon
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course

Leetcode Problem 709. To Lower Case

709. To Lower Case

Leetcode Solutions

Approach: HashMap

  1. Create a hashmap that maps each uppercase letter ('A' to 'Z') to its corresponding lowercase letter ('a' to 'z').
  2. Initialize an empty string to store the result.
  3. Iterate over each character in the input string.
  4. For each character, check if it is an uppercase letter by looking it up in the hashmap.
  5. If it is an uppercase letter, append the corresponding lowercase letter from the hashmap to the result string.
  6. If it is not an uppercase letter, append the character as it is to the result string.
  7. Return the result string.
UML Thumbnail

Approach: ASCII Value Manipulation

Ask Question

Programming Language
image/screenshot of info(optional)
Full Screen
Loading...

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...