Minimum Bitwise OR operations to make any two array elements equal

Given an array of integers and an integer K, we can perform the Bitwise OR operation between K and elements of the array any number of times.


We have to count minimum number of such operations that are required to make any two elements of the array equal. If, even after performing such operations, it is not possible to make any two elements of the array equal, then print "Not Possible".


Examples:


Example Input 1:

K = 4

n = 5

arr = [1, 1, 2, 2, 3]

Example Output 1:

Minimum Operations are: 0

(Sinc...

 •  0 comments  •  flag
Share on Twitter
Published on August 28, 2020 16:09
No comments have been added yet.