7 kyu
Say Me Please Operations
257 of 1,400hubencu_st
Description:
You have a string of numbers; starting with the third number each number is the result of an operation performed using the previous two numbers.
Complete the function which returns a string of the operations in order and separated by a comma and a space, e.g. "subtraction, subtraction, addition"
The available operations are (in this order of preference):
1) addition
2) subtraction
3) multiplication
4) division
Notes:
- All input data is valid
- The number of numbers in the input string >= 3
- For a case like
"2 2 4"
- when multiple variants are possible - choose the first possible operation from the list (in this case"addition"
) - Integer division should be used
Example
"9 4 5 20 25" --> "subtraction, multiplication, addition"
Because:
9 - 4 = 5 --> subtraction
4 * 5 = 20 --> multiplication
5 + 20 = 25 --> addition
Algorithms
Logic
Strings
Lists
Similar Kata:
Stats:
Created | Jul 29, 2018 |
Published | Jul 29, 2018 |
Warriors Trained | 3128 |
Total Skips | 68 |
Total Code Submissions | 8471 |
Total Times Completed | 1400 |
C# Completions | 257 |
Python Completions | 633 |
JavaScript Completions | 493 |
Ruby Completions | 57 |
Total Stars | 42 |
% of votes with a positive feedback rating | 90% of 275 |
Total "Very Satisfied" Votes | 229 |
Total "Somewhat Satisfied" Votes | 37 |
Total "Not Satisfied" Votes | 9 |
Total Rank Assessments | 24 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 8 kyu |