Problem · Array
Profiling Events from Consecutive Stack Samples
Problem statement
A sampling profiler records the active call stack at strictly increasing timestamps. You are given parallel arrays:
The problem statement continues
ProExamples
Example 1
timestamps = [10,20,30,40,50]stacks = [["main"],["main","parse"],["main","parse"],["main"],["main"]]n = 2return = [["start","20","main"],["start","30","parse"],["end","40","parse"]]main is confirmed at timestamp 20. parse is confirmed at 30 and ends when it is absent at 40. No final end is synthesized for main.
FastPrep Pro
Reported in 1 Anthropic 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