注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
求大米! 谢谢!
题目:User Journey Paths (Action Log Trie Summary)
Background:
As we build product features, we want to understand how users interact with our platform — their "journey" through our offerings. The system emits logs showing actions taken by users. Build a summary showing unique action paths and how many users took each path.
Input
Logs in format:
100 1000 A
300 1150 A
200 1200 B
100 1200 B
100 1300 C
200 1400 A
300 1500 B
300 1550 B
100 1560 D
Per-user sequences (sorted by time ascending)
user 100: A -> B -> C -> D
user 200: B -> A
user 300: A -> B -> B
Expected output
Indented tree showing each unique path prefix and the count of distinct users who reached that node via that path:
A (2)
-> B (2)
-> C (1)
-> D (;Trie. Each node holds - {action, count, children}
复制代码 Walk the trie DFS with indentation + arrow prefix → output string个人经历 / Reflection
- Whatnot phone coding round (60 min)
- 题目本身概念清楚 (Trie + DFS print),但完整实现没做完 — Trie 插入和 DFS 打印逻辑没收尾
- 最后被拒
- 大概是: LC 208 (Implement Trie) + LC 211 (Add and Search Word)
|