We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I did it this way as well (63-bit longs), although I knew about BitSet. I thought using a standard 2D array of longs would be faster than an ArrayList of BitSets, and after trying both implementations I found it was - but only for the smaller test cases. It was pretty much equal for the longer ones at 0.25-0.30s (I'm guessing this is what people refer to as the JVM "warming up").
For anyone wondering which to use: save yourself the trouble of reinventing the wheel, and stick to BitSets.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
ACM ICPC Team
You are viewing a single comment's thread. Return to all comments →
I did it this way as well (63-bit longs), although I knew about BitSet. I thought using a standard 2D array of longs would be faster than an ArrayList of BitSets, and after trying both implementations I found it was - but only for the smaller test cases. It was pretty much equal for the longer ones at 0.25-0.30s (I'm guessing this is what people refer to as the JVM "warming up").
For anyone wondering which to use: save yourself the trouble of reinventing the wheel, and stick to BitSets.