How to Assign a Digital Cypher in C
The challenge
Digital Cypher assigns to each letter of the alphabet unique number. For example:
Instead of letters in encrypted word we write the corresponding number, eg. The word scout:
Then we add to each obtained digit consecutive digits from the key. For example. In case of key equal to 1939
:
Task
Write a function that accepts str
string and key
number and returns an array of integers representing encoded str
.
Input / Output
The str
input string consists of lowercase characters only.
The key
input number is a positive integer.
Example
The solution in C
Option 1:
|
|
Option 2:
|
|
Option 3:
|
|
Test cases to validate our solution
|
|