#3674

Minimum Operations to Equalize Array

pupil · 390 · lc easy +24 · 60.1% accepted · 58 likes · top 58%

Description

An integer array nums is given. In each operation, pick any contiguous subarray and replace every element in it with the bitwise AND of all elements in that subarray. Return the minimum number of such operations needed to make all elements of nums equal.

Code

1
2
3