Oracle software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.
s and a positive...Input: Graph (nodes and edges)"teamId action timestamp", where action is...Input: Graph (nodes and edges)nums. Rearrange nums so that all even numbers appear before all odd numbers. The relative order of even or odd...Input: Arraytext containing only lowercase English letters and a positive integer k, find the substring of length k that appears most...Input: Graph (nodes and edges)n floors numbered from 0 to n - 1. Each floor has an energy cost to traverse and a reward value. You start a ball at one chosen...Input: Arrayn users (indexed 0 to n - 1) and a list of existing friendships (undirected...Input: ArrayskipChars and inputChars, determine whether inputChars forms a palindrome after removing all characters that appear...Input: Arrays of lowercase English letters. In one operation, you may change any single character to any other lowercase letter. Find...Input: StringL made up only of lowercase English letters. A character at position i is called a conflict if it equals the...Input: Number(s)nums and two integers k and m. Perform exactly k operations on nums. In each operation: 1....Input: Array[borrower, lender, amount] where borrower and lender are...Input: List+ 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.def longest_path(graph: List[List[int]], start: int) -> int:graph = [[1, 2], [3], [3], []], start = 0 3 graph = [[1], [2], [3], [1]], start = 0 3 1 <= len(graph) <= 1000 0 <= start < len(graph) 10 elementsNone.def shortest_path(graph: Dict[str, List[str]], source: str, destination: str) -> List[str]: graph = {'A': ['B', 'C'], 'B': ['D'], 'C': ['D'], 'D': []}, source = 'A', destination = 'D' ['A', 'B', 'D'] graph = {'A': ['B'], 'B': ['C'], 'C': []}, source = 'A', destination = 'D' None 1000 nodes. 100 connections.BinaryTreeCodec with methods to serialize and deserialize a binary tree. The serialized output should be a string that maintains the structure of the tree. For a given binary tree, the serialize(root) method should produce a string, and the deserialize(data) method should reconstruct the binary tree from that string.Function/class signature:def serialize(self, root: TreeNode) -> str:def deserialize(self, data: str) -> TreeNode:root = [1,2,3,null,null,4,5] '1,2,3,null,null,4,5' data = '1,2,3,null,null,4,5' TreeNode(1) with children TreeNode(2), TreeNode(3) 1000 nodes.-10^4 and 10^4.def find_shortest_path(flights: List[Tuple[str, str, int]], start: str, destination: str) -> Tuple[List[str], int]:flights = [('JFK', 'LAX', 300), ('JFK', 'SFO', 400), ('LAX', 'SFO', 100)]
start = 'JFK'
destination = 'SFO'(['JFK', 'LAX', 'SFO'], 400)
flights = [('JFK', 'MIA', 200), ('MIA', 'SFO', 300), ('JFK', 'SFO', 600)]
start = 'JFK'
destination = 'SFO'(['JFK', 'MIA', 'SFO'], 500)
def invert_tree(root: TreeNode) -> TreeNode:root = [4, 2, 7, 1, 3, 6, 9][4, 7, 2, 9, 6, 3, 1]2 becomes the right child 7, and all further inversions follow.root = [2, 1, 3][2, 3, 1]arr1 and arr2, merge them into a single sorted array. The merged array should also be sorted and must not require additional space for an output of size m + n, where m and n are the sizes of arr1 and arr2, respectively. You must return the merged array as your result.def merge_sorted_arrays(arr1: List[int], arr2: List[int]) -> List[int]:arr1 = [1, 3, 5], arr2 = [2, 4, 6] [1, 2, 3, 4, 5, 6] arr1 = [0, 1, 2], arr2 = [3, 4, 5][0, 1, 2, 3, 4, 5] 0 <= arr1.length, arr2.length <= 100 -1000 <= arr1[i], arr2[i] <= 1000Sign up for free to access walkthroughs, AI-generated questions, and more.
Get Started Free