You are viewing a single comment's thread. Return to all comments →
public static int solve(List V) { int n=V.size(),c=0; int x = 2*n/2*(n-n/2)*100000; Collections.sort(V);
for(int i=0;i<n-1;i++) { if(V.get(i+1)-V.get(i) == 1) { c++; i++; } } if(V.get(n-1) - V.get(0) == 1) c++; x+=c; return x*2;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Ants
You are viewing a single comment's thread. Return to all comments →
public static int solve(List V) { int n=V.size(),c=0; int x = 2*n/2*(n-n/2)*100000; Collections.sort(V);
}