Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
The largest palindrome comes from 15*125 = 1875 -> 8.
There is a smarter way to do this than using recursion :)
Is there a smaller pyramid that has the same longest slide.
Take a look at the small pyramid and think about it.
This comment is hidden because it contains spoiler information about the solution
Is it me or is it a bug?
[ 15, 125, 8 ]
product = 15000
pairs = { '0': 1 }
singles = ['0', '1', '5' ]
highest single = 5
result = 050
= 5
✘ Expected: 8, instead got: 5
Everything worked except for the last test, 300.11. The error it got was '✘ Expected: -300.10, instead got: -300.11' It's suppose to be 300.11, right? That's what my code returns, and it's wrong
My code is:
var numberToPrice = function(num) {
var sign = '';
num = ((Math.floor(num*100))/100).toFixed(2).toString()
if (num.slice(0,1) =='-') {
sign = num.split('').shift()
num = num.split('')
num.shift()
num = num.join('')
}
if (num.indexOf('.')>3) {
num = num.replace(/(\d{3}.)/g,',$1');
for (var i=0; i<(num.indexOf(',')); i++) {
num = num.replace(/(\d)(\d{3},)/g,'$1,$2')
}
}
return sign + num
}
Thanks for reading
This comment is hidden because it contains spoiler information about the solution
Or, if you're using javascript (which I guess based on your previous katas), you can just use
console.log
:I added the colons between the parameters so it will be easier to see when one of them is an empty string.
For example:
But better use
repr()
because you will have to deal with empty strings.Can someone please tell me how to "add print line" in my code to get the input? I can't debug my code until I figure out which tests my code failed!
Oh makes sense.
This is not an issue with the kata because there are no default test cases.
please resolve,
Thank you :)
My solution failed the test but passed when I clicked submit.
Loading more items...