How do you approach debugging a complex issue in a production environment where latency and accuracy are critical?
For this coding exercise, implement a diagnostic scan over ordered request observations. Return each request ID once, in first-seen order, if any observation exceeds the latency limit or has different expected and observed values. The function receives a list of observation objects and an integer latency limit.
Function signature: def find_anomalies(observations, latency_limit):. Each observation has request_id, latency, expected, and observed; return a list of request IDs.
def find_anomalies(observations, latency_limit):