#3646

Next Special Palindrome Number

international master · 2040 · lc hard +32 · 27.9% accepted · 61 likes · top 6%

Description

Given an integer n, a number is special if it is a palindrome and every digit k that appears in it occurs exactly k times. Return the smallest special number that is strictly greater than n.

Code

1
2
3