Ad
  • Custom User Avatar

    Sounds good, thanks for bringing this to my attention.

  • Custom User Avatar

    Made a fix so it should work now. Can you try?

  • Custom User Avatar

    The Description seems pretty clear about what the goal is -- find when the first zombie breaks the defenses or null if they don't.

    It's a flawed assumption that a clear board with zombies still in queue equates to a finished state; if there are still zombies in queue, then it's possible they can still breach the defense.

    As for adding an extra test case, maybe if it was early on when the kata had fewer completions, but at this point adding the suggested fixed test means adding it to all the languages and there's some overhead for doing so. But if these types of tests show up in the random tests, maybe that's just good enough.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    As I know all correct input data have only one possible solution.
    As for 1010 question is where to take input sample for 1010?

  • Custom User Avatar

    Thorowing, you didn't see my "solution" yet :)

  • Default User Avatar

    I don't see any iteration to put the elements into the stream. This solution seems fine to me.

    Try this:

    public static int findShort(String s) {
      String[] words = s.split(" ");
      Stream<String> stream = Arrays.stream(words);
      Arrays.fill(words, null);
      return stream.mapToInt(String::length)
                   .min()
                   .getAsInt();
    }
    

    You'll get a NullPointerException because no copy of the array is created.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Hi wolffy! ;)

    Yeah, thx for the hints. I'm still learning about streams... ;) (Did you begin your chemistry homework? ;o )

    cheers!

  • Default User Avatar

    Don't forget to mark spoilers.

  • Default User Avatar

    added

  • Default User Avatar

    Ok, but that shouldn't be necessary: it's bad practice to mutate the input unless "authorisation" is granted. ;)

    Note: in which part of the tests did you encounter that problem, please?

  • Default User Avatar

    Nice hint, didn't know about that method. Thanks! Btw, using regular expressions for this task might be considered overkill anyway. But I must admit that this solution is very concise.

  • Loading more items...