Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
C++ Translation
Lua translation!
CoffeeScript translation
"...the idea is to substitute the examples into the formula and reduce the resulting equation to one unique term. ...Using this pattern, only one solution is possible for each test..."
But hold on! The uniqueness of solution is disapproved by the example in the description itslef:
[ "a + a = b", "b - d = c ", "a + b = d" ]
. The expected answer is '2a', however '1b' (or just 'b' - what a strange requirement for explicit 1!) is also a correct answer and it is simpler than the expected one!Need to revise the kata for either accepting all possible single-term answers (the preferred approach), or making the rules more specific.
The asked output is not mentioned and the "Should become:" is misleading.
This kata should really be sent to beta: there are a fuck ton of hidden assumptions on the input data that allows very specific, underhanded solutions:
examples = ["a + b = c"], equation = "a + b"
["a = c", "b = c"]
,["a = a"]
or["a = b", "b = a"]
)The specificality of these assumptions make this kata a completely different one from what it is trying to imply (something very generic). It's asking us to apply 5kyu cheese algorithm to a generic 2kyu problem. This is utterly unacceptable.
It is still not clarified in the kata description which variable to choose to return the result. B4B didn't actually do anything correct before resolving all the issues and approving this ;-(
(Also, no, adding
puzzle
tag is not an excuse/workaround for such dubious kata design. That's just lame.)You don't explain what POSITIONS and LENGTHS are.
I have problems understanding the instruction: "POSITIONS... and LENGTHS... are comma-separated lists."
Do I have to write a seperate class "Branch"? What do you mean with comma-seperated list?
can u explain it a bit more detailed pls?
There's no point of having 10k random tests for this kata.
I passed 10,000 random tests with this wrong solution(without using anything of
buffer
)The expectations on this one were baffling, as the description was poorly written and left out several important things that would actually be tested.
I think it should have had better sample tests, clearer descriptions of which variable needs to be returned, and actually stated things that might not necessarily be obvious, like how all coefficients will be integers, that variables could be both uppercase and lowercase letters, and that formula might have only one variable.
I solved it, but I hate it.
Ruby translation
Please review and approve.
Note: eval has been disabled in this version.
Considering the rank of the kata, I'm thinking about forbidding
eval
in python (replacing the original solution of the author with mine if needed).Opinions? (from the author ofc, but others too?)
EDIT: and java too... x/