Aurora interview questions & answers

10 real Aurora interview questions with full model answers — Coding. Drawn from the same verified bank ChannelPulse drills from (10 Aurora questions in total).

CodingMediumAuroraSoftware Engineer

1. Snapshot Array (LeetCode)

Model answer

The task

Implement an array that supports updates, saving snapshots, and reading an index’s value as it was at a particular snapshot.

Key idea

For each index, store only the values that were explicitly set, tagged with the current snapshot ID. These IDs are ordered, so a binary search finds the most recent update no later than the requested snapshot.

Approach

  1. Keep a history list for each index and a counter for the next snapshot ID.
  2. On set, overwrite that index’s last history entry if it belongs to the current snapshot; otherwise, append a new entry.
  3. On snap, return the current ID and advance the counter.
  4. On get, binary-search the index’s history for the last entry whose ID is at most the requested ID.
  5. Return 0 if that index has no earlier recorded update.
class SnapshotArray:
    def __init__(self, length: int):
        self.histories = [[] for _ in range(length)]
        self.current_snap_id = 0

    def set(self, index: int, val: int) -> None:
        history = self.histories[index]

        # Only the final value set in a snapshot needs to be recorded.
        if history and history[-1][0] == self.current_snap_id:
            history[-1] = (self.current_snap_id, val)
        else:
            history.append((self.current_snap_id, val))

    def snap(self) -> int:
        snap_id = self.current_snap_id
        self.current_snap_id += 1
        return snap_id

    def get(self, index: int, snap_id: int) -> int:
        history = self.histories[index]

        # Find the first history entry with an ID greater than snap_id.
        low, high = 0, len(history)
        while low < high:
            mid = (low + high) // 2
            if history[mid][0] <= snap_id:
                low = mid + 1
            else:
                high = mid

        # The preceding entry is the latest update visible in this snapshot.
        return history[low - 1][1] if low > 0 else 0

Complexity:

  • Time: set and snap are O(1); get is O(log H), where H is the history length for that index.
  • Space: O(W), where W is the number of recorded writes across all indices.

Common follow-ups

  • How can memory be reduced when values often repeat? Skip recording a set when it matches the most recent value.
  • How would you support undoing snapshots? Use a persistent structure or retain version roots so earlier states remain addressable.
  • What if reads are much more frequent than writes? The per-index histories already make reads efficient, with logarithmic lookup.
CodingMediumAuroraSoftware Engineer

2. Course Schedule II (LeetCode)

Model answer

The task

Return an ordering of all courses that satisfies the prerequisite relationships. If no such ordering exists because the relationships contain a cycle, return an empty list.

Key idea

Model each course as a graph node, with an edge from a prerequisite to the course that depends on it. Kahn’s topological-sort algorithm repeatedly takes courses with no remaining prerequisites; if it cannot take every course, the graph contains a cycle.

Approach

  1. Build an adjacency list and count each course’s prerequisites as its indegree.
  2. Add all zero-indegree courses to a queue.
  3. Remove courses from the queue, adding each to the result and reducing the indegree of its dependent courses.
  4. Add a dependent course to the queue when its indegree reaches zero.
  5. Return the result if it includes every course; otherwise, return an empty list.
from collections import deque
from typing import List

class Solution:
    def findOrder(
        self, numCourses: int, prerequisites: List[List[int]]
    ) -> List[int]:
        # Edges point from prerequisite to dependent course.
        graph = [[] for _ in range(numCourses)]
        indegree = [0] * numCourses

        for course, prerequisite in prerequisites:
            graph[prerequisite].append(course)
            indegree[course] += 1

        ready = deque(
            course
            for course in range(numCourses)
            if indegree[course] == 0
        )
        order = []

        while ready:
            course = ready.popleft()
            order.append(course)

            for dependent in graph[course]:
                indegree[dependent] -= 1
                if indegree[dependent] == 0:
                    ready.append(dependent)

        # A cycle prevents all courses from being added.
        return order if len(order) == numCourses else []

**Complexity:**

- Time: O(V + E), where V is the number of courses and E is the number of prerequisite relationships.
- Space: O(V + E) for the graph, indegrees, queue, and result.

**Common follow-ups**

- How can DFS solve this? Use three node states—unvisited, visiting, and visited—to detect cycles while building a topological order.
- How can the algorithm return the number of courses that can be completed? Return the length of the processed order.
- How can you choose the smallest-numbered available course at each step? Use a min-heap instead of a queue, giving O((V + E) log V) time.
CodingMediumAuroraSoftware Engineer

