i says that user user[i] opened page page[i] at time time[i]. The records come in no particular order.
A **route** is a list of three pages (repeats allowed). A user **followed** a route if that user's visits, sorted by time, contain those three pages in exactly that order. They do not have to be back to back; other pages may come in between. For example, ["home", "home", "home"] was followed by anyone who opened home at least three times.
The **score** of a route is the number of distinct users who followed it (each user counts once, however many times they followed it).
Return the route with the highest score. If several routes tie, return the lexicographically smallest one: compare the first pages, then the second ones, then the third.user=['ann', 'ann', 'ann', 'ben', 'ben', 'ben', 'ben'], time=[1, 2, 3, 4, 5, 6, 7], page=['news', 'shop', 'cart', 'news', 'blog', 'shop', 'cart'] → ['news', 'shop', 'cart']
Both users followed ["news", "shop", "cart"]: Ben read blog between news and shop, which does not matter. Every other route was followed by Ben alone.
user=['kim', 'kim', 'kim', 'kim'], time=[40, 10, 30, 20], page=['b', 'a', 'a', 'c'] → ['a', 'a', 'b']
The records are not in time order. Sorted, they read a → c → a → b. There are four routes, each with score 1, and the alphabetically smallest is ["a", "a", "b"].
user=['x', 'y', 'x', 'y', 'x', 'y'], time=[1, 2, 3, 4, 5, 6], page=['p', 'q', 'p', 'q', 'p', 'q'] → ['p', 'p', 'p']
User x only has p → p → p and user y only has q → q → q. The scores tie, so ["p", "p", "p"] wins.
user=['ann', 'ann', 'ann', 'ben', 'ben', 'ben', 'ben'], time=[1, 2, 3, 4, 5, 6, 7], page=['news', 'shop', 'cart', 'news', 'blog', 'shop', 'cart']
['news', 'shop', 'cart']
Run checks the first 3 tests in your browser. Submit checks all 52 tests on the server, hidden ones included.