LEEGALITY Hiring | Detect Capital Problem | Off-Campus OA (2023)

Question · Posted Jun 2026

Problem Statement Given a string word, return true if the capitalization is correct. A word is considered correctly capitalized if: All letters are uppercase. All letters are lowercase. Only the first letter is uppercase and the remaining letters are lowercase. Example Input word = "USA" Output true Explanation "USA" contains all uppercase letters, so the capitalization is valid. Constraints 1 <= word.length <= 100 word consists of English letters.

The full answer & interview discussion are available to premium members.

Log in Create a free account