We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
When I was debugging, I downloaded several test cases, but they were like thousands of characters long, inpossible to debug. I found some good short examples in the forum, and those helped with the debugging, but didn't got me far with the submissions.
After I reimplemented, I got it right right away. I didn't even have any "special cases". Later on I checked the editorial for official answer, the explanation was falwed, but the code was pretty similar to mine.
Two hints:
- don't forget the character in the midle if length is odd
- handle changes to 9s differently if a change is required at that position, or if it's an extra change of both character and mirror character
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Highest Value Palindrome
You are viewing a single comment's thread. Return to all comments →
When I was debugging, I downloaded several test cases, but they were like thousands of characters long, inpossible to debug. I found some good short examples in the forum, and those helped with the debugging, but didn't got me far with the submissions.
After I reimplemented, I got it right right away. I didn't even have any "special cases". Later on I checked the editorial for official answer, the explanation was falwed, but the code was pretty similar to mine.
Two hints: - don't forget the character in the midle if length is odd - handle changes to 9s differently if a change is required at that position, or if it's an extra change of both character and mirror character