Talentd Logo
Talentd#1 Freshers Platform
Jobs
Learning
Career Tools
Talentd Logo
Talentd#1 Freshers Platform
Jobs
Learning
Career Tools
Talentd Logo
Talentd#1 Freshers Platform
Jobs
Learning
Career Tools
Talentd Logo
Talentd#1 Freshers Platform
Jobs
Learning
Career Tools
Talentd Logo
Talentd#1 Freshers Platform
Home
Talentd Logo
Talentd

Your trusted platform to ace any job interviews, craft the perfect resumes, and land your dream jobs.

P
Featured on
Product Hunt
▲455
All services are online

Products

  • Resume Review
  • Company Prep Pack
  • DSA Corner
  • Jobs
  • Internships
  • Fresher Jobs
  • Roadmaps
  • Tax Calculator

Resources

  • Articles
  • DRDO Internships

Support

  • Contact Us

DSA & Interview Prep

  • DSA Questions
  • DSA Sheets
  • Company Questions
  • Topics

Company

  • Companies Hiring
  • About
  • Contact
  • Advertisement

Legal

  • Privacy Policy
  • Terms & Conditions
  • Refund Policy
  • Delivery Policy

Popular Skills

Browse All Skills →

Popular Tags

Browse All Tags →

© 2025 Talentd.in - All rights reserved

Privacy PolicyTerms & Conditions
Talentd Logo
Talentd#1 Freshers Platform
Jobs
Learning
Career Tools
Talentd Logo
Talentd#1 Freshers Platform
Jobs
Learning
Career Tools
Talentd Logo
Talentd#1 Freshers Platform
Jobs
Learning
Career Tools
Talentd Logo
Talentd#1 Freshers Platform
Jobs
Learning
Career Tools
Talentd Logo
Talentd#1 Freshers Platform
DSA Corner
DashboardQuestionsTopicsCompaniesSheets

Talentd Logo
Talentd

Your trusted platform to ace any job interviews, craft the perfect resumes, and land your dream jobs.

P
Featured on
Product Hunt
▲455
All services are online

Products

  • Resume Review
  • Company Prep Pack
  • DSA Corner
  • Jobs
  • Internships
  • Fresher Jobs
  • Roadmaps
  • Tax Calculator

Resources

  • Articles
  • DRDO Internships

Support

  • Contact Us

DSA & Interview Prep

  • DSA Questions
  • DSA Sheets
  • Company Questions
  • Topics

Company

  • Companies Hiring
  • About
  • Contact
  • Advertisement

Legal

  • Privacy Policy
  • Terms & Conditions
  • Refund Policy
  • Delivery Policy

Popular Skills

Browse All Skills →

Popular Tags

Browse All Tags →

© 2025 Talentd.in - All rights reserved

Privacy PolicyTerms & Conditions
Talentd Logo
Talentd#1 Freshers Platform
Jobs
Learning
Career Tools
Talentd Logo
Talentd#1 Freshers Platform
Jobs
Learning
Career Tools
Talentd Logo
Talentd#1 Freshers Platform
Jobs
Learning
Career Tools
Talentd Logo
Talentd#1 Freshers Platform
Jobs
Learning
Career Tools
Talentd Logo
Talentd#1 Freshers Platform
DSA Corner
DashboardQuestionsTopicsCompaniesSheets
Talentd Logo
Talentd

Your trusted platform to ace any job interviews, craft the perfect resumes, and land your dream jobs.

P
Featured on
Product Hunt
▲455
All services are online

Products

  • Resume Review
  • Company Prep Pack
  • DSA Corner
  • Jobs
  • Internships
  • Fresher Jobs
  • Roadmaps
  • Tax Calculator

Resources

  • Articles
  • DRDO Internships

Support

  • Contact Us

DSA & Interview Prep

  • DSA Questions
  • DSA Sheets
  • Company Questions
  • Topics

Company

  • Companies Hiring
  • About
  • Contact
  • Advertisement

Legal

  • Privacy Policy
  • Terms & Conditions
  • Refund Policy
  • Delivery Policy

Popular Skills

Browse All Skills →

Popular Tags

Browse All Tags →

© 2025 Talentd.in - All rights reserved

