You'll be given a string with numbers as input. The first two numbers are the operands, while the last three are the result of the operation.
Available operations include:
- addition
- subtraction
- multiplication
- division
Example
For string: 9 4 5 20 25
Your function must return: subtraction, multiplication, addition
Because:
9 - 4 = 5 subtraction
4 * 5 = 20 multiplication
5 + 20 = 25 addition
Tests
Good luck!
This challenge comes from hubencu_st on CodeWars. Thank you to CodeWars, who has licensed redistribution of this challenge under the 2-Clause BSD License!
Want to propose a challenge idea for a future post? Email yo+challenge@dev.to with your suggestions!
Top comments (4)
Just a quicky in JS
Here is the simple solution with Python and
while
loop:JS
What do we return for
1 1 1
and2 2 4
?