products[i] = [type, color, name].
A shopper turns on a filter: the field field (one of "type", "color" or "name") must equal the string value. A product passes the filter when its value in that field matches value exactly.
Return the number of products that pass the filter.products=[['mug', 'white', 'classic'], ['lamp', 'green', 'nordic'], ['mug', 'green', 'tall']], field="color", value="green" → 2
The lamp and the tall mug are green, so 2 products match.
products=[['sofa', 'grey', 'corner'], ['chair', 'grey', 'sofa']], field="type", value="sofa" → 1
Only the first product has type "sofa". For the second one "sofa" is the name, but the filter checks the type.
products=[['desk', 'oak', 'loft']], field="name", value="studio" → 0
No product is named "studio", so the answer is 0.
products.length ≤ 10⁴products[i].length = 3products[i], and value, has length from 1 to 30field is "type", "color" or "name"field consist of lowercase English letters, digits, spaces and the characters -, _, &products=[['mug', 'white', 'classic'], ['lamp', 'green', 'nordic'], ['mug', 'green', 'tall']], field="color", value="green"
2
Run checks the first 3 tests in your browser. Submit checks all 108 tests on the server, hidden ones included.