Atlassian Interview question | Online Assesment | XOR Frequency
Anonymous User
513

Given an array arr of postive integers and an integer val. We can perform the following operation on the given array at most once. The operation is as follows.

  • choose two indices left and right that left<=right and right<=n(1- based indexing)
  • For each value in the given range of indices left and right, bit wise xor each of them with m(m is a non negative integer which you can choose as per your subbarray). More formally nums[i] will change to (nums[i] xor m)

Find the maximum possilbe frequency of val after performing the operation at most once.

Comments (1)