Not going to lie, the greatest thing about being Experienced is being able to say no to Leetcode questions.

It's a lot easier than that. The second half of the number would just have to be made the same as the first half in reversed order.

For example if it's 954309, 309 changes to 459 giving 954459.
The only exceptions that you will have to deal with explicitly are when the number is already a palindrome, which cause you'd have to decrement the number next to the midpoint by one. So for 223322, you would decrement the 3 in the first half by 1, giving 222322. The above procedure will then give 222222. In case there's an odd number of digits, the midnumber would be decremented by one.

It's actually pretty easy as far as these sorts of bullshit questions go.

/r/cscareerquestions Thread Parent