Autocoder

Arcesium Coding Round Questions With Solutions

Last updated 2026-11-19

Arcesium coding questions are commonly reported at medium to hard level, with trees, graphs, dynamic programming and stack or heap techniques. The eleven problems below are practice in that style, with the idea, code, complexity and the usual mistake for each.

They are not real papers. For the interview side, including SQL and design, see Arcesium interview questions, and for general strategy read how to crack a DSA coding round.

How to practise

Time yourself at 30 to 40 minutes per problem. Write the brute force first, state its complexity, then improve. In interviews, narrate edge cases such as empty input, duplicates and overflow before coding.

Hiring status

We hold no sourced Arcesium hiring dates, numbers or test-format facts, so none are stated. Use Arcesium's careers site for current roles. For test strategy in general, see how to crack the online assessment.

Arcesium Coding Round Questions With Solutions: questions with worked answers

  1. 1

    Stock span problem.

    medium

    For each day, the span is the number of consecutive previous days with price at most today's. Keep a stack of (price, span). Pop while the top price is at most the current price, adding their spans. Amortised O(1) per day, O(n) space. Mistake: scanning backwards each time, giving O(n squared).

    python
    def stock_spans(prices):
        st, out = [], []
        for p in prices:
            span = 1
            while st and st[-1][0] <= p:
                span += st.pop()[1]
            st.append((p, span))
            out.append(span)
        return out
  2. 2

    House robber: maximum sum with no two adjacent elements.

    easy

    Let take and skip be the best sums when the current house is robbed or skipped. For each value, new take = skip + value and new skip = max(take, skip). O(n) time, O(1) space. Mistake: greedy picking of large values, which fails on [2, 7, 9, 3, 1] unless done through DP.

    python
    def rob(a):
        take = skip = 0
        for x in a:
            take, skip = skip + x, max(take, skip)
        return max(take, skip)
  3. 3

    Longest palindromic substring.

    medium

    Expand around each of the 2n - 1 centres, comparing outwards while characters match, and track the best. O(n squared) time, O(1) space; Manacher's algorithm gives O(n). Mistake: handling only odd-length centres.

    python
    def longest_pal(s):
        best = ''
        for c in range(len(s)):
            for l, r in ((c, c), (c, c + 1)):
                while l >= 0 and r < len(s) and s[l] == s[r]:
                    l -= 1
                    r += 1
                if r - l - 1 > len(best):
                    best = s[l+1:r]
        return best
  4. 4

    Serialize and deserialize a binary tree.

    hard

    Use preorder with a marker for null children, for example "1,2,#,#,3,#,#". Serialization is a DFS appending the value or the marker. Deserialization reads tokens through an iterator and rebuilds recursively. O(n) both ways. Mistake: omitting null markers, which makes the structure ambiguous.

    python
    class T:
        def __init__(self, v, l=None, r=None):
            self.val, self.left, self.right = v, l, r
    
    def serialize(root):
        out = []
        def go(n):
            if not n:
                out.append('#')
                return
            out.append(str(n.val))
            go(n.left)
            go(n.right)
        go(root)
        return ','.join(out)
    
    def deserialize(s):
        it = iter(s.split(','))
        def go():
            t = next(it)
            if t == '#':
                return None
            n = T(int(t))
            n.left = go()
            n.right = go()
            return n
        return go()
  5. 5

    Lowest common ancestor of two nodes in a binary tree.

    medium

    Recurse: if the node is null or one of the targets, return it. Recurse on both children; if both return non-null, the current node is the LCA, otherwise return whichever is non-null. O(n) time, O(h) space. For a BST you can walk down comparing values in O(h).

    python
    def lca(root, p, q):
        if root is None or root is p or root is q:
            return root
        l = lca(root.left, p, q)
        r = lca(root.right, p, q)
        if l and r:
            return root
        return l or r
    java
    static TreeNode lca(TreeNode root, TreeNode p, TreeNode q) {
        if (root == null || root == p || root == q) return root;
        TreeNode l = lca(root.left, p, q), r = lca(root.right, p, q);
        return (l != null && r != null) ? root : (l != null ? l : r);
    }
  6. 6

    Partition equal subset sum.

    medium

    If the total is odd, the answer is no. Otherwise ask whether a subset sums to total / 2, using a boolean knapsack with a bitset or array iterated downwards. O(n times target) time, O(target) space. Mistake: iterating upwards and reusing items.

    python
    def can_partition(a):
        s = sum(a)
        if s % 2:
            return False
        t = s // 2
        dp = [True] + [False] * t
        for x in a:
            for j in range(t, x - 1, -1):
                dp[j] = dp[j] or dp[j - x]
        return dp[t]
  7. 7

    Merge k sorted lists.

    hard

    Push the head of every list into a min-heap keyed by value, with an index as tie-breaker, pop the smallest, append it, and push its successor. O(N log k) for N total nodes. Mistake: pushing nodes without a tie-breaker, which makes Python compare node objects and raise an error.

    python
    import heapq
    
    def merge_k(lists):
        h = [(l[0], i, 0) for i, l in enumerate(lists) if l]
        heapq.heapify(h)
        out = []
        while h:
            v, i, j = heapq.heappop(h)
            out.append(v)
            if j + 1 < len(lists[i]):
                heapq.heappush(h, (lists[i][j+1], i, j + 1))
        return out
  8. 8

    Network delay time (Dijkstra).

    medium

    Run Dijkstra from the source with a min-heap on distances. The answer is the maximum shortest distance, or -1 if some node is unreachable. O((V + E) log V). Mistake: using BFS on a weighted graph, or forgetting to skip stale heap entries.

    python
    import heapq
    
    def network_delay(times, n, k):
        adj = [[] for _ in range(n + 1)]
        for u, v, w in times:
            adj[u].append((v, w))
        dist = {}
        h = [(0, k)]
        while h:
            d, u = heapq.heappop(h)
            if u in dist:
                continue
            dist[u] = d
            for v, w in adj[u]:
                if v not in dist:
                    heapq.heappush(h, (d + w, v))
        return max(dist.values()) if len(dist) == n else -1
  9. 9

    Rotate an n by n matrix 90 degrees clockwise in place.

    medium

    Transpose the matrix, then reverse every row. Time O(n squared), space O(1). Mistake: transposing the full square instead of only the upper triangle, which swaps every pair twice and restores the original.

    python
    def rotate(m):
        n = len(m)
        for i in range(n):
            for j in range(i + 1, n):
                m[i][j], m[j][i] = m[j][i], m[i][j]
        for row in m:
            row.reverse()
  10. 10

    Kth smallest element in a BST.

    easy

    An inorder traversal of a BST visits keys in ascending order, so stop at the k-th visited node. Use an iterative stack to avoid deep recursion. O(h + k) time. For repeated queries with updates, augment each node with its subtree size.

    python
    def kth_smallest(root, k):
        st, cur = [], root
        while st or cur:
            while cur:
                st.append(cur)
                cur = cur.left
            cur = st.pop()
            k -= 1
            if k == 0:
                return cur.val
            cur = cur.right
  11. 11

    Count distinct paths in a grid with obstacles.

    easy

    dp[r][c] is the number of ways to reach a cell moving right or down. It is zero at obstacles, and otherwise the sum of the cell above and to the left. O(mn) time, O(n) space with a rolling row. Mistake: not treating an obstacle at the start as zero ways.

    python
    def unique_paths(g):
        n = len(g[0])
        dp = [0] * n
        dp[0] = 1 if g[0][0] == 0 else 0
        for row in g:
            for c in range(n):
                if row[c] == 1:
                    dp[c] = 0
                elif c:
                    dp[c] += dp[c - 1]
        return dp[-1]

Frequently asked questions

What level are Arcesium coding questions?

Commonly reported as medium to hard. Practise trees, graphs, dynamic programming and heaps.

How many coding rounds are there?

Reports vary. Expect at least an online assessment and one or more technical rounds with live coding.

Is SQL part of the coding round?

Some reports mention SQL and database questions in interviews. See SQL interview questions.

Can I choose my language?

Usually the platform lists allowed languages. Pick the one you write fastest in.

Related guides

More in Company Interview Questions

See all in this section