eBay phone screen, product recs question + scale follow up
eBay phone screen, product recs question + scale follow up
Had my eBay phone screen Tuesday for a backend SWE role. One coding question plus a scale discussion, about 60 min total. Still waiting to hear back.
Coding was the product recommendation one. You get a bunch of user browsing sessions, each session is a list of product IDs, and a target product. Find the other products that show up in the same sessions as the target most often and return the top K. I did a frequency map first, then a heap, and the interviewer asked if I could beat n log k. Switched to bucket sort since the counts can't go above the number of sessions. He seemed ok with it. Edge cases he poked at: target showing up twice in one session, and K bigger than the number of candidates.
Last 20 min or so was how would you run this as a real service for millions of users. I talked about precomputing co-occurrence counts offline in batch jobs, keeping a top K list per product in a cache, and updating it from a stream instead of recomputing everything. He pushed on hot products and how fresh the data needs to be. Don't think I nailed the freshness part tbh.
Heads up, he asked if I was ok writing Java. I said I'd prefer Python and he let it go, but sounds like a lot of their stack is Java.