Company: IBM_._
Difficulty: medium
Women in Tech Problem Description An aspiring programmer is preparing for a coding competition and encounters a problem: finding the minimum number of operations required to make all integers in an array equal. In a single operation, any bit of any element can be flipped. Determine the minimum number of bit flip operations required to make all array elements equal. Examples Example 1 Input: n = 2, arr = [1, 2] Output: 2 Explanation: Optimal Operations: Operation Count Flips arr 0 - [1, 2] 1 1(01) -> 3(11) [3, 2] 2 2(10) -> 3(11) [3, 3] In one operation, the second bit of 1(01) can be flipped to make it 3(11). In the next operation, 2(10) can be made equal to 3(11) by flipping the first bit. The array becomes [3, 3] in two operations, which is the minimum required. Function Description Complete the function getMinOperations in the editor with the following parameters: int arr[] : the input array Returns int : the minimum number of operations required