Ad
  • Custom User Avatar
  • Custom User Avatar

    It fails since digitize(0L) will return an empty array instead of returning {0}

  • Custom User Avatar

    bro, hi. I want to improve my skills in OOP programming. Can you give me some tips on what to read and where to practice?

  • Custom User Avatar
    • You should never check for cycle in (1), as you are at best removing dependencies from the graph.
    • Instead of keeping track of current dependencies and formula in (2) and rolling back to it when a cycle is found, another option is to verify for a pending cyclic graph upfront.
  • 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

    you need to filter the children based on if a child is in santas list or not.

    Additionally, the problem statement says that it must be case sensitive i think

  • Custom User Avatar

    Im a begginer but in my opinion its a great solution

  • Custom User Avatar

    @dinglemouse raised this already, Thanks for pointing it anyway )

  • Custom User Avatar

    In the real world, we make all kinds of assumptions, we just don't even recognise them anymore.

    "Start with the initial value; apply f for every value in the list" relies on the assumption that applying zero times is valid. Which it is. This is not even an edge case, it's a base case. null means empty; it definitely is data - all of none of it. Zero has been invented for a while.

    It might be easier to reason about [] then about null.

  • Custom User Avatar

    If your Strings have a length of Integer.MAX_VALUE, you really will have other problems with this code.

  • Custom User Avatar

    In the worse case, this algorithm makes k iteration and creates k brand new string objects. Not the most efficient approach.

  • Custom User Avatar

    Multiline lambdas with curly braces and functions that aren't pure (i.e. functions that cause side-effects) are not considered a good practice.

  • Custom User Avatar

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

  • Custom User Avatar

    Single exit strategy is a controversial discussed dogma. For instance the Object.equals() method uses multiple return statements. Just have a look at the source code. Perhaps you shall advise Oracle that you think they're using bad pracice and improve the Java code base with a better solution. Your approach may be good for these concrete kata, but it is indeed not a general valid way, to solve all problems of that type, as you can see.

    Hence, my question was not about linking connections to anything, but wanting to know, how you would solve problems of that kind in general, if something like IntStream was not accessible. Since clairvoyance does not exist, nobody can elaborate how your solution would look like. This is just a red herring argument. I would be grateful, if you could take two minutes to show a good way that works even for cases when Streams don't work, with a single exit point. And of course, without a break in the loop, because it violates your choosen strategy.

  • Loading more items...