Given a list of strings, I want to find the number of bit-masks, I want to find the number of pairs where bit-mask1 & bit-mask2 = 0
.
This problem was given in an intra-school contest at my school for class 12 students. I happened to get the question paper and this was the toughest problem.
I tried a bit, but could not find any answer.
I thought of converting it into a string and then using a suffix tree, but due to lack of knowledge in that particular data structure, I could not get any solution.
By the way, by the data constraints,(up-to 10^5
bit-masks), I think the solution should be of O(n logn)
. We consider un-ordered pairs only.
Asked
Active
Viewed 30 times
1

venkatvb
- 681
- 1
- 9
- 24

Rajarshi basu
- 330
- 1
- 10
-
Can you give an example? – venkatvb Aug 18 '16 at 13:53
-
Just an idea, you can use [Trie tree](https://en.wikipedia.org/wiki/Trie) – venkatvb Aug 18 '16 at 13:55