4 kyu
Palindrome Counter
26 of 74M1Miketro
Loading description...
Number Theory
Mathematics
Performance
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.
Searching in-depth to find the optimal algorithm to pass and solve katas like this one is funny and rewarding.
Not easy but incredible fun - I couldn't asleep a couple of nights :D Thanks for the great kata! PS: BTW, is it possible to remove the fisrt debug version of my solution, that didn't pass all the tests and has been unecspectadly published by clicking on the button, that was changed from 'attempt' to 'submit' at that moment?
nope, sorry... ;)
Thank you for completing my kata! I especially loved the process of creating this one.
Unfortunately I can't remove solutions, but I'm glad you submitted a final solution after debugging.
Haha, it's OK! It finally dawned on me what it was all about and I’ve already optimized even my final solution, but I won’t republish it - I’d rather celebrate it with a couple of glasses of cognac - no one can drink away the talent for being a little stupid! Cheers!
It seems, my half-baked solution slipped through tests due to the fact that at that moment random tests was formed without any upper palindromic boundary values.
You can provide tests in which at least one of the boundariesis guaranteed to be a palindrome itself: (111, 2222), (123, 3333), (111, 2345) and nothing will accidentally slip through. )
Thanks for pointing that out!
This comment has been hidden.
i am unable to pass the medium tests in python any ideas on how to optimize code
I'm right there with you buddy. I've got everything in a massive one-liner using comprehensions. This probably means that it isn't a matter of optimizing, and more likely a clever use of binary, or arithmetic, or some other function contained in a library like
math
. I'm going to see what I can find, but I'm mostly commenting to see any updates you get haha.whose algorithm is this? Can't find any information
It's mine.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
I managed to solve this in Python, it passes the tests, but when I hit submit it fails on the Random tests at the end, with STDERR "Execution timed out" - i'm getting 12000 ms.
Any idea what might be going wrong? Thank you!
There is another solution. I am trying to work on it now. There is a way to work out how many palindromes there are using a function that I have come up with but I am really struggling to get it to function for a range. 1-1000... works perfectly but I can't work out how to allow for those bounds.
Is there still a performance issu with the JavaScript ?
it's a nice kata, but despite passing all tests I can't get my runtime low enough to pass on the super large tests. Frustrating after investing an hour coming up with a clean solution that works as intended sigh
Congratulations!
I can't see how anyone could pass it in less than 800ms...
There is a function that can be written to work out the palindromes between 1-100000..... I won't spoil that but I am really struggling to calculate the range calculations.
This specification is completely useless and could only serve a purpose of annoying users:
Changed!
JavaScript: Node 18 must be supported. See the docs. It is sufficient to add:
and to replace
Test.assertEquals
withassert.strictEqual
.Fixed.
This comment has been hidden.
How to find the reference function from scratch?
This comment has been hidden.
This comment has been hidden.
It's fixed now.
Related: https://www.codewars.com/kata/59f98052120be4abfa000304
The python version has been fixed, JS version will be fixed today.
Is it ?