Skip to content

Commit babca76

Browse files
committed
adding question details
1 parent c81680e commit babca76

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

August Challenge/com/leetcode/AugustChallenge/week1/DetectCapital.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,34 @@
11
package com.leetcode.AugustChallenge.week1;
22

3+
/*
4+
https://leetcode.com/problems/detect-capital/
5+
Given a word, you need to judge whether the usage of capitals in it is right or not.
6+
7+
We define the usage of capitals in a word to be right when one of the following cases holds:
8+
9+
All letters in this word are capitals, like "USA".
10+
All letters in this word are not capitals, like "leetcode".
11+
Only the first letter in this word is capital, like "Google".
12+
Otherwise, we define that this word doesn't use capitals in a right way.
13+
14+
15+
Example 1:
16+
17+
Input: "USA"
18+
Output: True
19+
20+
21+
Example 2:
22+
23+
Input: "FlaG"
24+
Output: False
25+
26+
27+
*/
328
public class DetectCapital {
429

30+
// Time Complexity :- O(n)
31+
// Space Complexity :- O(1)
532
public boolean detectCapitalUse(String word) {
633
int n = word.length();
734
if (n == 1)

0 commit comments

Comments
 (0)