+ 5
Can someone check this code?
Hi, I'm trying to solve the problem "Palindrome Numbers" at the end of Module 4 in the C++ course, it took me all the evening, and still not realize why of the 6 test cases, test case 3 (that is hidden, I suppose for a premium account) doesn't get the expected output, you can verify this. I don't catch what I'm missing. Probably there is somewhere a more efficient way to do it, I just tried to use exclusively what I have learned in previous lessons. I would like to know, also, if there is a way to define the array 'rems' without specifying the size, (that would eliminate the limitation of significant figures of the number user can enter), Thanks a lot. (I have published the code as 'Palindrome Numbers' so you can review it)
4 Réponses
+ 4
As for the program in the code you mentioned, you are not reversing the number perfectly.
To counter which you are providing extra conditions while checking for palindrome. Instead of fixing the reversal.
Here is the fix 👇
https://code.sololearn.com/c89UmxlEb23X/?ref=app
+ 5
Here's a tip :-
You can share the link to the program directly to your question description to increase the odd of getting it answers 👇
https://www.sololearn.com/post/75089/?ref=app
+ 4
Test case 3 is solved, just missed an equal sign!... I'm still wondering about the size of the 'rems' array.
+ 4
_Csks_
As a side note :-
There are also some other simpler ways to reverse digits of a number
1) treating number as string of numerical characters
2) instead of storing the remainders in an array, add them to the reverse number then and there, like this👇
https://code.sololearn.com/cF43moCzXZC2/?ref=app