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.
For product 0, the output should be "10", because
1 times 0 is zero => "10"
0 times 1 is zero => 01 => "1"
So why is 1 not the expected output, but 10?
You can use zero padding for integers. "001", "0000 0001" and "1" are all the same.
;-)
Glad it helped, the kata is nice!
I've checked out the issue: my validate function call
digitsProduct
instead ofitself
when it performs recursion.Now it's fixed. Many thanks ;-)
You can check mine out, although pretty sure there are better ones out there.
Ok so I did have a mistake in my code, I fixed it and now it passes everything. But when it didn't it had incorrect description for some of the tests. For example:
Testing for:
product = 172
✘ Expected: 22, instead got: 4
My answer is wrong here as well, but the test should expect -1, not 22. Weirdly, when I corrected my code everything passed. So the problem seems to be not in the tests themselves by somehow in the description.
EDIT:
Posted my old code so you can replicate the error. Maybe just worth double-checking those tests. I think you can narrow it to the cases when the expectation should be '-1'
If you are surely that you meet the problem in random tests, please paste your code here and mark it as having spoiler content. Let me check the random tests using your code. thanks ;-)
Which language? I guess you are using JS, but I test input 6 in JS, it expect the result 6, insted of 23.
EDIT: I'm sure that my validate function expected 1 digit result, because the first line in my code is
if(product<10) return product?product:10
.Same result in c#.
I pass all the example tests, but when I click submit it fails for one digits as shown above. E.g. it expects 23 for 6
kata not ask for at least two digits, the goal is a smallest positive integer. In the example tests, two testcases test for 1 digit(1 expected 1, 5 expected 5)
Very interesting kata! But what about single digits? I keep getting failed tests like this:
Expected: 23, instead got: 6
If the product is 6, the smallest integer should be 6, or, if you want at least 2 digit number, 16, or am I missing something?
Good night;-)!
This comment is hidden because it contains spoiler information about the solution
Thanks @ColeBeckwith ;-)
My English is poor ;-)
Modified the description as your advice, and added some examples in the description.
I think this Kata needs clearer instructions. I believe what you're asking for is to remove the most common number in all of the arrays from each array. It could easily be misinterpreted to mean, 'remove the most common number in each array from that array."
Loading more items...