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.
i like this logic, bravo man
perfect examples of a simple problem solved with something that is really not worth trying to understand
Nice solution but mine better haha :)
Wouldn't this convert the full array to list first and then provide index of match?
why traverse through full array, when we can "return" upon finding the "needle" with a simple for loop, thoughts?
Someone can give me feedback about my solution?
I must say that it possibly not universal solution, but deffinitely very resourcefully!
that makes two of us, I feel so dumb after I finally get a solution and I submit, someone posts something like this and I feel like a neanderthal. ;D
would be better with curly braces
Is there any difference between importing the library first opposed to doing Math.abs() ?
It is a short hand if else statment. Each of the statments
(p1 + p2).equals("scissorspaper") || (p1 + p2).equals("rockscissors") || (p1 + p2).equals("paperrock")
are all conditions of the if statament and if any of them are met then the player that wins will be 1.
When it says
int p =
at the start it is stating what will the 1 : 2 equal after the if statment.Doesn't work if input parameter haystack=null. Need to add checking for null input.
Nice Solution!
G E N I U S
using a ternary operator, this is so genius!
It is not best practice. The same people that go on leetcode that demands more of them and then downvote the problem come here to do their shenanigans and upvote the clever answers and call them a best practice. Bunch of 12 year olds.
Loading more items...