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.
This took me 3 days. I had to get a better understanding of O(n) and prime calculations. I was on the right path on my first attempt by reducing the number of calculations in half, but I found out you can reduce the number of calculations exponentially, and that got me a working solution.
FYI - I have modified the description:
So why list rules at all?
And I think you can figure out what the expecteds that I listed are showing. You're a smart guy.
The real problem is: what makes you think that these rules are not applied? Because you didn't see them in the example tests?? These represent at most 2% of the full batch of tests. Don't worry, DM is thurough with his tests.
Moreover, your point is not understandable because you give only the expected part. But the expected result of what?
Well, I tried. Guess you got it all figured out.
Also, holy verbosity!!
You have imagined problems that just don't exist:
Cages are cages. Why would you imagine foxes can break out of a cage they cannot not break into?
This Kata only has foxes and chickens! What else do you imagine the chickens are in danger from?
Seesm these two following rules were just left out:
Examples:
Seems odd you would just leave these very pertinent rules out.
Agreed. Mostly gibberish.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Yep, that worked. Thank you.
There should be a test that checks whether the last character is a newline, in order to prevent presentational issues. For example
test.assertEquals("1\n1*2\n", "1\n1*2")
will fail, but it won't show any meaningful result:A simple check that
var ans = pattern(n); ans[ans.length - 1]
isn't\n
would help. Alternatively, add something in the description. (Note: the pending Haskell translation modifies the description slightly to include that hint)You probably have a trailing newline.
You have a trailing newline. Look at the last character in your string, and at the last character in the expected values in the example tests.
How do you explain this?
Expected: 1
12
1**3, instead got: 1
12
13
Expected: 1
1*2
13
14
15
16
17, instead got: 1
12
13
14
15
16
17
Expected: 1
12
13
14
15
16
17
18
19
110
111
112
113
114
115
116
117
118
119
120, instead got: 1
12
13
14
15
16
17
18
19
110
111
112
113
114
115
116
117
118
119
1*********20