17. Next Smallest Palindrome
My Approach
Explanation with Example
- Make the first half of out a palindrome: [1, 2, 3, 2, 1]
- Compare with num: [1, 2, 3, 2, 1] < [1, 2, 3, 4, 5]
- Increment middle values: [1, 2, 4, 2, 1]
- Result: [1, 2, 4, 2, 1]Time and Auxiliary Space Complexity
Code (C++)
Contribution and Support
Last updated