Test cases for next palindromic number
$begingroup$
I recently did a programming challenge: given a positive number find the next palindromic number. In PHP, I decided to do something like this:
<?php
function palindromic($input) {
while (1) {
$number = (string) ++$input;
if ($number == strrev($number)) {
return $number;
}
}
}
I was then asked to provide test inputs for the function and to explain why, so I had (where x is a random number)
- x < 10: test single digits
- 10 < x < 100: tests numbers with even length
- 100 < x < 1000: tests numbers with odd lengths
- 1,000,000 < x: tests a largish number
Note: we can always assume a positive number, so checking for non-positive numbers or inputs that are a different type, or asserting exceptions thrown back, etc aren't relevant to the challenge.
Apparently there were some other important numbers to test, can anyone explain what I've missed here?
php algorithm
$endgroup$
add a comment |
$begingroup$
I recently did a programming challenge: given a positive number find the next palindromic number. In PHP, I decided to do something like this:
<?php
function palindromic($input) {
while (1) {
$number = (string) ++$input;
if ($number == strrev($number)) {
return $number;
}
}
}
I was then asked to provide test inputs for the function and to explain why, so I had (where x is a random number)
- x < 10: test single digits
- 10 < x < 100: tests numbers with even length
- 100 < x < 1000: tests numbers with odd lengths
- 1,000,000 < x: tests a largish number
Note: we can always assume a positive number, so checking for non-positive numbers or inputs that are a different type, or asserting exceptions thrown back, etc aren't relevant to the challenge.
Apparently there were some other important numbers to test, can anyone explain what I've missed here?
php algorithm
$endgroup$
1
$begingroup$
This should help. stackoverflow.com/questions/7934519/…
$endgroup$
– abhig10
Aug 25 '17 at 10:22
add a comment |
$begingroup$
I recently did a programming challenge: given a positive number find the next palindromic number. In PHP, I decided to do something like this:
<?php
function palindromic($input) {
while (1) {
$number = (string) ++$input;
if ($number == strrev($number)) {
return $number;
}
}
}
I was then asked to provide test inputs for the function and to explain why, so I had (where x is a random number)
- x < 10: test single digits
- 10 < x < 100: tests numbers with even length
- 100 < x < 1000: tests numbers with odd lengths
- 1,000,000 < x: tests a largish number
Note: we can always assume a positive number, so checking for non-positive numbers or inputs that are a different type, or asserting exceptions thrown back, etc aren't relevant to the challenge.
Apparently there were some other important numbers to test, can anyone explain what I've missed here?
php algorithm
$endgroup$
I recently did a programming challenge: given a positive number find the next palindromic number. In PHP, I decided to do something like this:
<?php
function palindromic($input) {
while (1) {
$number = (string) ++$input;
if ($number == strrev($number)) {
return $number;
}
}
}
I was then asked to provide test inputs for the function and to explain why, so I had (where x is a random number)
- x < 10: test single digits
- 10 < x < 100: tests numbers with even length
- 100 < x < 1000: tests numbers with odd lengths
- 1,000,000 < x: tests a largish number
Note: we can always assume a positive number, so checking for non-positive numbers or inputs that are a different type, or asserting exceptions thrown back, etc aren't relevant to the challenge.
Apparently there were some other important numbers to test, can anyone explain what I've missed here?
php algorithm
php algorithm
edited Aug 25 '17 at 13:41
Mike Brant
8,858622
8,858622
asked Aug 23 '17 at 12:58
alexkbalexkb
1384
1384
1
$begingroup$
This should help. stackoverflow.com/questions/7934519/…
$endgroup$
– abhig10
Aug 25 '17 at 10:22
add a comment |
1
$begingroup$
This should help. stackoverflow.com/questions/7934519/…
$endgroup$
– abhig10
Aug 25 '17 at 10:22
1
1
$begingroup$
This should help. stackoverflow.com/questions/7934519/…
$endgroup$
– abhig10
Aug 25 '17 at 10:22
$begingroup$
This should help. stackoverflow.com/questions/7934519/…
$endgroup$
– abhig10
Aug 25 '17 at 10:22
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
I don't code in java or python so I don't fully follow the methods provided in the commented link under the question.
I've decided to write a method that avoids the incremental checking for palindromic integers. Instead, it uses arithmetic based on a few preliminary string function results to discover the closest greater palindromic integer. Note, there are limitations to my method because the input and output are integers rather than strings. I can conclude after testing that my method will stay true into the 10's of trillions.
Code: (Demo)
function nextPalindromicInteger($integer) {
if ($integer < 9) {
$next = $integer + 1;
return "$integer => $next (+1) " . ($next != strrev($next) ? "FAIL" : "PASS") . "n";
}
$size = strlen($integer);
$psize = ceil($size / 2); // find length of rhs & lhs including pivot when length is odd
$npsize = $size - $psize; // find length of rhs & lhs excluding pivot when length is odd
$rnplhs = (int)strrev(substr($integer, 0, $npsize)); // reverse nplhs
$nprhs = (int)substr($integer, -$npsize); // store right hand side integer excluding pivot //KEEP
$trimmed=strlen(rtrim(substr($integer, 0, $psize), '9')); // store length of rtrim'd plhs
if ($rnplhs > $nprhs) {
$bump = 0;
} elseif (!strlen(trim($integer, '9'))) {
$bump = 2;
$nprhs = 0;
$rnplhs = 0;
} else {
if ($psize != $npsize) { // odd integer length
if ($trimmed == 1) {
$exponent = 1; // dictates $bump=11
} else {
$exponent = $npsize;
}
} else { // even integer length
$exponent = $trimmed;
}
$bump = pow(10, $exponent);
if ($psize == $npsize || $trimmed < $psize) {
$bump += pow(10, $exponent - 1);
}
}
$next = $integer + $rnplhs - $nprhs + $bump;
return "$integer => $next (+" . ($next - $integer) . ") " . ($next != strrev($next) ? "FAIL" : "PASS") . "n";
}
for ($x = 0; $x < 14; ++$x) {
$integer = rand(pow(10, $x), pow(10, $x + 1) - 1);
echo nextPalindromicInteger($integer);
}
If I spent some more time refining, I could probably write my function more eloquently, but for the purposes of this question it is sufficient to reveal (to me at least) some of the fringe cases.
I found in my development and testing that it was important to test against:
- a range of integers, some with even length and some with odd length.
- integers with a pivot (shared middle digit) of nine.
- integers with an odd length and a non-9 pivot.
- integers consisting entirely of 9's.
- integers where the reversed left-hand-side component minus the right-hand-side component is:
>0
,=0
, and<0
Once I isolated the patterns that exist with certain sequences, I could declare the correct "bump" or adjustment. Some bumps are static, others depend on the length or value of the left-hand-side component.
As for your relevant numbers to check using your method, I can't think of any that would cause trouble because you are looping and checking each iteration. Perhaps the challenge was assuming that you would try to write a method without loops as I did or run "inside out" string comparison checks on each side's digits.
As for checking "large-ish" numbers, I found that once I had perfected the bumps from 1
to 9999
, all integers above that were accounted for.
Possible Output:
9 => 11 (+2) PASS
75 => 77 (+2) PASS
776 => 777 (+1) PASS
4891 => 4994 (+103) PASS
92764 => 92829 (+65) PASS
999539 => 999999 (+460) PASS
7059657 => 7060607 (+950) PASS
48756572 => 48766784 (+10212) PASS
633149324 => 633151336 (+2012) PASS
2096785014 => 2096886902 (+101888) PASS
80448359477 => 80448384408 (+24931) PASS
237762850363 => 237763367732 (+517369) PASS
7730351516591 => 7730351530377 (+13786) PASS
79541453924626 => 79541455414597 (+1489971) PASS
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "196"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f173752%2ftest-cases-for-next-palindromic-number%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
I don't code in java or python so I don't fully follow the methods provided in the commented link under the question.
I've decided to write a method that avoids the incremental checking for palindromic integers. Instead, it uses arithmetic based on a few preliminary string function results to discover the closest greater palindromic integer. Note, there are limitations to my method because the input and output are integers rather than strings. I can conclude after testing that my method will stay true into the 10's of trillions.
Code: (Demo)
function nextPalindromicInteger($integer) {
if ($integer < 9) {
$next = $integer + 1;
return "$integer => $next (+1) " . ($next != strrev($next) ? "FAIL" : "PASS") . "n";
}
$size = strlen($integer);
$psize = ceil($size / 2); // find length of rhs & lhs including pivot when length is odd
$npsize = $size - $psize; // find length of rhs & lhs excluding pivot when length is odd
$rnplhs = (int)strrev(substr($integer, 0, $npsize)); // reverse nplhs
$nprhs = (int)substr($integer, -$npsize); // store right hand side integer excluding pivot //KEEP
$trimmed=strlen(rtrim(substr($integer, 0, $psize), '9')); // store length of rtrim'd plhs
if ($rnplhs > $nprhs) {
$bump = 0;
} elseif (!strlen(trim($integer, '9'))) {
$bump = 2;
$nprhs = 0;
$rnplhs = 0;
} else {
if ($psize != $npsize) { // odd integer length
if ($trimmed == 1) {
$exponent = 1; // dictates $bump=11
} else {
$exponent = $npsize;
}
} else { // even integer length
$exponent = $trimmed;
}
$bump = pow(10, $exponent);
if ($psize == $npsize || $trimmed < $psize) {
$bump += pow(10, $exponent - 1);
}
}
$next = $integer + $rnplhs - $nprhs + $bump;
return "$integer => $next (+" . ($next - $integer) . ") " . ($next != strrev($next) ? "FAIL" : "PASS") . "n";
}
for ($x = 0; $x < 14; ++$x) {
$integer = rand(pow(10, $x), pow(10, $x + 1) - 1);
echo nextPalindromicInteger($integer);
}
If I spent some more time refining, I could probably write my function more eloquently, but for the purposes of this question it is sufficient to reveal (to me at least) some of the fringe cases.
I found in my development and testing that it was important to test against:
- a range of integers, some with even length and some with odd length.
- integers with a pivot (shared middle digit) of nine.
- integers with an odd length and a non-9 pivot.
- integers consisting entirely of 9's.
- integers where the reversed left-hand-side component minus the right-hand-side component is:
>0
,=0
, and<0
Once I isolated the patterns that exist with certain sequences, I could declare the correct "bump" or adjustment. Some bumps are static, others depend on the length or value of the left-hand-side component.
As for your relevant numbers to check using your method, I can't think of any that would cause trouble because you are looping and checking each iteration. Perhaps the challenge was assuming that you would try to write a method without loops as I did or run "inside out" string comparison checks on each side's digits.
As for checking "large-ish" numbers, I found that once I had perfected the bumps from 1
to 9999
, all integers above that were accounted for.
Possible Output:
9 => 11 (+2) PASS
75 => 77 (+2) PASS
776 => 777 (+1) PASS
4891 => 4994 (+103) PASS
92764 => 92829 (+65) PASS
999539 => 999999 (+460) PASS
7059657 => 7060607 (+950) PASS
48756572 => 48766784 (+10212) PASS
633149324 => 633151336 (+2012) PASS
2096785014 => 2096886902 (+101888) PASS
80448359477 => 80448384408 (+24931) PASS
237762850363 => 237763367732 (+517369) PASS
7730351516591 => 7730351530377 (+13786) PASS
79541453924626 => 79541455414597 (+1489971) PASS
$endgroup$
add a comment |
$begingroup$
I don't code in java or python so I don't fully follow the methods provided in the commented link under the question.
I've decided to write a method that avoids the incremental checking for palindromic integers. Instead, it uses arithmetic based on a few preliminary string function results to discover the closest greater palindromic integer. Note, there are limitations to my method because the input and output are integers rather than strings. I can conclude after testing that my method will stay true into the 10's of trillions.
Code: (Demo)
function nextPalindromicInteger($integer) {
if ($integer < 9) {
$next = $integer + 1;
return "$integer => $next (+1) " . ($next != strrev($next) ? "FAIL" : "PASS") . "n";
}
$size = strlen($integer);
$psize = ceil($size / 2); // find length of rhs & lhs including pivot when length is odd
$npsize = $size - $psize; // find length of rhs & lhs excluding pivot when length is odd
$rnplhs = (int)strrev(substr($integer, 0, $npsize)); // reverse nplhs
$nprhs = (int)substr($integer, -$npsize); // store right hand side integer excluding pivot //KEEP
$trimmed=strlen(rtrim(substr($integer, 0, $psize), '9')); // store length of rtrim'd plhs
if ($rnplhs > $nprhs) {
$bump = 0;
} elseif (!strlen(trim($integer, '9'))) {
$bump = 2;
$nprhs = 0;
$rnplhs = 0;
} else {
if ($psize != $npsize) { // odd integer length
if ($trimmed == 1) {
$exponent = 1; // dictates $bump=11
} else {
$exponent = $npsize;
}
} else { // even integer length
$exponent = $trimmed;
}
$bump = pow(10, $exponent);
if ($psize == $npsize || $trimmed < $psize) {
$bump += pow(10, $exponent - 1);
}
}
$next = $integer + $rnplhs - $nprhs + $bump;
return "$integer => $next (+" . ($next - $integer) . ") " . ($next != strrev($next) ? "FAIL" : "PASS") . "n";
}
for ($x = 0; $x < 14; ++$x) {
$integer = rand(pow(10, $x), pow(10, $x + 1) - 1);
echo nextPalindromicInteger($integer);
}
If I spent some more time refining, I could probably write my function more eloquently, but for the purposes of this question it is sufficient to reveal (to me at least) some of the fringe cases.
I found in my development and testing that it was important to test against:
- a range of integers, some with even length and some with odd length.
- integers with a pivot (shared middle digit) of nine.
- integers with an odd length and a non-9 pivot.
- integers consisting entirely of 9's.
- integers where the reversed left-hand-side component minus the right-hand-side component is:
>0
,=0
, and<0
Once I isolated the patterns that exist with certain sequences, I could declare the correct "bump" or adjustment. Some bumps are static, others depend on the length or value of the left-hand-side component.
As for your relevant numbers to check using your method, I can't think of any that would cause trouble because you are looping and checking each iteration. Perhaps the challenge was assuming that you would try to write a method without loops as I did or run "inside out" string comparison checks on each side's digits.
As for checking "large-ish" numbers, I found that once I had perfected the bumps from 1
to 9999
, all integers above that were accounted for.
Possible Output:
9 => 11 (+2) PASS
75 => 77 (+2) PASS
776 => 777 (+1) PASS
4891 => 4994 (+103) PASS
92764 => 92829 (+65) PASS
999539 => 999999 (+460) PASS
7059657 => 7060607 (+950) PASS
48756572 => 48766784 (+10212) PASS
633149324 => 633151336 (+2012) PASS
2096785014 => 2096886902 (+101888) PASS
80448359477 => 80448384408 (+24931) PASS
237762850363 => 237763367732 (+517369) PASS
7730351516591 => 7730351530377 (+13786) PASS
79541453924626 => 79541455414597 (+1489971) PASS
$endgroup$
add a comment |
$begingroup$
I don't code in java or python so I don't fully follow the methods provided in the commented link under the question.
I've decided to write a method that avoids the incremental checking for palindromic integers. Instead, it uses arithmetic based on a few preliminary string function results to discover the closest greater palindromic integer. Note, there are limitations to my method because the input and output are integers rather than strings. I can conclude after testing that my method will stay true into the 10's of trillions.
Code: (Demo)
function nextPalindromicInteger($integer) {
if ($integer < 9) {
$next = $integer + 1;
return "$integer => $next (+1) " . ($next != strrev($next) ? "FAIL" : "PASS") . "n";
}
$size = strlen($integer);
$psize = ceil($size / 2); // find length of rhs & lhs including pivot when length is odd
$npsize = $size - $psize; // find length of rhs & lhs excluding pivot when length is odd
$rnplhs = (int)strrev(substr($integer, 0, $npsize)); // reverse nplhs
$nprhs = (int)substr($integer, -$npsize); // store right hand side integer excluding pivot //KEEP
$trimmed=strlen(rtrim(substr($integer, 0, $psize), '9')); // store length of rtrim'd plhs
if ($rnplhs > $nprhs) {
$bump = 0;
} elseif (!strlen(trim($integer, '9'))) {
$bump = 2;
$nprhs = 0;
$rnplhs = 0;
} else {
if ($psize != $npsize) { // odd integer length
if ($trimmed == 1) {
$exponent = 1; // dictates $bump=11
} else {
$exponent = $npsize;
}
} else { // even integer length
$exponent = $trimmed;
}
$bump = pow(10, $exponent);
if ($psize == $npsize || $trimmed < $psize) {
$bump += pow(10, $exponent - 1);
}
}
$next = $integer + $rnplhs - $nprhs + $bump;
return "$integer => $next (+" . ($next - $integer) . ") " . ($next != strrev($next) ? "FAIL" : "PASS") . "n";
}
for ($x = 0; $x < 14; ++$x) {
$integer = rand(pow(10, $x), pow(10, $x + 1) - 1);
echo nextPalindromicInteger($integer);
}
If I spent some more time refining, I could probably write my function more eloquently, but for the purposes of this question it is sufficient to reveal (to me at least) some of the fringe cases.
I found in my development and testing that it was important to test against:
- a range of integers, some with even length and some with odd length.
- integers with a pivot (shared middle digit) of nine.
- integers with an odd length and a non-9 pivot.
- integers consisting entirely of 9's.
- integers where the reversed left-hand-side component minus the right-hand-side component is:
>0
,=0
, and<0
Once I isolated the patterns that exist with certain sequences, I could declare the correct "bump" or adjustment. Some bumps are static, others depend on the length or value of the left-hand-side component.
As for your relevant numbers to check using your method, I can't think of any that would cause trouble because you are looping and checking each iteration. Perhaps the challenge was assuming that you would try to write a method without loops as I did or run "inside out" string comparison checks on each side's digits.
As for checking "large-ish" numbers, I found that once I had perfected the bumps from 1
to 9999
, all integers above that were accounted for.
Possible Output:
9 => 11 (+2) PASS
75 => 77 (+2) PASS
776 => 777 (+1) PASS
4891 => 4994 (+103) PASS
92764 => 92829 (+65) PASS
999539 => 999999 (+460) PASS
7059657 => 7060607 (+950) PASS
48756572 => 48766784 (+10212) PASS
633149324 => 633151336 (+2012) PASS
2096785014 => 2096886902 (+101888) PASS
80448359477 => 80448384408 (+24931) PASS
237762850363 => 237763367732 (+517369) PASS
7730351516591 => 7730351530377 (+13786) PASS
79541453924626 => 79541455414597 (+1489971) PASS
$endgroup$
I don't code in java or python so I don't fully follow the methods provided in the commented link under the question.
I've decided to write a method that avoids the incremental checking for palindromic integers. Instead, it uses arithmetic based on a few preliminary string function results to discover the closest greater palindromic integer. Note, there are limitations to my method because the input and output are integers rather than strings. I can conclude after testing that my method will stay true into the 10's of trillions.
Code: (Demo)
function nextPalindromicInteger($integer) {
if ($integer < 9) {
$next = $integer + 1;
return "$integer => $next (+1) " . ($next != strrev($next) ? "FAIL" : "PASS") . "n";
}
$size = strlen($integer);
$psize = ceil($size / 2); // find length of rhs & lhs including pivot when length is odd
$npsize = $size - $psize; // find length of rhs & lhs excluding pivot when length is odd
$rnplhs = (int)strrev(substr($integer, 0, $npsize)); // reverse nplhs
$nprhs = (int)substr($integer, -$npsize); // store right hand side integer excluding pivot //KEEP
$trimmed=strlen(rtrim(substr($integer, 0, $psize), '9')); // store length of rtrim'd plhs
if ($rnplhs > $nprhs) {
$bump = 0;
} elseif (!strlen(trim($integer, '9'))) {
$bump = 2;
$nprhs = 0;
$rnplhs = 0;
} else {
if ($psize != $npsize) { // odd integer length
if ($trimmed == 1) {
$exponent = 1; // dictates $bump=11
} else {
$exponent = $npsize;
}
} else { // even integer length
$exponent = $trimmed;
}
$bump = pow(10, $exponent);
if ($psize == $npsize || $trimmed < $psize) {
$bump += pow(10, $exponent - 1);
}
}
$next = $integer + $rnplhs - $nprhs + $bump;
return "$integer => $next (+" . ($next - $integer) . ") " . ($next != strrev($next) ? "FAIL" : "PASS") . "n";
}
for ($x = 0; $x < 14; ++$x) {
$integer = rand(pow(10, $x), pow(10, $x + 1) - 1);
echo nextPalindromicInteger($integer);
}
If I spent some more time refining, I could probably write my function more eloquently, but for the purposes of this question it is sufficient to reveal (to me at least) some of the fringe cases.
I found in my development and testing that it was important to test against:
- a range of integers, some with even length and some with odd length.
- integers with a pivot (shared middle digit) of nine.
- integers with an odd length and a non-9 pivot.
- integers consisting entirely of 9's.
- integers where the reversed left-hand-side component minus the right-hand-side component is:
>0
,=0
, and<0
Once I isolated the patterns that exist with certain sequences, I could declare the correct "bump" or adjustment. Some bumps are static, others depend on the length or value of the left-hand-side component.
As for your relevant numbers to check using your method, I can't think of any that would cause trouble because you are looping and checking each iteration. Perhaps the challenge was assuming that you would try to write a method without loops as I did or run "inside out" string comparison checks on each side's digits.
As for checking "large-ish" numbers, I found that once I had perfected the bumps from 1
to 9999
, all integers above that were accounted for.
Possible Output:
9 => 11 (+2) PASS
75 => 77 (+2) PASS
776 => 777 (+1) PASS
4891 => 4994 (+103) PASS
92764 => 92829 (+65) PASS
999539 => 999999 (+460) PASS
7059657 => 7060607 (+950) PASS
48756572 => 48766784 (+10212) PASS
633149324 => 633151336 (+2012) PASS
2096785014 => 2096886902 (+101888) PASS
80448359477 => 80448384408 (+24931) PASS
237762850363 => 237763367732 (+517369) PASS
7730351516591 => 7730351530377 (+13786) PASS
79541453924626 => 79541455414597 (+1489971) PASS
edited 6 hours ago
answered Sep 14 '17 at 6:39
mickmackusamickmackusa
1,539215
1,539215
add a comment |
add a comment |
Thanks for contributing an answer to Code Review Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f173752%2ftest-cases-for-next-palindromic-number%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
$begingroup$
This should help. stackoverflow.com/questions/7934519/…
$endgroup$
– abhig10
Aug 25 '17 at 10:22