5 kyu
Configurations of White and Black Knights on a 3x3 chessboard
Loading description...
Fundamentals
Algorithms
Puzzles
Mathematics
Performance
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.
Example 3 implies start_board and end_board might have different pieces, but out of all the test cases that's the only one where that's true. Maybe add some tests where there are different numbers of knights at the start and end?
This kata seems to have performance constraints, but both the tag and performance requirements are missing from the description.
I'm not sure I understand @dfhwze - do you mean "performance" as in anti-Brute Force?
There are quite a few different approaches using different logics/data structures and none with particular performance issues as far as I can tell? I will add the tag though to close issue, let me know if you want it removed subsequently.
Thanks for the feedback as always,
edit: Performance tag added
Yep, since brute force doesn't work, I consider this a performance kata.
I have a feeling we are not required to alternate between W and B. This isn't according to standard chess moves. I find nothing in the description about this.
You may only move one Knight at a time, and they follow standard chess move rules
Ah very good point - I have updated that in description to avoid confusion.
To confirm; you are indeed correct - the "order of play" is not standard, any piece can be moved "next". You may move 1,2,3,...1814 white pieces before moving a single black piece and vice versa.
edit: updated paragraph here for reference:
As a follow-up question; can a knight move to a square with another knight, and is that knight then taken from the board?
Ah nope, good point - that was in an earlier beta version but it was removed to keep it simple; I'll mention this explicity also.