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.
actually whenever a program runs for the first time then static scope is runned once so it's used for initiallization. However if the program runs again then this static block will be skipped so yeah it good to use this.
Help us help you. Tell us which language you're having this problem with. Also, post your code as a spoiler, otherwise we can't very well tell what's going wrong where.
Closing.
did not know about the static block to initilize the elements, not sure if its best practice, but much shorter and cleaner than mine.
This comment is hidden because it contains spoiler information about the solution
Not best practice. What if array2 is empty or not the same size as array1? this solution would crash.
I like this. clever use of the bit-wise operator.
I agree. very nice and simple solution. I thought this would have been mostly quadratic run time.
Could you please show the code you have written. The error might be caused by which array you have returned.
thanks for the comment.
i think something is still wrong with the Randomtest.
the way i'm doing mine, its telling me that i failed, but the output is right.
RandomTests(ReverseTest)
Log
before:
10011001 10111010
after:
10111010 10011001
✘ arrays first differed at element [2]; expected:<1> but was:<0>
please check. it looks like its not reading the array i'm returning, but instead reading the original array.