← Back to challenges

Reverse Coding Challenge #5

JavaScriptHardnumbersmathlogic

Instructions

This is a reverse coding challenge. Normally you're given explicit directions with how to create a function. Here, you must generate your own function to satisfy the relationship between the inputs and outputs.

Your task is to create a function that, when fed the inputs below, produce the sample outputs shown.

Examples

832 ➞ 594

51 ➞ 36

7977 ➞ 198

1 ➞ 0

665 ➞ 99

149 ➞ 0

Notes

If you get stuck, see Comments for a hint.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.