Shortest code: Give me the equation
Description:
This is the challenge version of coding 3min series. If you feel difficult, please complete the simple version
Task:
Give you three numbers:a b c
,please return an equation(Operators include +,-,*,/), return type is string.
For example:
sc(1,2,3)
should return "1+2=3"
or "2+1=3"
or "3-2=1"
or "3-1=2"
sc(2,2,4)
should return "2+2=4"
or "2*2=4"
or "4/2=2"
or "4-2=2"
sc(6,2,3)
should return "2*3=6"
or "3*2=6"
or "6/2=3"
or "6/3=2"
Return one of the possible answer, you can pass the test.
If there is no equation between a,b,c
, return ""
You code length limit is 120 chars.
Code length calculation
In javascript, we can't get the user's real code, we can only get the system compiled code. Code length calculation is based the compiled code.
For example:
If you typed sc=x=>x+1
after compile, it will be:sc=function(x){return x+1;}
Series:
- Bug in Apple
- Father and Son
- Jumping Dutch act
- Planting Trees
- Reading a Book
- Eat watermelon
- Special factor
- Symmetric Sort
- Are they symmetrical?
- Guess the Hat
- Find the murderer
- Give me the equation
- Balance Attraction
- Max Value
- Regular expression compression
- Remove screws I
- Remove screws II
- Collatz Array(Split or merge)
- Trypophobia
- Virus in Apple
- Waiting for a Bus
- Tidy up the room
Similar Kata:
Stats:
Created | Mar 29, 2016 |
Published | Mar 29, 2016 |
Warriors Trained | 248 |
Total Skips | 2 |
Total Code Submissions | 1296 |
Total Times Completed | 119 |
JavaScript Completions | 119 |
Total Stars | 9 |
% of votes with a positive feedback rating | 92% of 56 |
Total "Very Satisfied" Votes | 48 |
Total "Somewhat Satisfied" Votes | 7 |
Total "Not Satisfied" Votes | 1 |