5 kyu
T.T.T.60: Break all the rules
26 of 55myjinxin2015
Loading description...
Puzzles
Games
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.
Hi, I think I understand the problem, but in this case:
breakRules([[1,2],[2,3]]) should return [[3,2,2,1]].
I don't understand why the result isn't [[2,2,1,3]] as well.
Result can't be
[[2,2,1,3]]
. In that case,3
comes after2
(it doesn't matter if they are adjacent or not), and so it doesn't break the second rule of[2,3]
.JS testscases are full of unused material, it needs to be cleaned.
Great kata to have some little bit of fun with.
python translation
I have put the call to the user code inside the
it
block.Right, I forgot to do that.
Haskell translation
Approved. Cheers ;-)
One thing might be clarified:
[1,2]
means1
comes before a2
at any position; there can be numbers inbetween them. I was only checking for adjacent values at first, and didn't understand why some possibilities I was generating were not breaking rules corrctly.Reword it to:
Hi;-), i think your random tests are not correct (it's a little bit "hard" to recognize anything on this loooong lists). So one examle: Rules: [[0,4],[0,3],[1,9],[6,3]] Part of your expected output: ... [3,4,0,3,6,0,9,1],[3,4,0,3,6,9,0,1],[3,4,0,3,6,9,1,0],[3,4,0,3,9,0,1,6],[3,4,0,3,9,0,6,1],... So i think (for example) the first array is wrong, because 0 is in front of 3 but second rule [0,3] means it should be not in front of 3. Haven't marked as issue, maybe i'm wrong or misunderstand?
This comment has been hidden.
It's an issue ;-)
Ok, so tell me if it's solved;-)...
Well,republished. You can starting test and find out new bugs ;-)
Thanks, your tests are ok now, so good work;-). Just checked, but my solution is too slow (only 60 tests - and i knew that it would be slow;-)), so i have to change some things... But not yet, surely tomorrow, i'm busy:-)... So good night:-)!
This comment has been hidden.
Good night ;-)
This comment has been hidden.
I've modified the test method, hide the result of correct result ;-)
Thanks;-), i will look at it, did some litte changes, 70 tests and timeout;-)...
100random test (1-4rules)+5random test(5rules)
Yes thanks, i thought it (normally about 100 tests for your katas);-)... My code is short (first idea), 3 lines and it took me not 5 minutes yesterday, so it isn't the quickest (but correct):-)). I knew this, so i have to look again:-)...
This comment has been hidden.
HaHaHa, Mr. snail ;-)
But code works now, (short;-)) solution submitted;-)! Mr. quick;-)...
submit and submit..;-)
Yes, but not (only) me, 8 trained;-)... But nice and short... or:-)?