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.
Thanks for the recommendation Jomopipi! The naive solution is pretty good. I'll need to take another look to make sure I get good takeaways from some of what you implemented there. It's a lot more concise than I thought the approach would be.
I ran away from your approach because I hit a timeout with an even more naive solution and I wasn't quite sure how large the test inputs were. Do you know if there is a way to tell what the input was when the outcome of a test is a timeout?
Fair point, Kayleigh - I don't think you need a maths background. My frustration was borne from having went at the problem very inefficiently at first and not being sure how efficient I had to be, hence resorting to mathematical simplification and being miffed for feeling like I had to do so. If you have any recommendations for kata or resources on DSA, I'd definitely take a look!
I think my solution is pretty naive if you want to check it out.
Should we mention that the base must be postive? 7 in base -3 is 111.
(-3)**2 + (-3)**1 + (-3)**0 = 9 + -3 + 1 = 7This comment is hidden because it contains spoiler information about the solution
OCaml translation
Uses regular OCaml
intbecause by the time I realised that the Python test gen was messed up I had essentially finished writing the entire thing.I can switch to mpz bigints if we really want this to be hard.
Python tests produce inputs much larger than
Number.MAX_SAFE_INTEGER.Ordinarily I wouldn't raise this but it's very clearly intended that they don't do this when you conisder that
Number.MAX_SAFE_INTEGERis inlined as a constant in said tests.You don't need a maths background for this if you happen to be a bit observant and are familiar with dsa.
If the inputs were a couple orders of magnitude larger then you would need one.
Lua translation
Having completed this kata, I'll just say that it's important to have very good math skills. Yes, many coding problems involve math, but since the test numbers are so large, it's necessary to know how to use mathematical shortcuts to solve this.
Feel free to look at my answer if you want a full breakdown. This was the first 4 kyu I have tried and I have a feeling things are only going to get more logically intense from here on out.
My fix has landed so this should no longer happen.
how js assert?
I've put up a translation that replaces the reference implentation with one that works, please review!
Thanks for posting this! Indeed, retrying a few times got me past the hurdle.
I'll have to look into why this happens, it looks like a bug in the reference solution.
Still not resolved. In the rust test cases, I got
17700847248605297701 (should be 84)
17393337673075145131 (should be 254).
Had to special case those to submit, but the test cases should be fixed.
not a kata issue
Loading more items...