Search⌘ K
AI Features

Maximize Greatness of an Array

Try to solve the Maximize Greatness of an Array problem.

We'll cover the following...

Statement

You are given an integer array nums. You may rearrange the elements of nums to form another array perm of the same length.

Define the greatness of perm as the number of indices i such that perm[i] > nums[i]. Return the maximum possible greatness over all rearrangements perm of nums.

Constraints:

  • ...