You are viewing a single comment's thread. Return to all comments →
java 8 Collections.sort(ar); int count = 0; int temp = 0; for(int i = 0; i < n; i++){
if(temp == ar.get(i)){ temp = 0; continue; } temp = ar.get(i); if((i + 1) < n && temp == ar.get(i + 1)){ count++; } } return count;
Seems like cookies are disabled on this browser, please enable them to open this website
Sales by Match
You are viewing a single comment's thread. Return to all comments →
java 8 Collections.sort(ar); int count = 0; int temp = 0; for(int i = 0; i < n; i++){