Given an integer array and an integer $k$, we have to count the number of pairs of elements from the array whose bitwise OR is $k$ in $O(n)$ time complexity. How could this be done?

  • 1
    $\begingroup$ What did you try and where did you get stuck? $\endgroup$ – Juho Mar 2 '19 at 12:07
  • 1
    $\begingroup$ Equivalent: discuss.codechef.com/questions/79843/str-editorial $\endgroup$ – xskxzr Mar 2 '19 at 12:13
  • $\begingroup$ Can you credit the original source where you encountered this problem? $\endgroup$ – D.W. Mar 3 '19 at 19:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.