We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
importjava.io.*;importjava.util.*;importjava.text.*;importjava.math.*;importjava.util.regex.*;publicclassSolution{publicstaticvoidmain(String[]args){Scanners=newScanner(System.in);intt=s.nextInt();String[]pair_left=newString[t];String[]pair_right=newString[t];for(inti=0;i<t;i++){pair_left[i]=s.next();pair_right[i]=s.next();}//Write your code hereSet<String>pairs=newHashSet<>();for(inti=0;i<t;i++){pairs.add((newStringBuilder().append(pair_left[i]).append(",").append(pair_right[i])).toString());System.out.println(pairs.size());}}}
Cookie support is required to access HackerRank
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 →