Neat, didn't know you could do that - read the docs!
Hey John, funny I came on here as I noticed some of the solutions didn't account for when the triple and the double are different, and I see you already caught it. Nice solution by the way.
Test cases (that aren't the sample ones) are only editable in Ruby right now (the others are locked). But nice catch.
I am noticing this same problem with python kata. I am passing the 4 examples and all basic tests:
And, passing about 4 - 8 random tests. However other random tests between ranges of about 500 - 1000, I am failing. There are no timeout issues, my algorithm simply returns the wrong number of primes. Strange how I'm passing some tests yet failing others despite their ranges being within the same numbers?
500 - 1000
UPDATE: I ended up passing this one, without changing my code, similar to the above user, Cptnprice.
I suggest adding a test that has different repeated numbers for both input cases.
num1 = 9875222143465
num2 = 24236884
I don't believe these cases exists because I built code to return True (i.e. 1) for these cases, and didn't realize it was wrong until my code passed all tests, I submitted it, and saw the other solutions didn't account for such cases.
Inspiration for this kata: https://twitter.com/officialjaden/status/329768040235413504
I added a more clear description and 1 example test... Also added go translation. Can you approve the updates?
I updated description to be more clear on what exactly the return type and string should be since many people have noticed the description with "hello world!" to be confusing. I also added a go lang translation. (Suggestion tag means suggested edits)
I wasn't sure why index.html was chopped out from the breadcrumb, yet holidays.html included until I read the instructions more carefully ->
"if the name of the last element is index.something, you treat it as if it wasn't there, sending users automatically to the upper level folder."
This function is designed to return a type double. With this information, it can be assumed that all error checks would have been handled before the function call. If the return was a type pointer, i.e. double * then, it would be able to handle the types of errors that you are referring to. In the case of a return type double *, the return would be pointer to NULL, to indicate errors. However, since the return is type double, there is no value for a double that could indicate an error that could not also be a valid solution. For example, if the function returns 0 or 0.0 (the only possible error solutions), these could also all be valid solutions, and there would be no way to differentiate between an error or valid solution.
So, to handle the errors you suggest the function would have to be modified to have return type pointer (double *) or the errors would be handled before the function call.
I think there are two problems here. First of all, the operators (add, subtract, multiply, divide) must correspond to execute the right operation. Yet only the first letter is evaluated.
This function would return a sum still if I passed in "append" as operator. Furthermore, there is no default return value. Should the operator argument not correspond with any of the given ones,
this function wouldn't return anything at all.
Awesome solution, I feel like I just took CS 300 Python course trying to learn this code. Incredibly fast runtime too!
I think the author prefers people to find out how to handle duplicates by reading the discourse section, since the vague note in the instructions, "(with <)" has been unchanged despite all the suggestions to clarify it.
Hi Thanks for the tips! I did notice that the output for the test case in which my algo had the too slow runtime was printed in the error message, so I did use that test case to modify my algo. In case anyone else has my same error, I had to notice the # of unknown squares, '?', surrounded by only unknown squares, '?'.
The testing suite was great and very helpful, great kata, I finally solved it!