Privacy PolicyTerms & Conditions
Talentd Logo
Talentd#1 Freshers Platform
Jobs
Learning
Career Tools
Talentd Logo
Talentd#1 Freshers Platform
Jobs
Learning
Career Tools
Talentd Logo
Talentd#1 Freshers Platform
Jobs
Learning
Career Tools
Talentd Logo
Talentd#1 Freshers Platform
Jobs
Learning
Career Tools
Talentd Logo
Talentd#1 Freshers Platform
DSA Corner
DashboardQuestionsTopicsCompaniesSheets
Talentd Logo
Talentd

Your trusted platform to ace any job interviews, craft the perfect resumes, and land your dream jobs.

P
Featured on
Product Hunt
▲455
All services are online

Products

  • Resume Review
  • Company Prep Pack
  • DSA Corner
  • Jobs
  • Internships
  • Fresher Jobs
  • Roadmaps
  • Tax Calculator

Resources

  • Articles
  • DRDO Internships

Support

  • Contact Us

DSA & Interview Prep

  • DSA Questions
  • DSA Sheets
  • Company Questions
  • Topics

Company

  • Companies Hiring
  • About
  • Contact
  • Advertisement

Legal

  • Privacy Policy
  • Terms & Conditions
  • Refund Policy
  • Delivery Policy

Popular Skills

Browse All Skills →

Popular Tags

Browse All Tags →

© 2025 Talentd.in - All rights reserved

Privacy PolicyTerms & Conditions
Talentd Logo
Talentd#1 Freshers Platform
Jobs
Learning
Career Tools
Talentd Logo
Talentd#1 Freshers Platform
Jobs
Learning
Career Tools
Talentd Logo
Talentd#1 Freshers Platform
Jobs
Learning
Career Tools
Talentd Logo
Talentd#1 Freshers Platform
Jobs
Learning
Career Tools
Talentd Logo
Talentd#1 Freshers Platform
DSA Corner
DashboardQuestionsTopicsCompaniesSheets
Back to Problems

709. To Lower Case

Easy83.8% Acceptance
String
Asked by:
A
Amazon
ProblemHints (3)Solutions (12)VideosCompanies (1)Notes

Problem Statement

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: "here"

Example 3:

Input: s = "LOVELY"
Output: "lovely"

Constraints:

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

Your trusted platform to ace any job interviews, craft the perfect resumes, and land your dream jobs.

P
Featured on
Product Hunt
▲455
All services are online

Products

  • Resume Review
  • Company Prep Pack
  • DSA Corner
  • Jobs
  • Internships
  • Fresher Jobs
  • Roadmaps
  • Tax Calculator

Resources

  • Articles
  • DRDO Internships

Support

  • Contact Us

DSA & Interview Prep

  • DSA Questions
  • DSA Sheets
  • Company Questions
  • Topics

Company

  • Companies Hiring
  • About
  • Contact
  • Advertisement

Legal

  • Privacy Policy
  • Terms & Conditions
  • Refund Policy
  • Delivery Policy

Popular Skills

Browse All Skills →

Popular Tags

Browse All Tags →

© 2025 Talentd.in - All rights reserved

Privacy PolicyTerms & Conditions

Approach

The goal of #709 To Lower Case is to convert all uppercase letters in a string to their lowercase equivalents. Since the input is a simple string, the most straightforward idea is to traverse the string character by character and transform only the characters that fall within the uppercase alphabet range.

One common approach is to check if a character lies between 'A' and 'Z'. If it does, it can be converted to lowercase by applying the known ASCII offset between uppercase and lowercase letters. Another practical option is to use built-in string utilities available in most programming languages, which internally perform the same conversion efficiently.

The key insight is that every character is processed exactly once, making the approach highly efficient. This results in a linear scan of the string with minimal additional memory usage, making it suitable even for longer inputs.

Complexity

ApproachTime ComplexitySpace Complexity
Character-by-character traversal with ASCII conversionO(n)O(1)
Using built-in lowercase string functionO(n)O(1)

Video Solution Available

Nick White

View all video solutions

Problem Hints

Use these hints if you're stuck. Try solving on your own first.

1
Hint 1

Most languages support lowercase conversion for a string data type. However, that is certainly not the purpose of the problem. Think about how the implementation of the lowercase function call can be done easily.

2
Hint 2

<b>Think ASCII!</b>

