Company: Amazon__
Difficulty: medium
Minimum Security Groups Problem Description A financial services company has requested AWS for a private deployment of its cloud network. Considering the sensitive nature of the company's business, AWS has also advised them to add a specific type of security system. Overall, there are n servers in the network where the security needs of the i^th server are represented by security[i], where each element represents the grade of security needed for a server. To ensure the highest possible protection, the AWS security team has recommended the following rules to be followed while designing the security system: - All servers in a security group must have the same grade of security needs. - The number of servers in any two security groups should not differ by more than 1. Given an integer array security, find the minimum number of groups needed to ensure the protection of the network. Examples Example 1 Input: n = 6, security = [2, 3, 3, 3, 2, 1] Output: 4 Explanation: The elements can be gro