Amazon OA 面试真题解析:按类目、价格与 Prime 条件设计商品搜索系统

18次阅读
没有评论

Amazon products are stored hierarchically within their respective categories.

Products have various metadata, such as current price and whether they are Prime-eligible. For example, a dress might be located under Clothing > Women > Dresses, with a price of 20 and Prime eligibility enabled.

It should be easy to add additional criteria to search by in the future.

Initially, the system only needs to handle queries by category or max price.

这道题本质上是在设计一个可扩展的商品检索系统:商品按类目树层级组织,同时还带有价格、Prime 是否可用等元数据。当前只要求支持按类目和最高价格过滤,因此可以重点考虑如何高效表示分类层级,以及如何在查询时组合多个条件。实现时通常会用树或字典结构管理类目路径,再配合按价格排序的数据结构来完成筛选;如果题目后续扩展到更多条件,还需要把过滤逻辑设计成可插拔的规则组合。

正文完
 0