Sparse Arrays

  • + 0 comments

    Java:

    public static List matchingStrings(List strings, List queries) { // Write your code here

    List result = new ArrayList<>();

    for (String string : queries) {

    int counter = 0;
    
    for (String seek : strings) {
    
        if(seek.equals(string)){
            counter ++;
        }
    
    }
    
    result.add(counter);
    

    }

    return result;
    
    
    }
    

    }