Beta
Chalkboard math mistake (simple version)
11davilla
Loading description...
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
This solution failed at a random test with
If precise calculations are required, there should be corresponding fixed tests.
Interesting. The kata was originally written with precise calculations in mind, but I wonder if it would make more sense to just avoid testing cases like this.
A fixed test with implicit multiplication of two parenthesized expressions should be added. Some of the published solutions don't handle this case correctly.
Fixed by altering one of the examples.
@Unnamed, could you contribute to this discussion, please? https://www.codewars.com/kata/5e95a43ee32f8a00183a95ab/discuss/python#603a1ed61cdbb900128bf588
Excuse me for off-topic, please :D
So, I'm sure you're supposed to come up with something super clever, but so far I'm bruteforcing it with a O(N) solution (strictly speaking O(9*N) in worst case). Surely this can't be intended? I'm solving the very large tests with this. Also, my dumb little bruteforce method came up with something interesting:
I think according to your rules, this is not a valid solution (although mathematically correct:
0 = 0
). In any case, I got an errorUnable to parse result
. Your parser doesn't like integer division? Is this intended?Interesting, yes. No, it doesn't like. That's not a basic operation. I've never seen it on a blackboard, is another way to say it.
As to brute force, I'm OK with one kata to do that, but see below investigating other ideas.
Ok. I've modified solution to avoid // and **. I pass all tests, but when attempting to submit, it tells me
There was an issue submitting your final solution
. This is the first time I've encountered this error on CW, any hints what's going on?EDIT: Now the submit button is gone entirely and I'm stuck in an "attempt" loop.
EDIT 2: Did some research, apparently you can't submit to a kata in draft status? But others did? I'm confused.
I must have unpublished it while you were still working on it. I've published again if that helps, but I'll have to revise some of the descrpition.
I didn't call these out explicitly, but in the description I've touched on other operations.
Thanks. That fixed it. Now give me back the hour I spent googling this issue! :) I rated this at 5 kyu simply because it's brute forcable. I'm sure if there were some safeguards in place to make bruteforce unviable that would raise this problem to at least a 3 kyu. I can't think of any unfortunately.
By the way, feel free to mark this issue as
resolved
, as CW for some reason won't allow me to do it myself. Edit: Ok, that was because you marked it as resolved while I was still typing my comment. You have a terrible tendency to interrupt me during my work :) Like a real life race condition.Derp, sorry. I think I make too many edits. Commented below that I'm OK with brute force on this one. But that wasn't the goal, so when I iterate on the idea, that will be the first priority.
Sure, but keep in mind that anyone who solves this can see your solution that would potentially solve your more complex kata.
But I can substitute a different solution, no? If anyone is bold enough to do so, I think it would be for the better.
Yes, and half of kata in beta becomes draft (or retired) while I'm solving it. :(
For example: Glider velocity:
To be fair I think that was one of the mods who reverted it back to draft, not davilla (could be wrong though)
It does not seem so, there's no related entry in mod audit logs.
It was Blind4Basics. Based on what he said anyway its quite possible i misunderstood the context.
That was in the discourse of the kata
yup.
hi
The last sample test is broken (commented):
Thanks. Was it not obvious? This was intentional.
I'm not sure it is a good idea. In particular, documentation reads:
https://github.com/codewars/codewars.com/wiki/Kata-Best-Practices
It might be important to know how you can get information on a problem your code can't solve. That's the relevance.
I've added a comment at the top of the sample test.
I don't understand. I got hung up on this too, wondering why that last test failed. Removing the comment, replacing
None
withresult
, it passes. What exactly was I supposed to discover here? What comment at the top of the test did you add that makes whatever-it-is obvious?OK thanks for the response. I wasn't trying to cause confusion. Will standardize.
Submitted a solution. I assume that is not the intended method of solving. Feel free to break it, and i'll have a go at solving it for real.
Lol, I solved it in almost the same way as you did.
Wow no, I was trying to make it computationally complex, clearly not enough. And I thought the fractions would kill that approach, apparently not. But I'd be happy to leave this one be if you have a suggestion for a way to accomplish as much, for a new kata. Maybe just lift the restrictions on digits, and allow any integer to substitute for another?
This comment has been hidden.
I'm not keen on artificial restrictions. I was actually thinking of making a version that was solvable in that way. Little did I know...
You may simply add floats as terms to your task.
OK at some point I'll revisit this in a new kata. I've resolved to keep this one as is.
Got this in the random tests, is this my error?
What? No, let me see.
That was debug code I didn't completely remove. Fixed.