# To Lower Case (Leetcode 709)

Difficulty: Easy Link: Day 24: May Leetcode Challenge

## Problem Description

Given a string `s`, return the string after replacing every uppercase letter with the same lowercase letter.

### Examples

``````Input: s = "Hello"
Output: "hello"
``````
``````Input: s = "here"
Output: "here"
``````
``````Input: s = "LOVELY"
Output: "lovely"
``````

### Constraints

• `1 <= s.length <= 100`
• `s` consists of printable ASCII characters.

## Solution

The solution is quite straight forward and you might be tempted to use the built-in functions to convert the string directly to lowercase using lowercased(). However, the interviewer might be interested in how you implement it so you should try to solve with your own implementation.

We can easily implement our lowercase function using the fact the ASCII values of lowercase and uppercase alphabets differ by 32 ( ‘A’ = 65, ‘B’ = 66 … ‘a’ = 98, ‘b’ = 99.. so on ).

## Complexity Analysis

• Time complexity: O(N) to parse the input string.
• Space complexity: O(N) to keep the output.