bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
MediumArrays & HashingLC 1152

Analyze User Website Visit Pattern

You are given two string arrays username and website and an integer array timestamp. All the given arrays are of the same length and the tuple [username[i], website[i], timestamp[i]] indicates that the user username[i] visited the website website[i] at time timestamp[i]. A pattern is a list of three websites (not necessarily distinct). For example, [ "home ", "away ", "love "], [ "leetcode ", "love ", "leetcode "], and [ "luffy ", "luffy ", "luffy "] are all patterns. The score of a pattern is the number of users that visited all the websites in the pattern in the same order they appeared in the pattern.

Asked at 1 company
Amazon
Hints
  • 1.Think about which data structure fits best
  • 2.Consider the time complexity of your approach
  • 3.Look for patterns in the constraints
LeetCode