Map Numbers
EasyP3Coding
Map the keys 1, 2, ..., n to consecutive values starting at m: key 1 maps to m, key 2 to m + 1, and so on. Return the n pairs as strings of the form "<key>-<value>", in increasing key order. For n = 0 return an empty array.
Example 1
- Input
- n = 3, m = 10
- Output
- ["1-10","2-11","3-12"]
Example 2
- Input
- n = 1, m = 5
- Output
- ["1-5"]
Example 3
- Input
- n = 0, m = 7
- Output
- []
Constraints
- 0 <= n <= 1000
- -1000 <= m <= 1000
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.