tautology's blog

By tautology, history, 6 years ago, In English

Given array of n non-negative integers and a positive integer k. Is is possible to count all pairs with bitwise-OR equals to k?. Time complexity should be better than O(n^2). More formally , count no. of distinct pairs (ai,aj) such that ai|aj==k.[Note: pairs (ai,aj) and (aj,ai) are same.] If this is possible in T(n)<O(n^2),then how? Constraints: 1<=n<=1000000, 0<=ai<=10000.

  • Vote: I like it
  • -29
  • Vote: I do not like it