These are chat archives for Codewars/codewars.com/kata-solving-help

16th
Sep 2016
Karolina
@vissaskywalker
Sep 16 2016 02:01
Hi
I'm new here and I'm trying to submit a kata. Test runs and submitting show that no tests failed, but I don't see myself getting any honor for that, so I think I have issue with submitting kata
Natacha Beck
@natacha-beck
Sep 16 2016 03:51
Moahh guys you are crazy:
all a one liner solution !
Giacomo Sorbi
@GiacomoSorbi
Sep 16 2016 08:02
@vissaskywalker, which kata and do you get to the solutions pages?
Giacomo Sorbi
@GiacomoSorbi
Sep 16 2016 08:42
@natacha-beck, I finished that with a one-liner as well: can't blame others if you do not know all the good tools for the job :p
Natacha Beck
@natacha-beck
Sep 16 2016 09:56
@GiacomoSorbi A one liner from you not a big surprise!
Oh and I know that you know... I do not blame I am impress and learn
Giacomo Sorbi
@GiacomoSorbi
Sep 16 2016 10:22
anyway, on RegEx
Sanket Ray
@iamsanketray123
Sep 16 2016 13:30

@iamchingel
https://www.codewars.com/kata/palindrome-chain-length/train/javascript

var palindromeChainLength = function(n) {
console.log(n)
var count=0;
  while(n !== n.toString().split("").reverse().join("") )
    {n = n + n.toString().split("").reverse().join("");
      count++;
    }
return count;

};

87
✘ Expected: 4, instead got: 1
whats wrong in the while loop?

Giacomo Sorbi
@GiacomoSorbi
Sep 16 2016 13:31
you are summing a number to a string, among other things
Sanket Ray
@iamsanketray123
Sep 16 2016 13:32
n = n + parseInt(n.toString().split("").reverse().join(""));
`
did this....timed out :O
solved
nvm :D
Giacomo Sorbi
@GiacomoSorbi
Sep 16 2016 13:33
eh...
anyway, you are computing twice the reversed number, for no reason at all
Sanket Ray
@iamsanketray123
Sep 16 2016 13:34
had to add parseInt to the abve line as well
Giacomo Sorbi
@GiacomoSorbi
Sep 16 2016 13:35
of course; either that or you use just !=
Sanket Ray
@iamsanketray123
Sep 16 2016 13:36
hmm !=sounds better