Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Implementation in python 3.9.1 . F. Equalize the Array time limit per test 2 seconds memory limit per test 256 megabytes input standard input output
Implementation in python 3.9.1
. F. Equalize the Array time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Polycarp was gifted an array a of length 1. Polycarp considers an array beautiful if there exists a number C such that each number in the array occurs either zero or C times. Polycarp wants to remove some elements from the array a to make it beautiful. For example, if n = 6 and a = [1, 3, 2, 1, 4, 2], then the following options are possible to make the array a array beautiful: Polycarp removes elements at positions 2 and 5 array a becomes equal to 1, 2, 1, 2]; Polycarp removes elements at positions 1 and 6 array a becomes equal to 3, 2, 1, 4); Polycarp removes elements at positions 1, 2 and 6 array a becomes equal to 2, 1, 4); Help Polycarp determine the minimum number of elements to remove from the array a to make it beautiful. Input The first line contains one integert (1Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started