Map Characters
EasyP3Coding
Map the first num lower-case letters to 1, 2, 3, ...: a maps to 1, b to 2, and so on. Return the num pairs as strings of the form "<letter>-<value>", in alphabetical order. For num = 0 return an empty array.
Example 1
- Input
- num = 3
- Output
- ["a-1","b-2","c-3"]
Example 2
- Input
- num = 1
- Output
- ["a-1"]
Example 3
- Input
- num = 0
- Output
- []
Constraints
- 0 <= num <= 26
Hints
Give it a real attempt first. Run shows which examples fail.
Saved automatically
Run checks the 3 visible tests, Submit all 10. ⌘Enter runs, ⌘⇧Enter submits.