Leetcode Problem 2129. Capitalize the Title
2129. Capitalize the Title
AI Mock Interview
Leetcode Solutions
Iterative Word Processing
Solution Idea
Algorithm Steps
Code Implementation
Complexity Analysis
Split the input string
title
into a list of words.
Iterate over each word in the list.
Check the length of the current word.
If the length is 1 or 2, convert the word to lowercase.
If the length is greater than 2, convert the first letter to uppercase and the rest to lowercase.
Join the processed words with a space to form the final string.
Return the capitalized title.
Character-by-Character Processing
Ask Question
Programming Language
Purpose:
General Question
Debug My Code
image/screenshot of info
(optional)
[+]
Full Screen
Loading...
Get Answer
Suggested Answer
Answer
Full Screen
Copy Answer Code
Loading...