Java beats 100%, constant space
1.) Determine which key needs to be counted.\n2.) Simply count the ruleValue while iterating.\nNo need to store all key counts in maps.\n\n\tHashMap itemKey = n
1.) Determine which key needs to be counted.\n2.) Simply count the ruleValue while iterating.\nNo need to store all key counts in maps.\n\n\tHashMap<String, Integer> itemKey = new HashMap<>();\n    itemKey.put("type",0);\n    itemKey.put("color",1);\n    itemKey.put("name",2);\n   \n    int key = itemKey.get(ruleKey);\n    int count = 0;\n    \n    for(List<String> list:items){\n        if(list.get(key).equals(ruleValue)) count++;\n    }\n    \n    return count;
['Java']