You are viewing a single comment's thread. Return to all comments →
I never work with hashSet, it my solution
HashSet temp = new HashSet(); int check = 1; temp.add(pair_left[0]+"_"+pair_right[0]); for (int i =0 ; i<t ;i++){ int beforeSize = temp.size(); temp.add(pair_left[i]+"_"+pair_right[i]); int afterSize = temp.size(); if(beforeSize != afterSize){ check++; } System.out.println(check); }
But your solution is better than me . Thanks ^^
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 never work with hashSet, it my solution
But your solution is better than me . Thanks ^^