3
Hint 3

Think about the different capital letters and their ASCII codes and how that relates to their lowercase counterparts. Does there seem to be any pattern there? Any mathematical relationship that we can use?

Ready to see the solutions?View Solutions

Solutions (12)

Use Built-In String Function

This approach utilizes the built-in function available in standard libraries of most programming languages to convert strings to lowercase. Such functions are usually optimized and provide a direct solution to the problem by iterating over each character in the string and converting it to its lowercase equivalent if it's uppercase.

Time Complexity: O(n), where n is the length of the string, as we iterate through the string once.
Space Complexity: O(1), as the conversion is done in-place without any additional space.

CC++JavaPythonC#JavaScript
1#include <stdio.h>
2#include <string.h>
3#include <ctype.h>
4
5char* toLowerCase(char* s) {

Explanation

In this C example, the tolower() function from ctype.h is used. It converts each character of the string to lowercase in-place if it is an uppercase letter.

Manual ASCII Conversion

This approach manually converts each character by examining its ASCII value. If a character is uppercase (between 65, 'A', and 90, 'Z'), we add 32 to convert it to its lowercase counterpart (between 97, 'a', and 122, 'z'). This method ensures you understand converting characters without relying on the language built-in functions.

Time Complexity: O(n), due to iterating through each character.
Space Complexity: O(1), since the conversion happens in-place.

CC++JavaPythonC#JavaScript
1#

Video Solutions

Watch expert explanations and walkthroughs

LeetCode To Lower Case Solution Explained - Java

Nick White
3:1821,922 views

Asked By Companies

1 companies
A
Amazon

Prepare for Interviews

Practice problems asked by these companies to ace your technical interviews.

Explore More Problems

Notes

Personal Notes

Jot down your thoughts, approach, and key learnings

0 characters

Similar Problems

Longest Substring Without Repeating CharactersMedium
Longest Palindromic SubstringMedium
Zigzag ConversionMedium
String to Integer (atoi)Medium
More similar problems

Related Topics

String

Problem Stats

Acceptance Rate83.8%
DifficultyEasy
Companies1

Practice on LeetCode

Solve with full IDE support and test cases

Solve Now

Frequently Asked Questions

Is To Lower Case asked in FAANG interviews?

Problems like To Lower Case are typically used as warm-up or screening questions in technical interviews. They test familiarity with string manipulation, ASCII values, and basic iteration logic.

Why does ASCII help in solving To Lower Case?

In ASCII, uppercase and lowercase letters have a fixed numeric difference. By checking if a character falls between 'A' and 'Z' and applying the offset, it can be converted to the corresponding lowercase character efficiently.

What data structure is best for To Lower Case?

A simple string or character array is sufficient for this problem. Since the task only requires sequential traversal and modification of characters, no complex data structures like hash maps or stacks are needed.

What is the optimal approach for To Lower Case?

The optimal approach is to iterate through the string and convert uppercase letters to lowercase during traversal. This can be done either with ASCII arithmetic or by using built-in string functions. Both approaches run in linear time because each character is processed once.

6
for
(
int
i
=
0
;
s
[
i
]
!=
'\0'
;
i
++
)
{
7
s
[
i
]
=
tolower
(
s
[
i
]
)
;
8
}
9
return
s
;
10
}
11
12
int
main
(
)
{
13
char
s
[
]
=
"Hello"
;
14
printf
(
"%s\n"
,
toLowerCase
(
s
)
)
;
15
return
0
;
16
}
include
<stdio.h>
2
#
include
<string.h>
3
4
char
*
toLowerCase
(
char
*
s
)
{
5
for
(
int
i
=
0
;
s
[
i
]
!=
'\0'
;
i
++
)
{
6
if
(
s
[
i
]
>=
'A'
&&
s
[
i
]
<=
'Z'
)
{
7
s
[
i
]
+=
32
;
8
}
9
}
10
return
s
;
11
}
12
13
int
main
(
)
{
14
char
s
[
]
=
"Hello"
;
15
printf
(
"%s\n"
,
toLowerCase
(
s
)
)
;
16
return
0
;
17
}

Explanation

This solution iterates over the string and checks each character. If it's an uppercase letter, it adds 32 (difference in ASCII values between uppercase and lowercase letters) to convert it to lowercase.