Autocoder

Workday Coding Round Questions With Solutions

Last updated 2026-11-19

Workday coding questions are commonly reported at medium level, with problems that fit enterprise data: hierarchies like org charts, time ranges, lookups as of a date and rate limiting. The ten practice problems below follow that flavour, with the idea, code, complexity and a typical mistake.

They are practice problems, not real papers. For design and SQL questions see Workday interview questions, and for general strategy read how to crack a DSA coding round.

How to practise

Many of these map to trees and intervals, so rehearse BFS and DFS on a tree and sort-then-sweep on ranges. Say your complexity out loud, and test with an empty input and a single element.

Hiring status

We have no sourced Workday hiring dates, numbers or format details, so none are stated. Use the company's own careers site for current roles. See how to crack the online assessment for test strategy.

Workday Coding Round Questions With Solutions: questions with worked answers

  1. 1

    Total importance of an employee and all their reports (org chart DFS).

    medium

    Map ids to employee records, then DFS from the target, adding each person's importance and recursing into their direct reports. O(n). Use an explicit stack for very deep hierarchies. Mistake: scanning the whole list to find reports at every step, which makes it O(n squared).

    python
    def total_importance(employees, root_id):
        # employees: dict id -> (importance, [report ids])
        total, stack = 0, [root_id]
        while stack:
            e = stack.pop()
            imp, reports = employees[e]
            total += imp
            stack.extend(reports)
        return total
  2. 2

    Lowest common manager of two employees.

    medium

    Treat the org chart as a tree. Recurse: if the node is null or one of the two employees, return it; otherwise search both subtrees, and if both return a result the current node is the common manager. O(n). If each employee stores a manager pointer, climb from both using depth or a set of ancestors.

    java
    static Node lca(Node root, Node a, Node b) {
        if (root == null || root == a || root == b) return root;
        Node left = lca(root.left, a, b), right = lca(root.right, a, b);
        if (left != null && right != null) return root;
        return left != null ? left : right;
    }
  3. 3

    Time-based key-value store: get the value as of a timestamp.

    medium

    Store a list of (timestamp, value) per key, appended in increasing time. For get, binary search for the last timestamp not after the query. O(log n) per get, O(1) per set. This is the same logic as effective-dated records. Mistake: using an exact-match dictionary lookup, which misses the most recent earlier value.

    python
    from bisect import bisect_right
    from collections import defaultdict
    
    class TimeMap:
        def __init__(self):
            self.ts, self.vals = defaultdict(list), defaultdict(list)
        def set(self, key, value, t):
            self.ts[key].append(t)
            self.vals[key].append(value)
        def get(self, key, t):
            i = bisect_right(self.ts[key], t)
            return self.vals[key][i - 1] if i else ''
  4. 4

    Insert a new interval into a sorted list of non-overlapping intervals.

    medium

    Copy intervals that end before the new one starts, merge all that overlap by taking the minimum start and maximum end, then copy the rest. O(n). Mistake: sorting again, which wastes time, or using strict comparisons so touching intervals are not merged.

    python
    def insert_interval(intervals, new):
        out, i, n = [], 0, len(intervals)
        while i < n and intervals[i][1] < new[0]:
            out.append(intervals[i]); i += 1
        while i < n and intervals[i][0] <= new[1]:
            new = [min(new[0], intervals[i][0]), max(new[1], intervals[i][1])]
            i += 1
        out.append(new)
        out += intervals[i:]
        return out
  5. 5

    Logger rate limiter: print a message only if not printed in the last 10 seconds.

    easy

    Keep a dictionary from message to the last time it was printed. Allow if the message is new or at least 10 seconds have passed, and update the time when allowed. O(1) per call. Mistake: updating the time even when the message was suppressed, which extends the quiet period forever. Clean old entries periodically to bound memory.

    python
    class Logger:
        def __init__(self):
            self.last = {}
        def should_print(self, t, msg):
            if msg not in self.last or t - self.last[msg] >= 10:
                self.last[msg] = t
                return True
            return False
  6. 6

    Three sum: unique triplets that add up to zero.

    medium

    Sort the array. For each index i, use two pointers on the rest, moving inward based on the sum, and skip duplicates for i and for the found pairs. O(n squared) time. Mistake: skipping duplicates incorrectly, which either repeats triplets or drops valid ones.

    python
    def three_sum(a):
        a.sort()
        out = []
        for i in range(len(a) - 2):
            if i and a[i] == a[i - 1]:
                continue
            l, r = i + 1, len(a) - 1
            while l < r:
                s = a[i] + a[l] + a[r]
                if s < 0:
                    l += 1
                elif s > 0:
                    r -= 1
                else:
                    out.append([a[i], a[l], a[r]])
                    l += 1
                    while l < r and a[l] == a[l - 1]:
                        l += 1
        return out
    java
    static java.util.List<java.util.List<Integer>> threeSum(int[] a) {
        java.util.Arrays.sort(a);
        java.util.List<java.util.List<Integer>> out = new java.util.ArrayList<>();
        for (int i = 0; i < a.length - 2; i++) {
            if (i > 0 && a[i] == a[i - 1]) continue;
            int l = i + 1, r = a.length - 1;
            while (l < r) {
                int s = a[i] + a[l] + a[r];
                if (s < 0) l++;
                else if (s > 0) r--;
                else {
                    out.add(java.util.Arrays.asList(a[i], a[l], a[r]));
                    l++;
                    while (l < r && a[l] == a[l - 1]) l++;
                }
            }
        }
        return out;
    }
  7. 7

    Count subarrays whose sum is divisible by K.

    medium

    Track prefix sums modulo K with a frequency map. Two equal remainders mean the subarray between them has a sum divisible by K. Normalise negative remainders in languages where modulo can be negative. O(n). Mistake: forgetting to count the empty prefix (remainder zero once).

    python
    from collections import defaultdict
    
    def subarrays_div_by_k(a, k):
        cnt = defaultdict(int)
        cnt[0] = 1
        p = res = 0
        for x in a:
            p = (p + x) % k
            res += cnt[p]
            cnt[p] += 1
        return res
  8. 8

    Can a person attend all meetings?

    easy

    Sort meetings by start time and check that each starts at or after the previous one ends. O(n log n). If asked for the number of rooms, use a sweep or a min-heap of end times. Mistake: treating a meeting that starts exactly when another ends as a conflict.

    python
    def can_attend(meetings):
        meetings.sort()
        return all(meetings[i][0] >= meetings[i - 1][1] for i in range(1, len(meetings)))
  9. 9

    Top K earners in each department.

    medium

    Group employees by department, and for each group take the K largest salaries with a heap of size K or sort descending and slice. O(n log K) overall. In SQL this is a DENSE_RANK or ROW_NUMBER partitioned by department. Mistake: using a global sort and slicing, which ignores departments.

    python
    import heapq
    from collections import defaultdict
    
    def top_k_per_dept(rows, k):
        # rows: (name, dept, salary)
        groups = defaultdict(list)
        for name, dept, sal in rows:
            groups[dept].append((sal, name))
        return {d: [n for s, n in heapq.nlargest(k, v)] for d, v in groups.items()}
  10. 10

    Level-by-level report of an org chart (employees at each management depth).

    easy

    BFS from the CEO, processing one level at a time and listing the people in each level. O(n). The depth of each person is their management distance from the top. Mistake: using DFS, which loses the level grouping unless depth is carried explicitly.

    python
    from collections import deque
    
    def org_levels(reports, ceo):
        # reports: dict manager -> list of direct reports
        out, q = [], deque([ceo])
        while q:
            out.append(list(q))
            for _ in range(len(q)):
                q.extend(reports.get(q.popleft(), []))
        return out

Frequently asked questions

How hard is the Workday coding round?

Commonly reported as medium level. Practise trees, intervals, hashing and two pointers.

Which language is best?

Java is common for Workday roles, but use the language your platform allows and you know best.

Are there MCQs in the assessment?

Some candidate accounts mention MCQs. Your invitation will state the format.

How can I practise design?

Use the questions on Workday interview questions and sketch classes and tables before coding.

Related guides

More in Company Interview Questions

See all in this section