3. Number of Distinct Islands (LeetCode)

Model answer

The task

Count the different island shapes in a binary grid. Two islands are considered the same when one can be shifted to match the other; rotations and reflections do not count as matches.

Key idea

Represent each island by the coordinates of its cells relative to a fixed cell in that island. Sorting those relative coordinates gives a consistent signature regardless of the order in which the island is traversed.

Approach

  1. Scan every grid cell.
  2. When an unvisited land cell is found, traverse its island with DFS.
  3. Record each cell’s row and column offsets from the island’s starting cell.
  4. Sort the offsets and use the resulting tuple as the island’s signature.
  5. Count the number of unique signatures.
from typing import List, Set, Tuple

class Solution:
    def numDistinctIslands(self, grid: List[List[int]]) -> int:
        if not grid or not grid[0]:
            return 0

        rows, cols = len(grid), len(grid[0])
        visited: Set[Tuple[int, int]] = set()
        shapes = set()

        for start_row in range(rows):
            for start_col in range(cols):
                if grid[start_row][start_col] != 1:
                    continue
                if (start_row, start_col) in visited:
                    continue

                # Traverse this island and store coordinates relative to its start.
                stack = [(start_row, start_col)]
                visited.add((start_row, start_col))
                cells = []

                while stack:
                    row, col = stack.pop()
                    cells.append((row - start_row, col - start_col))

                    for dr, dc in ((1, 0), (-1, 0), (0, 1), (0, -1)):
                        nr, nc = row + dr, col + dc
                        if (
                            0 <= nr < rows
                            and 0 <= nc < cols
                            and grid[nr][nc] == 1
                            and (nr, nc) not in visited
                        ):
                            visited.add((nr, nc))
                            stack.append((nr, nc))

                shapes.add(tuple(sorted(cells)))

        return len(shapes)

Complexity:

  • Time: O(mn log L), where each cell is visited once and each island’s coordinates are sorted; L is the largest island size.
  • Space: O(mn) for visited cells and stored island signatures.

Common follow-ups

  • How would rotations or reflections count as equivalent? Generate signatures for all transformations and choose a canonical one.
  • Can the grid be modified instead of using a visited set? Yes; mark land as water when it is visited.
  • How can memory use be reduced? Process islands one at a time and store only their canonical signatures, while still tracking visited cells.
CodingMediumAuroraSoftware Engineer

4. LRU Cache (LeetCode)

Model answer

The task

Design a cache with a fixed capacity that supports retrieving and inserting key-value pairs. When an insertion exceeds capacity, evict the item that has gone unused for the longest time.

Key idea

Use a hash map for direct key lookup and a doubly linked list to track recency. Keep the most recently used item at the front; the least recently used item is at the back.

Approach

  1. Create a map from keys to their linked-list nodes.
  2. Use dummy head and tail nodes so items can be added or removed without special cases at the ends.
  3. On a successful get, move the node to the front and return its value; return -1 if the key is absent.
  4. On put, update and promote an existing node, or add a new node at the front.
  5. If the cache is over capacity, remove the node just before the tail and delete its key from the map.
class _Node:
    def __init__(self, key: int = 0, value: int = 0):
        self.key = key
        self.value = value
        self.prev = None
        self.next = None

class LRUCache:
    def __init__(self, capacity: int):
        self.capacity = capacity
        self.nodes = {}

        # Items are stored between these sentinels.
        self.head = _Node()
        self.tail = _Node()
        self.head.next = self.tail
        self.tail.prev = self.head

    def _remove(self, node: _Node) -> None:
        node.prev.next = node.next
        node.next.prev = node.prev

    def _add_to_front(self, node: _Node) -> None:
        node.prev = self.head
        node.next = self.head.next
        self.head.next.prev = node
        self.head.next = node

    def _make_most_recent(self, node: _Node) -> None:
        self._remove(node)
        self._add_to_front(node)

    def get(self, key: int) -> int:
        node = self.nodes.get(key)
        if node is None:
            return -1

        self._make_most_recent(node)
        return node.value

    def put(self, key: int, value: int) -> None:
        node = self.nodes.get(key)

        if node is not None:
            node.value = value
            self._make_most_recent(node)
            return

        node = _Node(key, value)
        self.nodes[key] = node
        self._add_to_front(node)

        if len(self.nodes) > self.capacity:
            least_recent = self.tail.prev
            self._remove(least_recent)
            del self.nodes[least_recent.key]

