Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Log Parsing for Degradation Patterns
00:00
5 left

Log Parsing for Degradation Patterns

HardPython

Problem

Roblox infrastructure logs contain timestamped observations for multiple services. Identify every fixed-size window of consecutive observations for a service that indicates degradation because its error rate or average latency exceeds a configured threshold.

Each log line has the format timestamp service latency_ms status, separated by spaces. timestamp is an integer, service is a single word, latency_ms is a nonnegative integer, and status is either OK or ERROR. Logs may be unordered and may contain multiple services.

Implement detect_degradation(logs, window_size, error_percent, latency_threshold) and return a list of arrays [service, start_timestamp, end_timestamp]. Sort the result by service name, then by start timestamp. Windows may overlap. A window is degraded when its error percentage is at least error_percent or its average latency is at least latency_threshold.

Constraints

  • 1 <= len(logs) <= 10^5
  • 1 <= window_size <= len(logs)
  • 0 <= error_percent <= 100
  • 0 <= latency_threshold <= 10^9
  • Each service has a unique timestamp per observation
  • All log lines follow the specified format

Function Signature

def detect_degradation(logs, window_size, error_percent, latency_threshold):
Interviewer

Your question is Log Parsing for Degradation Patterns. Start with the requirements in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePython 3
Sign up free to run your codeLog inLn 2
Run your code to see test output here.