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.
This type of edge case is not a concern for this basic kata.
seeing your solution makes me want to refactor mine(which is pretty inefficent. I didn't have an idea nor the time to write a better one), but I want to precieve my development. and thanks for the magnifecent idea, never thought of using a Map, am really lacking in terms of algorithmic thinking.
i agree with you
Character.getNumericValue(char)
might be even more straightforward (unfortunately I found it after completing my own solution).This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
spoiler flag, plz...
This comment is hidden because it contains spoiler information about the solution
How about using a HashSet instead of a Map? Also it is only a small sized byte array, so will it make any difference?
If you were to include negative numbers, you must also include negative divisor. And if
n
is a divisor,-n
is also a divisor, so all numbers would have an even number of divisors, meaning there is no point."Divisors" of a number are usually constricted to positive integers.
markus.benko, that is a crazy smart solution you have. Here I was feeling happy about my use of a hashmap.
what is replacement for ALPHABET.indexOf(...)?
This one fails early, doesn't push unopened close braces and doesn't need to instantiate anything except the char array. Other than that according to the description the input contain the six braces exclusively, so it isn't necessary to check for invalid characters.
I also don't know why but it seems to happen quite often that solutions are considered best practice which clearly shows that the idea of Green Computing hasn't reached most software developers. Too bad that we can't downvote, beginners really shouldn't learn from solutions like this one. And believe it or not, my solution is about 100 times as fast as this one for both strings = "abc...xyz" and it doesn't even create intermediate objects or arrays most of the time. ;-) What I have to admit is that I have forgotten to shortcut cases where
str2
is longer thanstr1
.Loading more items...