Complexity:

  • Time: O(1) for get and put; map and list operations take constant time.
  • Space: O(capacity); the map and list store at most the cache’s capacity of entries.

Common follow-ups

  • How would you make the cache thread-safe? Protect operations with a lock.
  • What if entries expire after a time-to-live? Track expiration times and remove expired entries during access or with a cleanup mechanism.
  • How would you support eviction by frequency instead of recency? Track access counts and organize entries by frequency.
CodingMediumAuroraSoftware Engineer

5. Flatten Nested List Iterator (LeetCode)

Model answer

The task

Implement an iterator over a nested list of integers. It should return integers in left-to-right order, while allowing callers to check whether another integer is available.

Key idea

Keep a stack of unprocessed items, with the next item at the top. When the top is a list, replace it with its contents in reverse order; this preserves the original order and expands only as needed.

Approach

  1. Initialize the stack with the top-level items in reverse order.
  2. In hasNext, discard empty lists from the top.
  3. If the top is a nonempty list, pop it and push its contents in reverse order.
  4. Return true when the top is an integer, or false when the stack is empty.
  5. In next, prepare with hasNext and pop the integer.
class NestedIterator:
    def __init__(self, nestedList):
        # Reverse so the first item is at the top of the stack.
        self.stack = list(reversed(nestedList))

    def next(self):
        # The iterator contract assumes next() is called only when
        # hasNext() returns True.
        self.hasNext()
        return self.stack.pop().getInteger()

    def hasNext(self):
        while self.stack:
            item = self.stack[-1]

            if item.isInteger():
                return True

            # Expand this list, preserving its original item order.
            self.stack.pop()
            self.stack.extend(reversed(item.getList()))

        return False

Complexity:

  • Time: O(1) amortized per hasNext or next; each nested item is processed once.
  • Space: O(N) worst case for the stack, where N is the number of nested items.

Common follow-ups

  • How would you avoid storing all top-level items initially? Store an iterator over the current list and keep iterator frames on a stack.
  • What happens with empty nested lists? hasNext removes them while searching for the next integer.
  • Can the iterator support resetting? Keep the original input and rebuild the stack on reset.
CodingMediumAuroraSoftware Engineer

6. Angle Between Hands of a Clock (LeetCode)

Model answer

The task

Find the smaller angle, in degrees, between the hour and minute hands at a given hour and minute.

Key idea

The minute hand moves 6 degrees per minute. The hour hand moves 30 degrees per hour and also advances 0.5 degrees per minute, so account for the minutes when computing its position.

Approach

  1. Compute the minute hand’s angle from 12 o’clock.
  2. Compute the hour hand’s angle, including its movement during the current minute.
  3. Take the absolute difference between the two angles.
  4. Return the smaller of that difference and its complement to 360 degrees.
class Solution:
    def angleClock(self, hour: int, minutes: int) -> float:
        # The minute hand completes 360 degrees in 60 minutes.
        minute_angle = 6 * minutes

        # The hour hand moves 30 degrees per hour and 0.5 per minute.
        hour_angle = 30 * hour + 0.5 * minutes

        difference = abs(hour_angle - minute_angle)
        return min(difference, 360 - difference)

Complexity:

  • Time: O(1), using a fixed number of arithmetic operations.
  • Space: O(1), using a fixed number of variables.

Common follow-ups

  • How would you include seconds? Add seconds / 120 degrees to the hour hand and seconds * 0.1 degrees to the minute hand.
  • How would you return the larger angle instead? Return 360 - min(difference, 360 - difference).
  • How would you handle times beyond one day? Reduce the hour modulo 12 and the minutes modulo 60 before computing the angles.
CodingHardAuroraSoftware Engineer

7. Maximum Number of Visible Points (LeetCode)

Model answer

The task

Given points on a plane, an observer’s location, and a viewing angle, find the largest number of points that fit inside a view of that angle. Points at the observer’s exact location are visible regardless of direction.

Key idea

Convert each other point to its polar angle from the observer, sort those angles, and find the largest circular interval no wider than the viewing angle. Duplicate the sorted angles with a full turn added so intervals crossing the zero-angle boundary are handled linearly.

