## student student Interview Question for Students Students

• 1
of 1 vote

Comment hidden because of low score. Click to expand.
1
of 1 vote

if 3rd digit is greater than 4th digit, then largest palindrome smaller than X would be "1st digit, 2nd digit, 3rd digit -1, 3rd digit -1, 2nd digit, 1st digit" and smallest palindrom larger than X would be "1st digit, 2nd digit, 3rd digit, 3rd digit, 2nd digit, 1st digit".
And if 3rd digit is smaller or equal to 4th digit, then in above solution... smallest one will become largest one and vice versa.

Comment hidden because of low score. Click to expand.
1
of 1 vote

just decrease the X value and check it every number is palindrome or not, then will get largest palindrome smaller than X.
same way increase the X value and check it, then you will get smaller palindrome value greater than X.

Comment hidden because of low score. Click to expand.
0
of 0 vote

given X = 888888, your algorithm would indicate 888888 as "the smallest palindrome larger than X", but clearly 888888is not larger than 888888.

Comment hidden because of low score. Click to expand.
0

if both are equal increment the 3rd digit by 1 :)

Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

### Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

### Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.