Oracle software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.
nums. Rearrange nums so that all even numbers appear before all odd numbers. The relative order of even or odd...Input: Arrayn 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: Arraynums and two integers k and m. Perform exactly k operations on nums. In each operation: 1....Input: Arraydef 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