Approach

  1. Count points at the observer’s location separately.
  2. Convert the remaining points’ directions to radians and sort them.
  3. Append a copy of each angle shifted by \(2\pi\).
  4. Use two pointers to find the largest window whose angular span fits the limit.
  5. Add the coincident-point count to that window’s size.
import math
from typing import List

class Solution:
    def visiblePoints(
        self,
        points: List[List[int]],
        angle: int,
        location: List[int]
    ) -> int:
        same_location = 0
        directions = []

        for x, y in points:
            dx = x - location[0]
            dy = y - location[1]

            if dx == 0 and dy == 0:
                same_location += 1
            else:
                directions.append(math.atan2(dy, dx))

        directions.sort()

        # Duplicate angles after adding one full turn to cover wraparound.
        count = len(directions)
        extended = directions + [a + 2 * math.pi for a in directions]
        limit = math.radians(angle)

        best = left = 0
        for right, current in enumerate(extended):
            while current - extended[left] > limit + 1e-12:
                left += 1
            best = max(best, right - left + 1)

        return same_location + best

Complexity:

  • Time: O(n log n), dominated by sorting the directions.
  • Space: O(n), for the angle list and its duplicated copy.

Common follow-ups

  • What if points may be duplicated? Each input point is counted separately, including duplicates at the observer’s location.
  • How would you handle many angle queries for the same points? Sort directions once, then use binary search or a sliding-window pass per query.
  • Why use a small tolerance in the comparison? Floating-point angle calculations can introduce tiny rounding errors at the boundary.
CodingHardAuroraSoftware Engineer

8. Sliding Window Maximum (LeetCode)

Model answer

The task

Given an integer array and a window width k, return the maximum value in each contiguous window as it moves from left to right.

Key idea

Keep a deque of indices whose values are in decreasing order. Its front is the index of the current window’s maximum; indices that leave the window or are dominated by a newer, larger value can be discarded.

Approach

  1. Create a deque of indices and a list for the answers.
  2. For each index, remove indices from the front if they are outside the current window.
  3. Remove indices from the back while their values are no greater than the current value.
  4. Append the current index; it is now a candidate maximum for this and future windows.
  5. Once the first full window has been processed, append the value at the deque’s front.
from collections import deque
from typing import List

class Solution:
    def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:
        if not nums or k <= 0:
            return []

        # Store indices in decreasing order of their corresponding values.
        candidates = deque()
        result = []

        for i, value in enumerate(nums):
            # Remove the maximum candidate if it is outside this window.
            while candidates and candidates[0] <= i - k:
                candidates.popleft()

            # A newer value at least as large makes older candidates useless.
            while candidates and nums[candidates[-1]] <= value:
                candidates.pop()

            candidates.append(i)

            # The first complete window ends at index k - 1.
            if i >= k - 1:
                result.append(nums[candidates[0]])

        return result

Complexity:

  • Time: O(n), because each index is added to and removed from the deque at most once.
  • Space: O(k), for the deque of candidate indices, excluding the output.

Common follow-ups

  • How would you find window minima instead? Reverse the deque’s ordering, removing smaller values from the back.
  • What if equal values should preserve the earliest index? Remove only strictly smaller values from the back.
  • How can this be handled as a streaming input? Maintain the same bounded deque and emit a maximum whenever a full window has arrived.
CodingHardAuroraSoftware Engineer

9. Word Search II (LeetCode)

Model answer

The task

Given a character grid and a list of words, return the words that can be formed by moving between adjacent cells. A cell may be used at most once in a word.

Key idea

Store the words in a trie so each grid path is checked against many words at once. Backtracking follows only trie prefixes that still lead to a word, and removes exhausted trie branches to avoid unnecessary searches.

Approach

  1. Insert each word into a trie, marking its final node with the complete word.
  2. Start a depth-first search from each grid cell that matches a trie root child.
  3. During search, mark the current cell as visited and explore its four neighbors only when they continue a trie prefix.
  4. Record a word when its terminal node is reached, then clear that terminal to avoid duplicate results.
  5. Backtrack and remove trie branches that no longer contain any unreported words.
class TrieNode:
    def __init__(self):
        self.children = {}
        self.word = None

