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.
The node is an object so I don't think you can print it but you can try to put it in an array then print it so you can see the length
Hi, python user here. I'm totally lost on this, i'm not sure how i'm supposed to extract even a single value. I've read most things about linkedlists and sorts, but if i try something like node.next or something i can't even extract the value. Can someone help me how i'm supposed to even print a single value, that's all i need.
Of course, defining the mod as an external constant is good practice for readability and control :)
It would not make a difference, basic operations on constants like this are optimised away. Try copy the function into a python interpreter, run
from dis import dis
thendis(f)
. You can see that the mod is already calculuated in the bytecode.nice one, i believe this one would be the fastest, if only you had pre-calculated the mod.
No problem, and sorry for the wall of text - just thought I'd share some useful starting-out Codewars info.
Good luck with the kata - it's not a basic one, so it's normal to have to work on the complexity a bit. As a small hint, this kata is "intended" to be solved using a certain technique: it can be a good idea sometimes to read the 'tags' in the kata description box to see if you can get any clues on what the topic/technique might be ;)
Yes, thanks a lot, i've been actually doing this exercise for like a week now, have had several trials, but had to remake because of complexity. This time i was like almost convinced that there was a bug because the code is so simple, but i totally forgot about resetting the dictionary. Thanks a lot.
Hi, first of all welcome to Codewars! As you are new, please know that the Issue tag is only for serious problems with the kata - if you just want help with your solution, please use the Question tag instead.
I recommend as you get started on the site to read this Troubleshooting guide as 95% of all problems are covered there; in this case my guess is that your solution isn't working due to having a "global variable"
d = dict()
that does not change between tests.Try inserting it into your main function definition instead, and it should work.
By the way, you can join the Codewars Discord (link on sidebar on the left) if you want help solving/troubleshooting
edit: also, forgot to say, please learn to use the very simple Codewars markdown to format your code - otherwise it's very hard to get people to read your code when you post it and you're unlikely to get any replies (no-one is going to read through 100 lines of badly formatted text)
This comment is hidden because it contains spoiler information about the solution