Facebook | Phone Interview - Screening Round | UI Enterprise Engineer | London
Anonymous User
657

Given two arrays items and exculdes write a function to filter items array using array exculdes 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"}]

output
const items = [ {type: "mobile", model: "iPhone", color:"grey"},{type: "mobile", model: "Samsung", color:"blue"}]

Comments (3)