Summer Sale is Live! Unlock 40% OFF on All Job-Oriented Training Programs – Limited Time Only! Offer Ending in
D
H
M
S
Get Now
Problem Submissions Solution

Next Smallest Palindrome

Difficulty: Hard

Acceptance: %

Points: 40.00

Given a number, in the form of an array Num[] of size N containing digits from 1 to 9(inclusive). The task is to find the next smallest palindrome strictly larger than the given number.

Topics

Companies

Articles

Examples:

Expected Time Complexity: O(N)

Expected Auxiliary Space: O(1)

Constraints:
  • 1 <= N <= 10^5
  • 1 <= Num[i] <= 9
Companies:
Amazon Microsoft Adobe Flipkart
Topics:
Array
Locked Content
Access Restricted: Please Login to access the code editor and test cases.