aboutsummaryrefslogtreecommitdiff
path: root/codechef/makeAllEqual
diff options
context:
space:
mode:
Diffstat (limited to 'codechef/makeAllEqual')
-rw-r--r--codechef/makeAllEqual/inp0
-rwxr-xr-xcodechef/makeAllEqual/mainbin0 -> 51768 bytes
-rw-r--r--codechef/makeAllEqual/main.cpp25
-rw-r--r--codechef/makeAllEqual/main_input0.txt9
-rw-r--r--codechef/makeAllEqual/main_output0.txt4
5 files changed, 38 insertions, 0 deletions
diff --git a/codechef/makeAllEqual/inp b/codechef/makeAllEqual/inp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/codechef/makeAllEqual/inp
diff --git a/codechef/makeAllEqual/main b/codechef/makeAllEqual/main
new file mode 100755
index 0000000..ab81d7d
--- /dev/null
+++ b/codechef/makeAllEqual/main
Binary files differ
diff --git a/codechef/makeAllEqual/main.cpp b/codechef/makeAllEqual/main.cpp
new file mode 100644
index 0000000..fee0ae9
--- /dev/null
+++ b/codechef/makeAllEqual/main.cpp
@@ -0,0 +1,25 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int main () {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while(tt--){
+ int n;
+ cin >> n;
+ vector<int> v(n);
+ map<int, int> mp;
+ for(int &x : v) cin >> x;
+ for(int i = 0; i < n; i++) {
+ mp[v[i]]++;
+ }
+ int mx = 0;
+ for(auto p : mp) {
+ mx = max(p.second, mx);
+ }
+ cout << n - mx << endl;
+ }
+}
diff --git a/codechef/makeAllEqual/main_input0.txt b/codechef/makeAllEqual/main_input0.txt
new file mode 100644
index 0000000..b0028ee
--- /dev/null
+++ b/codechef/makeAllEqual/main_input0.txt
@@ -0,0 +1,9 @@
+4
+3
+1 2 3
+4
+5 5 5 5
+4
+2 2 1 1
+3
+1 1 2
diff --git a/codechef/makeAllEqual/main_output0.txt b/codechef/makeAllEqual/main_output0.txt
new file mode 100644
index 0000000..181282f
--- /dev/null
+++ b/codechef/makeAllEqual/main_output0.txt
@@ -0,0 +1,4 @@
+2
+0
+2
+1