MEDIUMasked at 5 companies

Exclusive Time of Functions

A medium-tier problem at 65% community acceptance, tagged with Array, Stack. Reported in interviews at IBM and 4 others.

Founder's read

Exclusive Time of Functions is a medium-difficulty problem that asks you to calculate how much time each function actually spent executing, given a log of function calls and returns. It shows up in assessments at Meta, LinkedIn, IBM, and other major companies. The trap is that naive iteration fails because you need to account for time spent inside nested function calls. If you hit this during your live OA and the overlap logic isn't clicking, StealthCoder surfaces a working solution in seconds, invisible to the proctor.

Companies asking
5
Difficulty
MEDIUM
Acceptance
65%

Companies that ask "Exclusive Time of Functions"

If this hits your live OA

Exclusive Time of Functions is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE.

Get StealthCoder
What this means

The trick is using a stack to track which function is currently running. When a function starts, push it. When it ends, pop it and add the elapsed time to its total, then subtract that time from the previously running function. The common mistake is trying to track time linearly without accounting for nesting. You'll see 'exclusive time' phrased as 'time spent not in any child call', which is the exact problem the stack solves. Many candidates overthink timestamp calculations instead of thinking about function depth. This is where the pattern matters more than raw implementation. StealthCoder is your hedge if the stack logic doesn't materialize during the live assessment.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Exclusive Time of Functions recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Exclusive Time of Functions interview FAQ

How hard is this compared to other stack problems?+

It's solidly medium. If you're comfortable with basic stack push/pop, the logic is manageable. The difficulty comes from tracking intervals and overlaps cleanly, not the data structure itself. It's easier than something like Largest Rectangle in Histogram but harder than simple parentheses matching.

Is this still asked at Meta and LinkedIn?+

Yes. It appears in their recent OA reports consistently. Meta and LinkedIn both use it. It's less about a specific algorithm and more about testing whether you can model a system with a stack under time pressure.

What's the key insight I'm missing if I get stuck?+

Stop thinking about absolute time. Instead, think about the current function and the one before it. When the current function ends, the previous function resumes. A stack naturally models this. Once you see nesting as depth, not time, the solution clicks.

Can I solve this with just an array and no stack?+

Technically yes, but you'd be rebuilding a stack manually with array indexing. Using an actual stack is cleaner and makes your logic much easier to follow during an interview. Clarity under pressure matters.

How does this relate to tree/recursive problems?+

Function calls form a call tree. This problem is tree traversal disguised as log parsing. If you're weak on recursion or DFS, this will feel harder. Understanding function depth is the bridge between the two concepts.

Want the actual problem statement? View "Exclusive Time of Functions" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.