6 kyu
House of cards
345 of 1,041Tuhaj
Loading description...
Mathematics
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
I am throwing error for negative cases, but still getting this - expected [Function] to throw an error. any idea?
OP solved it, closing
A too simple one for 6 kyu. I think tag "Math" would be better than "Algorithms"
Changed.
JS fork
approved
This comment has been hidden.
you must
throw
an Error, not return an error messagepython new test framework + random tests are required. updated in this fork
Approved
No random tests
https://www.codewars.com/kata/reviews/5795224073938ea8bf0000c3/groups/61ae0e92952edc0001e9b5b4
Duplicate issue.
COBOL translation, with random tests (author inactive).
approved
Node 18 should be enabled (Refer this and this for more info)
Ruby 3.0 should be enabled (Refer this & this for more detail)
An article is not an excuse for a description.
I added ASCII art to the description to show the house of cards' structure
This comment has been hidden.
No random tests.
Testing for 0 should be added too - solutions like this should not pass.
Test.assert_equals
should be used instead.Python 3 should be enabled.
Fixed.
This comment has been hidden.
From the description: for other input raise an error.
Also: If you want to paste multiple lines of code please surround them by a line of three backticks (see https://help.github.com/articles/basic-writing-and-formatting-syntax/#quoting-code).
R Translation kumited.
Please review and approve!
Added random tests. Added a bit in the description about the british floor numbering system.
"already approved some time ago"
This comment has been hidden.
if (n >= 1 || typeof n === 'int'){
: Do you really want or (||
)? Also, there is noint
type in JavaScript.This comment has been hidden.
I consider that to be a mistake in the kata's description; although a British person would call the floors in a two-floor building the "ground floor" and the "first floor," they would still agree with an American that the building had two floors.
Can someone explain how the cards are counted? The wiki example looks like it 5 cards for a 1 floor house, not 7. Personally, I would also consider 2 cards as a viable 1-floor house option. The example the wiki shows for 7 cards has two floors unless the number of floors is 0 indexed such that the 5 card, one floor house is counted as houseOfCards(0).
One floor:
Four floors:
I don't understand the "floor" system. Following the numerotation it should be possible to have
houseOfCards(0) === 2
. Also all the edge cases should be referenced with the correct way of handling them.For the ones trying to complete the Kata, the function should throw an Error (Javascript object: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) in the following cases:
This comment has been hidden.
houseOfCards
notnumCards
Hope it helps!
Ah thanks Zozo! Such small things to overlook >.<
JS-translation kumited.