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 'V' server are represented by the securityill, where each element represents the grade of security needed for a server. To ensure the highest protection possible, the AWS security team has recommended that the following rules be followed while designing the security system: All servers in a security group must have the same grade of security needs, and 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 security levels needed to ensure the protection of the network.
Consider n = 6, security = [2, 3, 3, 6, 2, 2]. Then, the elements can be grouped as follows:
It requires 4 groups.
Hard