Stripe OA 面试真题解析:按属性匹配、加权匹配与间接关联商户

57次阅读
没有评论

Part 1 – Direct links: Given a target merchant, return every merchant that shares at least one identical attribute value with it.

Part 2 – Confidence scores: Assign weights to matching fields and return merchants whose total matching score reaches the required threshold.

Part 3 – Indirect links: Return merchants directly linked to the target and merchants linked through one directly linked merchant.

这道题本质上是在商户关系图和属性匹配规则上做检索:第一部分可以先用哈希表按属性值建索引,快速找到与目标商户共享至少一个相同属性的商户;第二部分把“是否匹配”升级为带权重的打分问题,需要累计各字段的匹配分并筛选达到阈值的商户;第三部分则更像图遍历,先找出与目标直接相连的商户,再从这些一跳邻居继续扩展一层,得到两跳范围内的结果。实现时通常会结合倒排索引、哈希集合去重,以及 BFS 或分层遍历来控制搜索范围。

正文完
 0