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.
Yes, now it works for me too.
Tickets, please!
Can you solve the best route to travel, when you have some half-price coupons in your pocket?Why does the test say for example for n = 2903225426
Expected: 0, instead got: 60453792
When clearly 60453792 should be the correct solution, even Wolfram Alpha confirms this.
PS. And it's the JS version I'm trying, (if there are others :D)
This comment is hidden because it contains spoiler information about the solution
I mean the case when we make a bond but it is invalid and will throw an Error. I was still making X bond to Y but then the execution would fail and throw an error (because I was testing the valence-ok:ness separately, not testing both first and only then making the bonds if ok, as it should be done). I guess the fixed tests doesn't include a test for this situation, at least I passed them with my then faulty Atom.connectTo -method.
This comment is hidden because it contains spoiler information about the solution
Very good kata! A lot of work, but so rewarding when you get it right. This also thought me about JS classes (I've come accross them but never looked at them more deeply, I just always used functions and prototypes. But these getters and setters are awesome, although it might feel strange at first when you access the variable just like it were a normal paramater, btw is this how for example the canvas drawing context works: when you try to set for example context.fillStyle = "something", it is set to black?) Well I digress.
One possible suggestion I would make is to test the following: If we make a bond between two elements X and Y, and it is invalid, we set neither X to have Y as bondee nor Y X. I had this bug, where I would let the first happen even if the second would fail. Was only caught in the random tests and it was kind of a hassle to hunt down. Of course is seems obvious now :D.
Dang I struggled with the final test since I didn't use enough ()'s around %t's.
Yippee, my second 1kyu solved! Very nice kata all in all!
C++.
Nice Kata. Just a minor detail: In the description it says that a and b are even but the random tests also give odd numbers.