Execution Timer Wrapper
A medium Python mock interview question on DataDriven. Practice with AI-powered feedback, real code execution, and a hire/no-hire decision.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L6
Interview Prompt
Implement make_timed(fn) that returns a wrapper which invokes fn with any positional and keyword args, measures elapsed seconds, and returns fn's return value unchanged (timing is not verified by tests). Also implement run_timed(fn, args=(), kwargs=None): given fn as a lambda source string, args list, and kwargs dict, eval the source into a callable, wrap it with make_timed, invoke it with the given args/kwargs, and return the result.
Summary
Function wrapped with a timer. Duration captured on exit.
How This Interview Works
- Read the vague prompt (just like a real interview)
- Ask clarifying questions to the AI interviewer
- Write your python solution with real code execution
- Get instant feedback and a hire/no-hire decision