Crack the Code

Published by persolut in

This is a reverse-coding challenge. Create a function that outputs the correct array from the input. Use the following examples to crack the code.

Examples

Decode("hello") ➞ int[] { 5, 2, 9, 9, 3 }

Decode("wonderful") ➞ int[] { 11, 3, 2, 1, 2, 6, 3, 9, 9 }

Decode("something challenging") ➞ int[] { 7, 3, 10, 2, 8, 5, 6, 2, 4, 5, 18, 5, 16, 9, 9, 2, 2, 4, 6, 2, 4 }

Notes

Check Comments if you're stuck.

Watch a quick demo on how Edabit works.