Detect Capital LeetCode Solution - The Coding Shala
Home >> LeetCode >> Detect Capital
In this post, we will learn how to solve LeetCode's Detect Capital Problem and will implement its solution in Java.
Detect Capital Problem
Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when one of the following cases holds:
- All letters in this word are capitals, like "USA".
- All letters in this word are not capitals, like "leetcode".
- Only the first letter in this word is capital, like "Google".
Otherwise, we define that this word doesn't use capitals in the right way.
Practice this problem on LeetCode(Click Here).
Detect Capital Java Solution
Check all the conditions.
Other Posts You May Like
- LeetCode - To Lower Case
- LeetCode - Destination City
- LeetCode - Word Subsets
- LeetCode - Shifting Letters
- LeetCode - Valid Boomerang