Autocoder

Adobe Coding Round Questions with Solutions in Python and Java

Last updated 2026-11-19

Adobe's online coding rounds are short and fast, with a mix of array, string, linked list and tree problems on data structures and programming logic. These ten are chosen for that format and range from easy to hard.

Time yourself, then compare with the worked solutions in Python and Java, which include complexity and the common mistakes.

Problems10, easy to hard
LanguagesPython and Java
PatternsIn-place arrays, bit tricks, lists, BST, binary search
Test format described60 minutes, 15 MCQs and 2 coding questions

What Adobe's online test looks like

Adobe's India hackathon Round 1 in 2026 was a 60-minute test of 15 multiple-choice questions plus two coding questions on data structures, algorithms and programming logic. That is a short, fast format, so the problems below are the compact, array, string, list and tree problems that fit in about 20 to 25 minutes each. They are practice problems, not real test content.

For the conceptual side, see Adobe interview questions.

Mistakes under time pressure

Hiring status

Adobe's India Hackathon 2026 has ended; its top 50 were offered pre-placement interview chances for the 2028 batch. There is no Adobe page under hiring news on this site, so check careers.adobe.com for current roles.

Adobe Coding Round Questions with Solutions in Python and Java: questions with worked answers

  1. 1

    Sort Colors (Dutch national flag): sort an array of 0, 1 and 2 in place.

    medium

    Keep three regions with pointers lo, mid and hi. If a[mid] is 0 swap it with lo and advance both; if 1 advance mid; if 2 swap with hi and decrease hi without advancing mid (the swapped-in value is unchecked). Time O(n), one pass, space O(1). Mistake: advancing mid after swapping with hi.

    python
    def sort_colors(a):
        lo, mid, hi = 0, 0, len(a) - 1
        while mid <= hi:
            if a[mid] == 0:
                a[lo], a[mid] = a[mid], a[lo]; lo += 1; mid += 1
            elif a[mid] == 1:
                mid += 1
            else:
                a[mid], a[hi] = a[hi], a[mid]; hi -= 1
    java
    class Solution {
        void sortColors(int[] a) {
            int lo = 0, mid = 0, hi = a.length - 1;
            while (mid <= hi) {
                if (a[mid] == 0) { int t = a[lo]; a[lo++] = a[mid]; a[mid++] = t; }
                else if (a[mid] == 1) mid++;
                else { int t = a[hi]; a[hi--] = a[mid]; a[mid] = t; }
            }
        }
    }
  2. 2

    Find the missing and the repeating number in an array of 1..n with one of each.

    medium

    Using index marking: for each value v, negate the element at index |v| - 1; if it is already negative, |v| is the repeat. After that, the index whose element is still positive gives the missing number. Time O(n), space O(1) if you may modify the array (restore afterwards if needed). The math alternative uses sum and sum of squares. Mistake: forgetting to use the absolute value when reading marked elements.

    python
    def missing_repeating(a):
        n, rep = len(a), -1
        for x in a:
            i = abs(x) - 1
            if a[i] < 0: rep = abs(x)
            else: a[i] = -a[i]
        miss = next(i + 1 for i in range(n) if a[i] > 0)
        return miss, rep
    java
    class Solution {
        int[] missingRepeating(int[] a) {
            int rep = -1;
            for (int x : a) {
                int i = Math.abs(x) - 1;
                if (a[i] < 0) rep = Math.abs(x); else a[i] = -a[i];
            }
            int miss = -1;
            for (int i = 0; i < a.length; i++) if (a[i] > 0) miss = i + 1;
            return new int[]{miss, rep};
        }
    }
  3. 3

    Longest Common Prefix of an array of strings.

    easy

    Take the first string as the prefix and shorten it until each other string starts with it. Alternatively compare column by column. Time O(total characters), space O(1). Mistake: not handling an empty array or an empty string, and indexing past a shorter string's length.

    python
    def lcp(strs):
        if not strs: return ""
        p = strs[0]
        for s in strs[1:]:
            while not s.startswith(p):
                p = p[:-1]
                if not p: return ""
        return p
    java
    class Solution {
        String lcp(String[] strs) {
            if (strs.length == 0) return "";
            String p = strs[0];
            for (int i = 1; i < strs.length; i++)
                while (!strs[i].startsWith(p)) {
                    p = p.substring(0, p.length() - 1);
                    if (p.isEmpty()) return "";
                }
            return p;
        }
    }
  4. 4

    Counting Bits: number of 1 bits in every number from 0 to n.

    easy

    Use the recurrence bits[i] = bits[i >> 1] + (i & 1): the count for i equals the count for i with its last bit removed plus that last bit. Time O(n), space O(n) for output. Mistake: calling a popcount for each number, which is O(n log n) in the worst case, when the dynamic programming recurrence is linear.

    python
    def count_bits(n):
        bits = [0] * (n + 1)
        for i in range(1, n + 1):
            bits[i] = bits[i >> 1] + (i & 1)
        return bits
    java
    class Solution {
        int[] countBits(int n) {
            int[] bits = new int[n + 1];
            for (int i = 1; i <= n; i++) bits[i] = bits[i >> 1] + (i & 1);
            return bits;
        }
    }
  5. 5

    Maximum Product Subarray.

    medium

    Track both the maximum and minimum product ending at each position, because a negative number can turn the smallest product into the largest. For each x, new max is max(x, x x max, x x min) and new min likewise; the answer is the best max seen. Time O(n), space O(1). Mistake: tracking only the maximum, which fails on inputs like [-2, 3, -4].

    python
    def max_product(a):
        mx = mn = best = a[0]
        for x in a[1:]:
            cand = (x, x * mx, x * mn)
            mx, mn = max(cand), min(cand)
            best = max(best, mx)
        return best
    java
    class Solution {
        int maxProduct(int[] a) {
            int mx = a[0], mn = a[0], best = a[0];
            for (int i = 1; i < a.length; i++) {
                int x = a[i];
                int c1 = x * mx, c2 = x * mn;
                mx = Math.max(x, Math.max(c1, c2));
                mn = Math.min(x, Math.min(c1, c2));
                best = Math.max(best, mx);
            }
            return best;
        }
    }
  6. 6

    Kth Smallest Element in a BST.

    medium

    In-order traversal of a BST visits values in ascending order, so stop at the k-th visited node. Use an iterative traversal with a stack so you can stop early. Time O(h + k), space O(h). If the tree is modified often and k queries are frequent, store subtree sizes in each node to answer in O(h). Mistake: collecting all values then indexing, which is O(n) every time.

    python
    def kth_smallest(root, k):
        st, cur = [], root
        while cur or st:
            while cur:
                st.append(cur); cur = cur.left
            cur = st.pop()
            k -= 1
            if k == 0: return cur.val
            cur = cur.right
    java
    import java.util.*;
    class TreeNode { int val; TreeNode left, right; }
    class Solution {
        int kthSmallest(TreeNode root, int k) {
            Deque<TreeNode> st = new ArrayDeque<>();
            TreeNode cur = root;
            while (cur != null || !st.isEmpty()) {
                while (cur != null) { st.push(cur); cur = cur.left; }
                cur = st.pop();
                if (--k == 0) return cur.val;
                cur = cur.right;
            }
            return -1;
        }
    }
  7. 7

    Detect and remove a loop in a linked list.

    hard

    Use Floyd's algorithm to detect the loop, then find the start by resetting one pointer to the head and moving both one step at a time. To remove the loop, walk to the node whose next is the loop start and set its next to null. Time O(n), space O(1). Mistake: when the loop starts at the head, the second walk must still find the last node in the cycle; handle it explicitly.

    python
    def remove_loop(head):
        slow = fast = head
        while fast and fast.next:
            slow, fast = slow.next, fast.next.next
            if slow is fast: break
        else:
            return head
        slow = head
        while slow is not fast:
            slow, fast = slow.next, fast.next
        cur = slow
        while cur.next is not slow:
            cur = cur.next
        cur.next = None
        return head
    java
    class ListNode { int val; ListNode next; }
    class Solution {
        ListNode removeLoop(ListNode head) {
            ListNode slow = head, fast = head;
            boolean loop = false;
            while (fast != null && fast.next != null) {
                slow = slow.next; fast = fast.next.next;
                if (slow == fast) { loop = true; break; }
            }
            if (!loop) return head;
            slow = head;
            while (slow != fast) { slow = slow.next; fast = fast.next; }
            ListNode cur = slow;
            while (cur.next != slow) cur = cur.next;
            cur.next = null;
            return head;
        }
    }
  8. 8

    Next Permutation: rearrange into the next lexicographically greater permutation, or the lowest if none.

    medium

    Find the rightmost index i where a[i] < a[i+1]. If none, reverse the whole array. Otherwise find the rightmost j with a[j] > a[i], swap them, and reverse the suffix after i. Time O(n), space O(1). Mistake: swapping with the first larger element on the right rather than the rightmost, or forgetting to reverse the suffix.

    python
    def next_permutation(a):
        i = len(a) - 2
        while i >= 0 and a[i] >= a[i + 1]: i -= 1
        if i >= 0:
            j = len(a) - 1
            while a[j] <= a[i]: j -= 1
            a[i], a[j] = a[j], a[i]
        a[i + 1:] = reversed(a[i + 1:])
    java
    class Solution {
        void nextPermutation(int[] a) {
            int i = a.length - 2;
            while (i >= 0 && a[i] >= a[i + 1]) i--;
            if (i >= 0) {
                int j = a.length - 1;
                while (a[j] <= a[i]) j--;
                int t = a[i]; a[i] = a[j]; a[j] = t;
            }
            for (int l = i + 1, r = a.length - 1; l < r; l++, r--) { int t = a[l]; a[l] = a[r]; a[r] = t; }
        }
    }
  9. 9

    Valid Parentheses with three bracket types.

    easy

    Push opening brackets on a stack; on a closing bracket the stack must be non-empty and its top must be the matching opener. At the end the stack must be empty. Time O(n), space O(n). Mistake: popping from an empty stack, or returning true when openers are left over, like '((' .

    python
    def is_valid(s):
        pair, st = {')': '(', ']': '[', '}': '{'}, []
        for c in s:
            if c in pair:
                if not st or st.pop() != pair[c]: return False
            else:
                st.append(c)
        return not st
    java
    import java.util.*;
    class Solution {
        boolean isValid(String s) {
            Deque<Character> st = new ArrayDeque<>();
            for (char c : s.toCharArray()) {
                if (c == '(' || c == '[' || c == '{') st.push(c);
                else {
                    if (st.isEmpty()) return false;
                    char o = st.pop();
                    if ((c == ')' && o != '(') || (c == ']' && o != '[') || (c == '}' && o != '{')) return false;
                }
            }
            return st.isEmpty();
        }
    }
  10. 10

    Search a 2D Matrix whose rows and first elements are sorted.

    medium

    Treat the matrix as one sorted array of m x n elements and binary search over the index range, converting a mid index to row = mid // n and column = mid % n. Time O(log(m n)), space O(1). Mistake: scanning rows linearly, or confusing this with the harder variant where only rows and columns are individually sorted, which needs a staircase search from a corner in O(m + n).

    python
    def search_matrix(m, t):
        if not m or not m[0]: return False
        R, C = len(m), len(m[0])
        lo, hi = 0, R * C - 1
        while lo <= hi:
            mid = (lo + hi) // 2
            v = m[mid // C][mid % C]
            if v == t: return True
            if v < t: lo = mid + 1
            else: hi = mid - 1
        return False
    java
    class Solution {
        boolean searchMatrix(int[][] m, int t) {
            if (m.length == 0 || m[0].length == 0) return false;
            int R = m.length, C = m[0].length, lo = 0, hi = R * C - 1;
            while (lo <= hi) {
                int mid = (lo + hi) >>> 1, v = m[mid / C][mid % C];
                if (v == t) return true;
                if (v < t) lo = mid + 1; else hi = mid - 1;
            }
            return false;
        }
    }

Frequently asked questions

How many coding questions are in Adobe's online test?

For the 2026 India hackathon Round 1, two coding questions alongside 15 multiple-choice questions in 60 minutes. Other pathways differ.

Which languages can I use?

The platform decides. Python and Java are common, and all ten problems here are given in both.

How should I split time in a 60-minute test?

Do the multiple-choice questions quickly, then give each coding question about 20 minutes, starting with the one you find easier.

Sources

Related guides

More in Company Interview Questions

See all in this section