← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
You are given a list of stack samples captured by a sampling profiler. Each sample is a tuple (timestamp, stack) where stack is a list of function names ordered from outermost to innermost. Consecutive samples often repeat the same stack prefix, so we compress the data into a tree: each node represents a function call and holds the total time it was on the stack (sum of sample deltas while it was present). After the tree is built, filter it with a duration threshold T. A node is kept if its total duration ≥ T OR any descendant is kept. Finally, print the surviving calls in a depth-first traversal with indentation proportional to depth.