Your question is Graph Traversal for Interactions. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Coalition Technologies models relationships between users and items in an interaction graph. Given user-item interactions and a starting user, return every reachable user in breadth-first search order.
Treat each interaction [user, item] as an undirected edge between a user node and an item node. A user is reachable if a path from the starting user alternates through users and items. Return each reachable user once, including the starting user. The order must follow BFS discovery order, and neighbors must be processed in the same order their edges first appear in interactions.
Implement connected_users(interactions, start_user).
interactions is a list of two-element lists of strings, where each pair contains a user ID and an item ID.start_user is a string identifying a user present in interactions.def connected_users(interactions, start_user):