This is a verified interview question from Goldman-sachs. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Error Monitoring System - IIT Roorkee Guwahati Goldman Sachs Online Assessment SDE Role" covers key patterns like Other.
"### Problem A monitoring system records the status of different services. You are given a sequence of log entries. Each entry is represented as: <service_name> <status> where: - service_name is a string identifying the service. - status is either "success" or "error". For every service, maintain the number of consecutive "error" logs since its last "success" or alert. Whenever a service accumulates 3 consecutive errors, an alert is triggered immediately, and its consecutive error count is reset to 0. Your task is to determine the total number of alerts generated. ### Input N service1 status1 service2 status2 ... serviceN statusN ### Output Print a single integer — the total number of alerts generated."
Join thousands of developers practicing for Goldman-sachs.