Compute Difference Between Uppercase and Lowercase Letters
Learn this problemProblem statement
Note ->> See the Image Source section at the very bottom of the page for the original problem statement and etc.. 🐰🐰
100 years agoo0, a typing practice app wanted to test how well users balanced uppercase and lowercase letters in their entries. For every string a user typed, the app needed to count the number of uppercase and lowercase letters and calculate the difference between them—positive if uppercase dominated, negative if lowercase took the lead. It didn’t mind if the solution wasn’t the most efficient, as long as it could handle the text without breaking a sweat, even if it meant checking some letters more than once. With your help, the app could ensure everything stayed consistent and fun!
𓍢ִ໋🌷͙֒ ᩚMany thanks to Charlotte babyᰔ
Function
computeDiff(text: String) → intExamples
Example 1
text = "CodeSignal"return = -6Example 2
text = "a"return = -1Constraints
- 0 ≤ typedText.length ≤ 100.
More Meta problems
- Count Fully Used BatteriesOA · Seen Jul 2026
- Count Key ChangesOA · Seen Jul 2026
- Minimum Operations for a Stepwise SequenceOA · Seen Jul 2026
- Most Frequent Reduced DigitOA · Seen Jul 2026
- Plan a Minimum-Cost Round TripONSITE INTERVIEW · Seen Jul 2026
- Merge Three Sorted ArraysPHONE SCREEN · Seen May 2026
- Highest Rating Price RatioOA · Seen Mar 2026
- Diagonal Traverse (for E4 ;)PHONE SCREEN · Seen Mar 2025