Facebook | Phone Interview - Screening Round | UI Enterprise Engineer | London
Company: Meta (Facebook)
Role: UI Enterprise Engineer
Interview Stage: Phone Interview - Screening Round
Location: London
Year: unknown
Original Post Content:
Given two arrays items and excludes, write a function to filter items array using excludes items.
The filter function should take O(n) as time complexity.
Example:const items = [ {type: "mobile", model: "iPhone", color:"silver"}, {type: "mobile", model: "iPhone", color:"grey"},{type: "mobile", model: "Samsung", color:"silver"},{type: "mobile", model: "Samsung", color:"blue"}, {type: "mobile", model: "LG", color:"silver"}, {type: "mobile", model: "LG", color:"gold"}]
const excludes= [ {k: "mobile", v: "LG"}, {k: "color", v:"silver"}]
outputconst items = [ {type: "mobile", model: "iPhone", color:"grey"},{type: "mobile", model: "Samsung", color:"blue"}]