Problem · Hash Table
Stream Latest Log Versions
Problem statement
Process a finite sequence of log-stream operations from left to right. Each log is a pair containing an integer timestamp and a message. At most one version of each message is pending at a time.
The problem statement continues
ProExamples
Example 1
operations = ["add","add","add","get","get","add","get"]timestamps = [5,8,3,0,0,2,0]messages = ["build","build","deploy","","","build",""]return = ["3|deploy","8|build","2|build"]The timestamp 8 version replaces build at timestamp 5. The first two results are therefore 3|deploy and 8|build. Once build is returned, adding it at timestamp 2 starts a new lifecycle.
FastPrep Pro
Reported in 1 Google interview this weekUnlock this recently reported problem
FastPrep Pro gives you full access to interview problems reported within the last week.
- Full problem statement and constraints
- 1 more worked example, explained
- Guided hints and editorial
- Run your code on real test cases
$9/month
Pro subscription, billed yearly — or $19 month-to-month. Cancel anytime.
Free plan — 2 of 2 free unlocks used this week