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.
Clever!
Use regex101.com
Can I get an explanation for this regex?
Clever!
It says in the description that the empty string is allowed to match.
I think it should be 0|1(01*0)*1)+ , because if put * at the end it will match "" empty string which is wrong.
Yes happened to me also in a similar test case. (Java)
Thanks for sharing the idea, never thought about doing bit arithmetic could help to get rid of that ugly
-i -1
and the branch. :-)The expression "-i - 1" can be replaced by "~1", which simply flips all bits. It always yields the same value, e.g. if i=-5 [...11111011] then -(-5)-1=4 [...00000100].
If you fiddle the bits some more, you can even save the branch. Since you're effectively flipping all the bits depending on whether the value is negative which is ultimately indicated by the sign bit, you may as well create a bit mask from the sign bit and use it to flip all the bits if necessary, i.e. you can replace something like "(i < 0) ? ~i : i" with the formula "(i >> 31) ^ i".
The last three lines of your code then come down to "Arrays.copyOfRange(TABLE, 0, (i >> 31) ^ i)".
What language was that?
EDIT: I found out it is in the Java translation. Unfortunately, I have no power to fix it :( I will try to get someone on it.
The random test appears to be flawed: for the simple input '(-1a+0)^9' it falsely expected '45a^9' instead of the correct '-a^9'.
I think the while-loop will never terminate, if the input triplets contain a contradiction regarding the order of characters.
A null input should either throw a NullPointerException (discouraged) or should gracefully delegate the null-handling back to the caller by returning null (prefered).
Converting null to an empty string (or any other "empty" object, for that matter) is a bad practice that leads to confusion in more complex code as to where exactly the unexpected "empty" dummy object originated from. An empty string is no different from any other empty object – it has no semantic value but is merely a meaningless stopgap. DON'T PRODUCE EMPTY OBJECTS!
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Loading more items...