Map Characters and Compare
EasyP3Coding
Map a to 1, b to 2, and so on up to z to 26. Compute the sum of the values of all letters of the lowercase string s, and return true if that sum is strictly greater than k, otherwise false.
Example 1
- Input
- s = "abc", k = 5
- Output
- true
Example 2
- Input
- s = "abc", k = 6
- Output
- false
Example 3
- Input
- s = "abc", k = 7
- Output
- false
Constraints
- 0 <= s.length <= 10^5
- 0 <= k <= 10^7
- s consists of lowercase letters.
Hints
Give it a real attempt first. Run shows which examples fail.
Saved automatically
Run checks the 3 visible tests, Submit all 12. ⌘Enter runs, ⌘⇧Enter submits.