You are viewing a single comment's thread. Return to all comments →
I think this code works but it gives the Time limit exceeded error.
int count =0; for(int i = 0 ; i < t ; i++){ count++; for(int j = i-1 ; j >= 0 ; j--){ if(pair_left[i].equals(pair_left[j]) && pair_right[i].equals(pair_right[j])){ count--; break; } } System.out.println(count); }
Seems like cookies are disabled on this browser, please enable them to open this website
Java Hashset
You are viewing a single comment's thread. Return to all comments →
I think this code works but it gives the Time limit exceeded error.
int count =0; for(int i = 0 ; i < t ; i++){ count++; for(int j = i-1 ; j >= 0 ; j--){ if(pair_left[i].equals(pair_left[j]) && pair_right[i].equals(pair_right[j])){ count--; break; } } System.out.println(count); }