6 kyu

Count the Islands

333 of 541SteveRuble
Description
Loading description...
Algorithms
Graphics
Arrays
  • Please sign in or sign up to leave a comment.
  • d_latran Avatar
    ~XXXXX~
    ~X~~~X~
    ~X~X~X~
    ~X~~~X~
    ~XXXXX~
    

    this is supposed to be two islands and not one ? Am I missing something?

  • k0lesan Avatar

    Please review: TypeScript Translation

  • hobovsky Avatar

    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.

  • 66  Avatar

    Please review: C++ Translation

  • Lucasss Avatar

    Too hard for kyu 6, should be kyu 5.

  • akar-0 Avatar

    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.

  • GeorgySerga Avatar

    Tests are broken, in JS

        var image = [
          [0,0,0,0,0,0,0,0,0,0],
          [0,0,1,1,0,0,0,0,0,0],
          [0,0,1,1,0,0,0,0,0,0],
          [0,0,0,0,0,0,0,0,1,0],
          [0,0,0,0,0,1,1,1,0,0],
          [0,0,0,0,0,0,0,0,0,0],
        ];
    

    expects 2 while there are 3 islands

  • FArekkusu Avatar

    Python translation available. Please, review and approve.

  • smile67 Avatar

    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;-)).

  • ZozoFouchtra Avatar

    Got a problem with this case:

    should find a complicated island
    
    ~ ~ ~ ~ ~ ~ ~ 
    ~ # # # # # ~ 
    ~ ~ ~ ~ ~ # ~ 
    ~ # # # ~ # ~ 
    ~ # ~ # ~ # ~ 
    ~ # # # # # ~ 
    ~ ~ ~ ~ ~ ~ ~ 
    
    Expected: 2, instead got: 1
    

    Actually think there's only one island (all # are connected), am I wrong ?

  • Stefan Blamberg Avatar

    Tests are not working:

    kata: Unexpected token:8
    })();});
          ^
    

    All in all a very nice kata ;)