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.
8 kyu
With exception of COBOL, I personally redid tests in ALL languages in this kata to cover ALL combinations of inputs. With exception of COBOL, all tests, in all languages, test all ~260 possible combinations.
Damp tests.You don't cover edge cases.
For example, checking for 4 identical inputs.
5 or 1. What if the user didn't enter a variable that counts how many counts from the Map have already been used (as in my case?)? Then it recalculates those values. Tests don't cover everything, but they cover basic logic. A bug like that would ruin everything. In interviews or in production, it's a bug that would ruin everything.
The base system that a number is represented in has nothing to do with how many digits are in a number. 5 can be a base 10 number, 55 can be a base 10 number and 555 can be a base 10 number.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
You were correct. The PHP version of the kata is working correctly. I'm was trying to learn a new language, PHP, and copied my Javascript based solution as a starting point. Somehow, a section of the code got copied twice. I didn't catch that in my original post. Thanks for the follow up!
The tests look fine in php to me. Your code is just incorrect. You've also got expected/actual backwards. For
[1,1,1,3,3], the expected score is 1000, but your code is returning 2000.At some point i touched all languages of this kata, and i thought i fixed everything. I will take a look, but having your code would greatly help.
The PHP version of this kata, is expecting incorrect scores for approximately 10% of the tests. What follows are several examples: For input [1, 1, 1, 3, 3], the expected score is 2000 but should be 1000 (3 ones). For input [1, 1, 1, 1, 2], the expected score is 2200 but should be 1100 (3 ones plus 1 one). For input [1, 1, 1, 1, 1], the expected score is 2300 but should be 1200 (3 ones, 1 one, plus 1 one). For input [5, 5, 5, 5, 5], the expected score is 550 but should be 600 (3 fives, 1 five, plus 1 five). For input [1, 1, 1, 5, 5] the expected score is 2100 but should be 1100 (3 ones, 1 five, plus 1 five).
Task description states:
"In this Kata, we will restrict ourselves to decimal (base 10)."
However this no longer appears to be the case with the test cases including 1 and 3 digit numbers
haha
My bad, I had no idea.thanks..
Please mark your post as having spoiler content next time.
This comment is hidden because it contains spoiler information about the solution
Loading more items...