Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
oh my goodness gracious
SORT BY: "Most Verbose"
This comment is hidden because it contains spoiler information about the solution
Actually it does return an
int
: https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/OptionalInt.html#getAsInt()If it wasn't the code wouldn't even compile.
It isn't ideal because it return an OptionalInt and not an int
Like @goodman965 saying, i think all this codes with s.split(" ") are not working if there is double-spaces inside the given string, meanwhile if you use s.split("\s+") you are taking care of any number of spaces.
does not work with double space
Very impressive.
This one is not the fastest, cause it needs 2n reads, am i right?
Some people only use one line of code, maybe that's the difference.
Wow I don't even know how to read it. Nice job.
I don't see any iteration to put the elements into the stream. This solution seems fine to me.
Try this:
You'll get a
NullPointerException
because no copy of the array is created.This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
lambdas interesting.....still trying to learn
Loading more items...