Amazon interview : design Generic Filter

Coding (Logical and Maintainable):
We have e DB of employees, which can be represented as an in-memory Map of EmployeeID->Employee Object

Class Employee {
String name,
String org,
int exp, //Experience in Years
boolean isManager
}

Map<Integer, Employee>
{
1: {“Adam”, “Sales”, 5, false},
2: {“Bob”, “Marketing”, 7, true},
3: {“Charles”, “Sales”, 2, false},
4: {“David”, “Sales”, 10, true},


}

Write a library/function which returns the IDs of all employees that are in Sales, not managers, with >5 years of experience.
This is just one use-case, make the library flexible so that it can also serve other use-cases.

Filter --> EmployeeName
Filter --> EmployeeOrg
Filter --> EmployeeExp
Filter --> EmployeeMgr

Comments (4)