728. Is Uppercase String (Recursive Check)

EasyRecursionRecursion

Given a string s, determine whether it qualifies as an 'all-uppercase string'. A string qualifies if and only if it contains at least one alphabetic character AND every alphabetic character in it is uppercase (A-Z). Non-alphabetic characters (digits, spaces, punctuation) are ignored for the check but cannot by themselves make a string qualify. Return true or false. Implement the check recursively.

Input: A string s enclosed in double quotes.

Output: Return a boolean: true or false (lowercase).

Examples

Example 1
Input: "HELLO"
Output: true
Explanation: All alphabetic characters are uppercase and at least one exists.
Example 2
Input: "HELLO123"
Output: true
Explanation: Digits are ignored; all letters are uppercase.
Example 3
Input: "Hello"
Output: false
Explanation: 'e', 'l', 'l', 'o' are lowercase.

Constraints

Asked by

TCSInfosysWiproCognizantCapgemini
Solve this problem in the editor →