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.
publicstaticList<Integer>matchingStrings(List<String>stringList,List<String>queries){// Write your code hereintquerySize=queries.size();Integer[]result=newInteger[querySize];for(inti=0;i<querySize;i++){result[i]=0;for(StringsourceText:stringList){if(sourceText.equals(queries.get(i))){result[i]++;}}System.out.println(result[i]);}returnArrays.asList(result);}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sparse Arrays
You are viewing a single comment's thread. Return to all comments →
solution using java 8