+ 4

CHALLENGE find number palindrome

This task was a qualifier task for the programmer olympics You need to find a palindrome greater than the number entered. A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward, such as "madam" or "taco cat" or "race car". The palindrome must 1)be minimally bigger than the input number 2)input should to support the 10^6 digits and less example: input: output: 123456 -> 124421 1234567 -> 1235321 999 -> 1001 my solution on java https://code.sololearn.com/ch5iVEdPYRDx/#java

22nd Jan 2018, 4:50 PM
rusich
rusich - avatar
19 ответов
21st Jan 2018, 9:20 AM
Hatsy Rei
Hatsy Rei - avatar
+ 10
This is my try in C#- (also my first ever code in C#) Thanx for the challenge it was really interesting!! :) https://code.sololearn.com/c06n4jaKh5DX/?ref=app I've also done it in python.. Which is easy. https://code.sololearn.com/ci4xGTWH8aC5/?ref=app
21st Jan 2018, 5:08 PM
Yash✳️
Yash✳️ - avatar
+ 9
@rusich You want 969969 to also search for the next palindrome instead of returning itself? Just fixed it if that's the case.
21st Jan 2018, 11:53 AM
Hatsy Rei
Hatsy Rei - avatar
+ 9
Thanks for feedback. :>
21st Jan 2018, 12:18 PM
Hatsy Rei
Hatsy Rei - avatar
+ 6
@rusich Done! Edited both the codes.
22nd Jan 2018, 12:04 PM
Yash✳️
Yash✳️ - avatar
+ 6
Btw where is programming Olympics conducted!? I want that in my country 😭
22nd Jan 2018, 12:11 PM
Yash✳️
Yash✳️ - avatar
+ 5
@rusich.. No; it does work for 777 and 999 I gave 776 and 998 as inputs.. And the output was 777 and 999 respectively. What did you give as the input?
22nd Jan 2018, 11:54 AM
Yash✳️
Yash✳️ - avatar
+ 5
Updated original post with two more submissions.
23rd Jan 2018, 5:18 AM
Hatsy Rei
Hatsy Rei - avatar
21st Jan 2018, 9:58 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 2
@yash No, i mean if you enter number 777 in input it's does not work, in output we must get number 787 or for 999 output is 1001
22nd Jan 2018, 11:59 AM
rusich
rusich - avatar
+ 1
Hatsy Rei, your code not working with palindromes :969969, 999, and other, but code is cool, so short
21st Jan 2018, 11:33 AM
rusich
rusich - avatar
+ 1
@Hatsy yep, now worked, great!
21st Jan 2018, 12:15 PM
rusich
rusich - avatar
+ 1
@yash good job) i see cs synt looks like java. but your code also cant write palindrom for equal number 777, 999 can you fix it?)
22nd Jan 2018, 6:57 AM
rusich
rusich - avatar
+ 1
@yash thats was online olympic, you can see full info just write in search " it planet"
22nd Jan 2018, 5:44 PM
rusich
rusich - avatar
+ 1
i like oneline olympics. Oneliner solution here works for 1990 9999 190 or any number https://code.sololearn.com/c280w5mcd4vs/?ref=app
22nd Jan 2018, 7:46 PM
VcC
VcC - avatar
+ 1
@Hatsy tnx very much for your work, i will analyze the algorithm and refact my code:)
23rd Jan 2018, 5:29 AM
rusich
rusich - avatar
+ 1
@Swapnil More tnx for answer)
30th Jan 2018, 4:13 PM
rusich
rusich - avatar
0
@VcC You must find the closest palindrome greater than a provided number. Polinum for number 999 not 999 and etc. program output: 999 => 999 969 => 969 9799979 => 9799979 959959 => 959959
24th Jan 2018, 7:51 AM
rusich
rusich - avatar