7 kyu
Next Palindromic Number.
1,635 of 3,968raulbc777
Loading description...
Fundamentals
Data Structures
Algorithms
Mathematics
Logic
Strings
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.
python new test framework
Approved
@saudiGuy Thanks for updating it +1
Java translation Revision please:)
This comment has been hidden.
Please see this link to properly format your code in the discourse. Anyway, you're logging too much to the console, that's the reason for the error. If you get rid of your
console.log
statements, it should work.yes, I didn't realize it. Sorry about that, and thank you.
Updated JS to Node 14
Approved +1 Thanks for this update.
C Translation
Approved +1
Please review: C++ Translation
Approved! +1
Description should be language-agnostic
Spelling error in
We suposse that you know which kind of numbers they are
should besuppose
Python new test framework should be used (Refer this & this for more detail)
Undeclared variable in initial solution setup should be replaced with
return 0
fixed by fork above
JS: Node v12 should be used along with the appropriate assertion tools (Mocha + Chai)
Also, Undeclared variable in initial solution setup should be replaced with
return 0
Anything that increments the number and checks if its a palindrom will be hopelessly inefficient for cases such as n = 9999999900000000 . Theres a O(1) solution that is clearly best.
O(1)
orO(log n)
?Nice, how did you figure that out?
After running the example tests for Python after passing one, I get "2 should equal 191" failure.
From what I can tell, the input should be 188. Am I doing something wrong?
You get
188
, you return2
.Apparently you have implemented next incorrectly.
Not a kata issue. Closing.
In short: Yes.
C#-Translation kumited!
https://www.codewars.com/kumite/57aec171bb994443230018d3
Please check and approve it. :-)
This comment has been hidden.
Which language please?
The language appears to be Ruby. In any case,
reverse!
is not recognized because the method is not available for numbers. Only enumerables(like strings and arrays).Correct the description please, nextPal(191) == 292 should be nextPal(191) == 202
Thanks!
Thanks for pointing it out. Fixed.
Example tests in javascript translation.
Fixed, thanks for your observation