You are given an integer array nums and an integer k.
An integer h is considered valid if all elements in nums that are strictly greater than h are equal to each other.
In one operation, you can:
Select a valid integer h.
Change every element in nums that is strictly greater than h to h.
Return the minimum number of operations required to make all elements in nums equal to k, or
Constraints:
nums.length
nums[i]
k
You are given an integer array nums and an integer k.
An integer h is considered valid if all elements in nums that are strictly greater than h are equal to each other.
In one operation, you can:
Select a valid integer h.
Change every element in nums that is strictly greater than h to h.
Return the minimum number of operations required to make all elements in nums equal to k, or
Constraints:
nums.length
nums[i]
k