MEDIUMasked at 1 company

Get Watched Videos by Your Friends

A medium-tier problem at 50% community acceptance, tagged with Array, Hash Table, Breadth-First Search. Reported in interviews at Guidewire and 0 others.

Founder's read

You're looking at a graph traversal problem that sounds simple but trips people up on the live assessment. Get Watched Videos by Your Friends comes down to BFS through a social network, then sorting the results correctly. It's been asked at Guidewire and has a 50% acceptance rate, which means half the candidates who sit down to solve it blank on either the traversal order or the tiebreaker logic. This is exactly where StealthCoder steps in. If you hit this problem on your OA and the sorting constraint catches you off guard, StealthCoder runs invisibly and surfaces the working solution in seconds.

Companies asking
1
Difficulty
MEDIUM
Acceptance
50%

Companies that ask "Get Watched Videos by Your Friends"

If this hits your live OA

Get Watched Videos by Your Friends is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by a working FAANG engineer who treats the OA the way companies treat hiring: as a game with rules you should know.

Get StealthCoder
What this means

The trap here is thinking this is just a graph problem. It is, but the real work happens after BFS. You need to traverse friends at exactly distance 1, collect all videos they've watched that you haven't, then sort by frequency first, then lexicographically. Most candidates handle BFS fine. They break on the sort. The obvious approach fails because you can't just iterate and count. You need a hash table to track video frequencies as you traverse, then sort the result set by two criteria in the right order. The graph part is straightforward (adjacency list or dictionary of friends), but the data structure discipline around sorting is what separates pass from fail. Array, Hash Table, and Sorting are all mandatory. If you've drilled BFS but skipped multi-key sorts, you're vulnerable on test day.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Get Watched Videos by Your Friends recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by a working FAANG engineer who treats the OA the way companies treat hiring: as a game with rules you should know. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Get Watched Videos by Your Friends interview FAQ

Is this actually a hard problem or does it just feel that way?+

Medium difficulty with 50% acceptance tells you the implementation is straightforward but the sort logic trips people. BFS itself is rote. The problem is remembering to sort by frequency descending, then title ascending. That dual-key sort is where mistakes happen under time pressure.

Do I need to handle cycles in the friend graph?+

Yes. A friend graph can have cycles (mutual friendships). BFS naturally handles that if you track visited friends. Hash table for visited set is standard. Miss that and you'll loop infinitely or double-count videos.

What's the trick to getting the sort right?+

Collect videos in a hash table while doing BFS to count frequencies. After BFS completes, sort the video list by frequency descending, then alphabetically ascending for ties. Most languages have multi-key sort built in. Use it.

How often does Guidewire ask graph problems?+

Guidewire is the only company in the reported data for this problem, so frequency is limited. That doesn't mean it won't show up. Treat it as a live possibility if you're interviewing there.

Can I use DFS instead of BFS?+

Technically yes, but BFS is cleaner because you only need immediate friends (distance 1). DFS works but you'd have to track depth and filter. BFS is the natural choice and what the problem expects.

Want the actual problem statement? View "Get Watched Videos by Your Friends" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.