I am implementing a Java program using BitSets, and I am stuck in the following operation:
Given that N BitSets returns a BitSet with 0 if there is more than 1 in all bit sets, otherwise
As an example, suppose we have these 3 sets:
- 10010
- 01011
00111
11100 expected result
For the following sets:
- 10010
- 01011
- 00111
- 10100
00101
Expected Result 01000
I try to make it exclusive with a little wise operations, and I realized that what I need is literally exclusive or between all sets, but not in iterative mode, so I'm completely confused about what to do. Is it possible?
I wanted to avoid an expensive solution, to check every bit in every set and keep a counter for every position ...
Thanks for any help
: , , . -, , 1 1 , , , 1 ,