• + 0 comments

    If you got a problem with the test case 5 try with lexicographic order:

     Set<String> hs = new HashSet<>();
            for (int i = 0; i < t; i++) {
                String first = pair_left[i];
                String second = pair_right[i];
    
                if (first.compareTo(second) > 0) {
                    String temp = first;
                    first = second;
                    second = temp;
                }
    
                hs.add(first + "," + second);
                System.out.println(hs.size());
            }