Oracle software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.
+ and -, and parentheses ( and ), simplify...Input: Stringkind and at; at is an ingestion or query time in integer seconds. Records arrive in nondecreasing at order and are processed in list order when times tie.event also has eventId, timestamp, compartment, service, and status. Its event timestamp may arrive out of order but never exceeds at. Only HTTP statuses from 500 through 599, inclusive, count as errors.eventId: only its first occurrence has any effect, even if that occurrence is successful or already expired. Later occurrences never replace it.service_5m. At query time t, count errors in the exact interval (t - 300, t], grouped by (compartment, service).alert to true exactly when the group's count is at least 3.query record has only kind and at. Produce one result per query, in input order. Events produce no result. Advance time and expire old errors before processing every record.analyze(records: list[dict[str, str]]). The return type is up to the candidate; the examples define its required logical contents using JSON. Output timestamps and counts are integers.{
"records": [
{"kind":"event","at":"0","eventId":"a","timestamp":"0","compartment":"A","service":"api","status":"500"},
{"kind":"event","at":"100","eventId":"b","timestamp":"100","compartment":"A","service":"api","status":"503"},
{"kind":"event","at":"200","eventId":"c","timestamp":"200","compartment":"A","service":"api","status":"502"},
{"kind":"event","at":"250","eventId":"d","timestamp":"250","compartment":"A","service":"worker","status":"500"},
{"kind":"event","at":"260","eventId":"e","timestamp":"260","compartment":"A","service":"worker","status":"200"},
{"kind":"query","at":"299"}
]
}[
{"at":299,"leaders":[
{"entity":{"compartment":"A","service":"api"},"errors":3,"alert":true},
{"entity":{"compartment":"A","service":"worker"},"errors":1,"alert":false}
]}
](-1, 299]. The API has 1 + 1 + 1 = 3 errors and triggers the threshold; the worker has one error, because its HTTP 200 response contributes zero. Both groups fit the two-group limit.Part 2 — Configurable incident viewsanalyze(records: list[dict[str, str]], rules: list[dict[str, str]] | None = None) without removing the default rule or changing event handling. Discuss how the return type changes before implementing this extension, and make the approach flexible enough to support future rules of the same kind.name, scope, windowSeconds, alertThreshold, and limit. Names are unique and cannot equal service_5m.scope is either service, grouping by (compartment, service), or compartment, grouping all services by compartment. Each rule counts the same deduplicated HTTP 5xx errors, but uses its own interval (t - windowSeconds, t].limit positive-count groups, ordered by descending count and then ascending entity fields: compartment followed by service when present. alert is true exactly when the count is at least alertThreshold; non-alerting groups are still eligible for the leaderboard. Rules do not suppress or modify one another.rules=None, retain the Part 1 output. With a supplied list, including an empty list, return an evaluations list per query: default rule first, followed by additional rules in ascending name order. Each evaluation contains rule and leaders.O((N × R + L) log(N + 1)), where N is the number of records, R includes the default rule, and L is the total number of returned leader entries.{
"rules":[
{"name":"compartment_2m","scope":"compartment","windowSeconds":"120","alertThreshold":"2","limit":"2"}
],
"records":[
{"kind":"event","at":"0","eventId":"a","timestamp":"0","compartment":"A","service":"api","status":"500"},
{"kind":"event","at":"100","eventId":"b","timestamp":"100","compartment":"A","service":"api","status":"500"},
{"kind":"event","at":"120","eventId":"c","timestamp":"110","compartment":"A","service":"worker","status":"503"},
{"kind":"event","at":"130","eventId":"d","timestamp":"125","compartment":"B","service":"api","status":"502"},
{"kind":"query","at":"130"},
{"kind":"query","at":"300"}
]
}[
{"at":130,"evaluations":[
{"rule":"service_5m","leaders":[
{"entity":{"compartment":"A","service":"api"},"errors":2,"alert":false},
{"entity":{"compartment":"A","service":"worker"},"errors":1,"alert":false}
]},
{"rule":"compartment_2m","leaders":[
{"entity":{"compartment":"A"},"errors":2,"alert":true},
{"entity":{"compartment":"B"},"errors":1,"alert":false}
]}
]},
{"at":300,"evaluations":[
{"rule":"service_5m","leaders":[
{"entity":{"compartment":"A","service":"api"},"errors":1,"alert":false},
{"entity":{"compartment":"A","service":"worker"},"errors":1,"alert":false}
]},
{"rule":"compartment_2m","leaders":[]}
]}
]130, the default window includes all four errors: A/api has 2, A/worker has 1, and B/api has 1. The two-group limit excludes B/api because A/worker wins the lexical tie. The compartment window is (10, 130], so timestamp 0 is excluded: A has 1 + 1 = 2 and alerts, while B has 1. At 300, the default window is (0, 300], so timestamp 0 expires; all three remaining service groups have count 1, and the lexical tie-break again selects the two A groups. No errors fall in the compartment window (180, 300].Example 3:{
"rules":[
{"name":"compartment_2m","scope":"compartment","windowSeconds":"120","alertThreshold":"2","limit":"2"}
],
"records":[
{"kind":"event","at":"200","eventId":"a","timestamp":"200","compartment":"A","service":"api","status":"500"},
{"kind":"event","at":"210","eventId":"b","timestamp":"210","compartment":"A","service":"api","status":"503"},
{"kind":"event","at":"220","eventId":"c","timestamp":"220","compartment":"A","service":"api","status":"502"},
{"kind":"event","at":"225","eventId":"b","timestamp":"210","compartment":"A","service":"api","status":"503"},
{"kind":"query","at":"230"},
{"kind":"event","at":"500","eventId":"late","timestamp":"200","compartment":"A","service":"worker","status":"500"},
{"kind":"query","at":"500"}
]
}[
{"at":230,"evaluations":[
{"rule":"service_5m","leaders":[
{"entity":{"compartment":"A","service":"api"},"errors":3,"alert":true}
]},
{"rule":"compartment_2m","leaders":[
{"entity":{"compartment":"A"},"errors":3,"alert":true}
]}
]},
{"at":500,"evaluations":[
{"rule":"service_5m","leaders":[
{"entity":{"compartment":"A","service":"api"},"errors":2,"alert":false}
]},
{"rule":"compartment_2m","leaders":[]}
]}
]230, three unique errors contribute 3 to both views; the duplicate contributes zero. Both rules alert independently because 3 >= 3 and 3 >= 2. At 500, the default window is (200, 500]: the original timestamp-200 error expires, and the newly arriving timestamp-200 error is already outside the window. Only timestamps 210 and 220 remain, totaling 2; neither is in the compartment window (380, 500].Notes:200,000 records, at most 8 total rules, windows in [1, 86400], positive alert thresholds, and limits in [1, 100].100 through 599 represented as strings.Sign up for free to access walkthroughs, AI-generated questions, and more.
Get Started Free