PracHub
QuestionsCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Whatnot

Count User Journey Prefixes

Last updated: Jun 18, 2026

Quick Overview

This question evaluates the ability to reconstruct per-user action sequences from timestamped logs, aggregate and count path prefixes, and apply data-structure and algorithmic reasoning within the Coding & Algorithms domain.

  • easy
  • Whatnot
  • Coding & Algorithms
  • Software Engineer

Count User Journey Prefixes

Company: Whatnot

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Take-home Project

You are given a list of user activity logs. Each log record has the form `[user_id, timestamp, action]`. Example input: ```text logs = [ [100, 1, "A"], [101, 2, "A"], [100, 3, "B"], [102, 4, "B"], [101, 5, "C"], [100, 6, "C"], [103, 7, "A"], [103, 8, "B"] ] ``` For each user, reconstruct that user's journey by ordering the actions by `timestamp`. Then aggregate all users' journeys and compute the count of every path prefix. Using the example above, the reconstructed journeys are: - `100 -> A, B, C` - `101 -> A, C` - `102 -> B` - `103 -> A, B` The aggregated prefix counts are: ```text A (3) B (2) C (1) C (1) B (1) ``` Explanation: - `A` appears as the first action for 3 users. - `A -> B` appears for 2 users. - `A -> B -> C` appears for 1 user. - `A -> C` appears for 1 user. - `B` appears as the first action for 1 user. Return the aggregated prefix counts in any reasonable structured format, such as a trie, nested map, or a list of prefixes with counts. Discuss the time and space complexity of your approach, and whether the trie can be updated while scanning the logs instead of first building full per-user action lists.

Quick Answer: This question evaluates the ability to reconstruct per-user action sequences from timestamped logs, aggregate and count path prefixes, and apply data-structure and algorithmic reasoning within the Coding & Algorithms domain.

Related Interview Questions

  • Content Safety Filter - Whatnot (medium)
  • Knight Dialer: Count Dialable Digit Sequences - Whatnot (medium)
  • Dot Product of Two Vectors (Dense, then Sparse) - Whatnot (medium)
  • Solve Adjacent-Deletion and Sorted-Square Problems - Whatnot (easy)
  • Build a Tic-Tac-Toe App - Whatnot (medium)
|Home/Coding & Algorithms/Whatnot

Count User Journey Prefixes

Whatnot logo
Whatnot
Apr 1, 2026, 12:00 AM
easySoftware EngineerTake-home ProjectCoding & Algorithms
9
0
Practice Read
Loading...

You are given a list of user activity logs. Each log record has the form [user_id, timestamp, action].

Example input:

logs = [
  [100, 1, "A"],
  [101, 2, "A"],
  [100, 3, "B"],
  [102, 4, "B"],
  [101, 5, "C"],
  [100, 6, "C"],
  [103, 7, "A"],
  [103, 8, "B"]
]

For each user, reconstruct that user's journey by ordering the actions by timestamp. Then aggregate all users' journeys and compute the count of every path prefix.

Using the example above, the reconstructed journeys are:

  • 100 -> A, B, C
  • 101 -> A, C
  • 102 -> B
  • 103 -> A, B

The aggregated prefix counts are:

A (3)
  B (2)
    C (1)
  C (1)
B (1)

Explanation:

  • A appears as the first action for 3 users.
  • A -> B appears for 2 users.
  • A -> B -> C appears for 1 user.
  • A -> C appears for 1 user.
  • B appears as the first action for 1 user.

Return the aggregated prefix counts in any reasonable structured format, such as a trie, nested map, or a list of prefixes with counts.

Discuss the time and space complexity of your approach, and whether the trie can be updated while scanning the logs instead of first building full per-user action lists.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Whatnot•More Software Engineer•Whatnot Software Engineer•Whatnot Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.