01 · Question
Implement two small character helpers:
is_alphanumeric(c): return whethercis an English letter or digit.to_uppercase(c): convert a lowercase English letter to uppercase; otherwise returncunchanged.
02 · Analysis
ASCII letters and digits occupy contiguous ranges, so both helpers use direct range checks:
- Alphanumeric means
a-z,A-Z, or0-9. - Uppercase conversion keeps the character's offset from
'a'and applies it from'A'.
The point: reason with character ranges and relative offsets instead of memorizing numeric ASCII codes.
Complexity: both helpers run in time and use space.
03 · Solution