This is a verified interview question from Lseg---london-stock-exchange. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Service Anomaly Rate Detection - LSEG London Stock Exchange Online Assessment RNSIT" covers key patterns like Arrays.
"Write `solution(services, lambdaScaled, observed)`. Given monitored service names, expected failure rates (scaled ×1,000,000), and observed failure counts, return the services that breach a simple anomaly rule. `lambda[i] = lambdaScaled[i] / 1,000,000`. `z = average(lambda values across all services) / 3`. For each service: `threshold = lambda + z * sqrt(lambda)`. A service breaches if `observed > threshold`. Return breaching service names sorted by exceed amount (`observed − threshold`) descending; ties broken alphabetically. Empty array if none breach. **Example** ``` services = ["PRICING", "NEWS", "FEEDS"] lambdaScaled = [4000000, 9000000, 1000000] observed = [9, 13, 2] ``` lambda = [4, 9, 1]; average = 4.6667; z = 1.5556. - PRICING: threshold = 4 + 1.5556×2 = 7.1112; 9 > 7.1112 → breach. - NEWS: threshold = 9 + 1.5556×3 = 13.6668; 13 < 13.6668 → no breach. - FEEDS: threshold = 1 + 1.5556×1 = 2.5556; 2 < 2.5556 → no breach. Output: `["PRICING"]` ---"
Join thousands of developers practicing for Lseg---london-stock-exchange.