6 kyu
Count the Islands
333 of 541SteveRuble
Loading description...
Algorithms
Graphics
Arrays
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.
this is supposed to be two islands and not one ? Am I missing something?
Yes, because the X in the middle is surrounded by ~ on all sides, which makes it a distinct island.
lmfao seems like I was blind haha
Please review: TypeScript Translation
This kata is a subject to deduplication process here: https://github.com/codewars/content-issues/issues/200.
Please join the discussion to help us identify duplicate kata and retire them.
Please review: C++ Translation
Approved.
Too hard for kyu 6, should be kyu 5.
Kyus of approved katas can hardly be changed, and, except in exceptional situations, won't be. However it's not useful to complain about that in Discourse page, nobody can change it. Moreover, consider ranks are shared among languages, and some tasks can be trivial in a particular language, while much harder in others. Kyus are indicative, don't expect them to be exact science.
I know kyus are merely indicative, but this very kata seemed much harder than most 6 kyus I've done - all of them in Javascript (so I compare difficulty levels in one language only). You're right it's not productive to complain, I just frequently see warriors complaining about difficulty levels, I thought changing a kyu level requires a click of a button. I didn't take into account difficulty level of a particular kata may vary greatly among different languages (thank's for pointing that out).
Yeah, I know, that's pointless and galling, that's why I try to explain it.
I solved more than 1,000 6kyus in JS. This is a hard one, ok, but really, no need to make a stink about that.
I disagree. It is useful to complain because a) it's a signal that something is wrong which is affecting the user experience, b) the comments will be useful when organizing future cleanup efforts, should it eventually become easier to rerank and c) they provide opportunity for discussion about matters that affect site quality.
If someone takes the time to leave a comment about a ranking, then it probably reeled their expectations enough to be worth a look; not only is this useful for people who are less sensitive to challenge gradations at the lower ranks, but it can also be reassuring to less experienced warriors who would otherwise be put off.
There is nothing in this kata that should make it worth kyu 5.
Nice kata! However I would suggest to correct the definition of "island" in the description, which is currently "set of adjacent pixels of one color which is completely surrounded by pixels of another color." At first, with a strict understanding of it, I thought an island could not be on a border (it is not surrounded by other pixels since there are no pixels on borders), and the basic test cases did not allow to decide whether my assumption was right or not.
The description has been revamped, please take a look at it again.
Tests are broken, in JS
expects 2 while there are 3 islands
Have you read the instructions? That same example is there and it says they're 2 islands.
Sure, I see and I think i know where confusion comes from. When you try the task there is an extra paragraph saying:
I interpreted
and
there as a sum|x1 - x2| + |y1 - y2| <= 1
. So if one pixel hasx
andy
as coordinates, diagonal pixel would havex(+/-)1
andy(+/-)1
coordinates.Maybe adding an example of a diagonal island would be a good idea to make it clearer.
Python translation available. Please, review and approve.
Bumping translation.
Nice translation! I think it works fine as it is, even without the colorful html decorations in
dump
.approved
Good kata, thanks;-)! I just solved three of same kind, so some "duplicates" are here, don't know who was first, but it's not so important. I like these maze, sudoku, "island", ... katas, all have similar solution code/structure and you can find many of them (recursion normally is the simplest and shortest way to solve them in some lines and a few minutes; surely often not the quickest code, but it's ok;-)).
Got a problem with this case:
Actually think there's only one island (all
#
are connected), am I wrong ?You're right, there was a mistake in the test which corresponded exactly to a bug in my solution. I've fixed it and re-published.
Tests are not working:
All in all a very nice kata ;)
Thanks! There appears to be a bug which is preventing me from updating the example test cases. I've filed a bug about it (https://github.com/Codewars/codewars.com/issues/144) and added a note to the kata description pointing out the typo in the example test cases.