Amazon Interview Question
Software Engineer / DevelopersCountry: United States
Interview Type: In-Person
Other than design pattern, i can think of this problem as (undirected) graphical representation of different components. Such as "Motherboard" has edges to all CPUs it supports and then CPUs can have edges to all RAMs in turns that it supports and it goes on.
So when user first select "Motherboard", it display all CPUs in its adjacency list ( and can even filter down as other components along their children if needed).
Now User select particular CPU, then display all supported RAMs i.e all adjacent vertices.
Same way for reverse filtering..
I guess Observer design pattern will be helpful. CPU depends on mother board, Operating system depends on CPU architecture chosen, memory requirements depends on OS chosen and so on.
- Delta January 16, 2014