OpenAI

Verified interview challenge

Build follow graph snapshots

Keep historical versions of a social graph queryable while users continue following and unfollowing each other.

Unlock with Full Access

The challenge

Process updates to a directed follow graph and freeze snapshots of its state. Queries ask about relationships and recommendations at a particular snapshot. Later changes must leave those historical results intact, including the ordering of recommendation results.

What you'll practise

  • Historical state

    Preserve the graph at each snapshot while continuing to update the live version.

  • Directed relationships

    Keep followers and followees distinct across updates and historical queries.

  • Recommendations

    Rank candidates from the selected snapshot using the supplied scoring and tie rules.

Your coding workspacePreview
solution.pyPython 3.13
def follow_graph_results(
    operations
):
    # Your implementation goes here
    pass
Test cases

Run your code to see results.

Full instructions, starter code and test cases included with Full Access.