We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 592863b + d299b21 commit 922e95fCopy full SHA for 922e95f
1 file changed
Problems/Mathematics/Day-02/sol/Avaneesh Verma/soln001.cpp
@@ -0,0 +1,40 @@
1
+#include<bits/stdc++.h>
2
+using namespace std;
3
+
4
+int main(){
5
+ int t;
6
+ cin >> t;
7
+ vector<int> results(t);
8
9
+ for(int i = 0; i < t; i++){
10
+ int n;
11
+ cin >> n;
12
13
+ vector<int> arr(n);
14
+ for (int j = 0; j < n; j++){
15
+ cin >> arr[j];
16
+ }
17
18
+ int max = 0;
19
+ for(int x = 0; x < n; x++){
20
+ for(int y = 0; y < n; y++){
21
+ if(abs(arr[x]-arr[y])>=max){
22
+ max=abs(arr[x]-arr[y]);
23
24
25
26
+ int count = 0;
27
28
29
+ if(abs(arr[x] - arr[y]) == max){
30
+ count++;
31
32
33
34
+ results[i] = count;
35
36
37
+ cout << results[i] << endl;
38
39
+ return 0;
40
+}
0 commit comments