Question bank › Hashing
Dsa Hashing Medium

User Behavioral Triplets

An analytics engine tracks user actions. For every user, actions are recorded in order. A 'triplet' is a sequence of three consecutive actions performed by the same user. Find the most frequent triplet across all users. If there is a tie, print the one that is lexicographically first. Triplets are represented as space-separated strings. Input Format: First line is N, the number of log entries. The next N lines each contain 'username action'. Output Format: Print the three actions of the most frequent triplet separated by spaces. Example: Input: 9 alice login alice view alice logout bob login bob view bob logout alice login alice search alice buy Output: login view logout

Key concepts

hashingfrequency-mapsn-grams

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.