class Solution:
    def findWords(self, board, words):
        root = TrieNode()

        # Build a trie, storing each full word at its terminal node.
        for word in words:
            node = root
            for char in word:
                node = node.children.setdefault(char, TrieNode())
            node.word = word

        rows, cols = len(board), len(board[0])
        found = []
        visited = set()
        directions = ((1, 0), (-1, 0), (0, 1), (0, -1))

        def search(row, col, parent):
            char = board[row][col]
            node = parent.children.get(char)
            if node is None:
                return

            if node.word is not None:
                found.append(node.word)
                node.word = None  # Do not report the same word again.

            visited.add((row, col))
            for dr, dc in directions:
                nr, nc = row + dr, col + dc
                if (
                    0 <= nr < rows
                    and 0 <= nc < cols
                    and (nr, nc) not in visited
                    and board[nr][nc] in node.children
                ):
                    search(nr, nc, node)
            visited.remove((row, col))

            # This prefix cannot produce any additional words.
            if not node.children and node.word is None:
                del parent.children[char]

        for row in range(rows):
            for col in range(cols):
                if board[row][col] in root.children:
                    search(row, col, root)

        return found

Complexity:

  • Time: O(MN · 4 · 3^(L−1) + S) in the worst case, where M × N is the grid size, L is the longest word length, and S is the total number of characters in the words. Trie pruning often reduces the search substantially.
  • Space: O(S + L), for the trie and the DFS visited set.

Common follow-ups

  • What if diagonal moves are allowed? Add the four diagonal offsets to the direction list.
  • How would you reduce memory for a very large dictionary? Use compact child arrays for a fixed alphabet or store trie edges in a compressed representation.
  • What if the grid is reused across many searches? Keep it immutable as here, or use a temporary marker with guaranteed restoration during backtracking.
CodingHardAuroraSoftware Engineer

10. Zuma Game (LeetCode)

Model answer

The task

Find the fewest balls from a limited hand that must be inserted into a board to clear it completely. Return -1 if clearing the board is impossible.

Key idea

Breadth-first search explores states in order of the number of balls used, so the first cleared board gives the minimum. After each insertion, remove any run of three or more matching balls and repeat, since removals may cause further runs to form.

Approach

  1. Count the available balls of each color and represent a state as (board, hand_counts).
  2. Start BFS from the initial board and hand.
  3. For each state, try each available color at every board position.
  4. After insertion, repeatedly remove qualifying runs; enqueue unseen states with one fewer ball of that color.
  5. Return the number of insertions when the board is empty, or -1 if BFS runs out of states.
from collections import Counter, deque
from typing import List, Tuple

class Solution:
    def findMinStep(self, board: str, hand: str) -> int:
        colors = "RYBGW"
        initial_counts = tuple(Counter(hand)[color] for color in colors)

        def remove_runs(text: str) -> str:
            # Remove one qualifying run at a time, then rescan for cascades.
            while True:
                i = 0
                removed = False

                while i < len(text):
                    j = i + 1
                    while j < len(text) and text[j] == text[i]:
                        j += 1

                    if j - i >= 3:
                        text = text[:i] + text[j:]
                        removed = True
                        break
                    i = j

                if not removed:
                    return text

        queue = deque([(remove_runs(board), initial_counts, 0)])
        seen = {(queue[0][0], initial_counts)}

        while queue:
            current, counts, steps = queue.popleft()

            if not current:
                return steps

            for color_index, color in enumerate(colors):
                if counts[color_index] == 0:
                    continue

                next_counts = list(counts)
                next_counts[color_index] -= 1
                next_counts = tuple(next_counts)

                for position in range(len(current) + 1):
                    inserted = current[:position] + color + current[position:]
                    next_board = remove_runs(inserted)
                    state = (next_board, next_counts)

                    if state not in seen:
                        seen.add(state)
                        queue.append((next_board, next_counts, steps + 1))

        return -1

Complexity:

  • Time: O(S · C · L³) in this implementation, where S is the number of reachable states, C is the number of colors, and L is the maximum board length. Each state tries every insertion position; run removal may take O(L²).
  • Space: O(S) for the BFS queue and visited states.

Common follow-ups

  • How can the search avoid duplicate insertions? Skip equivalent positions within an identical run; they produce the same board state.
  • Can DFS be used instead? Yes; memoize states and track the best number of balls used, while pruning paths no better than the current answer.
  • How does the approach change with more colors? Use the distinct hand colors as the alphabet; the branching factor grows with the number of available colors.

Practice these out loud, don't memorise them

Reading an answer is not the same as being able to give one under pressure. ChannelPulse plays the interviewer, asks the follow-ups, and scores each answer with feedback and a model answer so you can hear the gap between what you said and what lands.

Get ChannelPulse Browse all questions