Autocoder

EPAM Coding Round Questions

Last updated 2026-11-19

Services-company coding tests tend to favour practical language tasks over contest puzzles: string manipulation, collections, sorting with comparators, streams and a small design or concurrency item. This page works through twelve such problems, mostly in Java, with one in Python and some SQL, each with a solution, complexity and the mistakes that trip candidates up.

They are practice problems in the style of those tasks and are not copies of any test. Read them with EPAM interview questions and the DSA coding round guide.

Languages hereJava, SQL, Python
ThemesStrings, collections, streams, concurrency, SQL
LevelEasy to medium

What these tasks reward

Correct handling of null, empty and duplicate input; use of the right collection; and code another developer can read. Know the standard library well enough that you do not hand-write what Collections, Arrays or streams already do, and be able to say the complexity of each call.

Hiring status

We hold no sourced information on EPAM tests, drives, openings or cutoffs, so none are stated. Use the company's own careers site for current information.

EPAM Coding Round Questions: questions with worked answers

  1. 1

    Check whether a string is a palindrome, ignoring case and non-alphanumeric characters.

    easy

    Use two pointers from both ends, skipping characters that are not letters or digits and comparing lowercased characters. O(n) time, O(1) space. Mistake: building a cleaned copy with regex and reversing, which works but uses O(n) extra space, and forgetting that an empty or all-punctuation string counts as a palindrome.

    java
    public class Pal {
        public static boolean isPalindrome(String s) {
            int i = 0, j = s.length() - 1;
            while (i < j) {
                while (i < j && !Character.isLetterOrDigit(s.charAt(i))) i++;
                while (i < j && !Character.isLetterOrDigit(s.charAt(j))) j--;
                if (Character.toLowerCase(s.charAt(i++)) != Character.toLowerCase(s.charAt(j--))) return false;
            }
            return true;
        }
    }
  2. 2

    Find the missing number in an array containing n distinct numbers from 0 to n.

    easy

    The sum of 0..n is n(n+1)/2; subtract the array sum. O(n) time, O(1) space. An XOR of all indices and values also works and avoids overflow concerns. Mistake: using int for large n where the sum overflows; use long.

    java
    public class Missing {
        public static int find(int[] a) {
            long n = a.length;
            long expected = n * (n + 1) / 2;
            long sum = 0;
            for (int x : a) sum += x;
            return (int) (expected - sum);
        }
    }
  3. 3

    Count the frequency of each word in a sentence and print words sorted by count descending, then alphabetically.

    easy

    Build a HashMap of counts with merge, then sort the entries with a comparator chain. O(n + m log m) for m distinct words. Mistake: sorting with only the count comparator and getting unstable alphabetical order, and splitting on a single space so multiple spaces create empty words; split on the regex \s+.

    java
    import java.util.*;
    import java.util.stream.*;
    
    public class Freq {
        public static List<String> run(String text) {
            Map<String, Integer> m = new HashMap<>();
            for (String w : text.toLowerCase().trim().split("\\s+")) m.merge(w, 1, Integer::sum);
            return m.entrySet().stream()
                .sorted(Map.Entry.<String, Integer>comparingByValue().reversed()
                    .thenComparing(Map.Entry.comparingByKey()))
                .map(e -> e.getKey() + "=" + e.getValue())
                .collect(Collectors.toList());
        }
    }
  4. 4

    Find the first non-repeating character in a string.

    medium

    Count characters in a LinkedHashMap (insertion ordered) or an array, then scan the string again for the first with count 1. Two passes: O(n) time, O(alphabet) space. Mistake: using a plain HashMap and iterating it, which has no order guarantee, or returning a character rather than handling the "none" case.

    python
    from collections import Counter
    
    def first_unique(s):
        cnt = Counter(s)
        for ch in s:
            if cnt[ch] == 1:
                return ch
        return None
    
    print(first_unique("swiss"))  # w
  5. 5

    Sort a list of employees by salary descending, then by name ascending, using a comparator.

    medium

    Use Comparator.comparingDouble with reversed for salary and thenComparing for the name. The sort is stable and O(n log n). Mistake: subtracting values in a hand-written compare, which overflows for large integers or fails on doubles; use the Comparator helpers or Integer.compare.

    java
    import java.util.*;
    
    record Emp(String name, double salary) {}
    
    public class Sorting {
        public static void sort(List<Emp> list) {
            list.sort(Comparator.comparingDouble(Emp::salary).reversed()
                      .thenComparing(Emp::name));
        }
    }
  6. 6

    Remove duplicates from a sorted array in place and return the new length.

    medium

    Keep a write index; copy an element when it differs from the last written one. O(n) time, O(1) space. Mistake: using a Set (extra space) when the array is sorted, and not returning the new length, since the tail contents after it are irrelevant.

    java
    public class Dedupe {
        public static int removeDuplicates(int[] a) {
            if (a.length == 0) return 0;
            int w = 1;
            for (int r = 1; r < a.length; r++) {
                if (a[r] != a[w - 1]) a[w++] = a[r];
            }
            return w;
        }
    }
  7. 7

    Implement a thread-safe singleton in Java.

    medium

    The cleanest options are an enum singleton or the initialisation-on-demand holder idiom: the JVM loads the holder class lazily and class initialisation is thread-safe, so no explicit locking is needed. Double-checked locking also works but requires the field to be volatile. Mistake: a lazy check without synchronisation, which can create two instances, or a double-checked version without volatile, which can expose a half-built object.

    java
    public class Config {
        private Config() {}
        private static class Holder {
            static final Config INSTANCE = new Config();
        }
        public static Config get() { return Holder.INSTANCE; }
    }
  8. 8

    Two threads must print odd and even numbers alternately up to N.

    medium

    Share a counter and a lock; each thread waits until the counter has its parity, prints, increments and notifies the other. Use wait inside a while loop and notifyAll. O(N) with context switches. Mistake: using if instead of while around wait, which breaks on spurious wakeups, and forgetting to terminate both threads when the counter passes N.

    java
    public class OddEven {
        private int n = 1;
        private final int max;
        OddEven(int max) { this.max = max; }
    
        synchronized void print(boolean odd) throws InterruptedException {
            while (n <= max) {
                if ((n % 2 == 1) == odd) {
                    System.out.println(n++);
                    notifyAll();
                } else {
                    wait();
                }
            }
            notifyAll();
        }
    
        public static void main(String[] args) throws Exception {
            OddEven o = new OddEven(10);
            Thread a = new Thread(() -> { try { o.print(true); } catch (InterruptedException e) {} });
            Thread b = new Thread(() -> { try { o.print(false); } catch (InterruptedException e) {} });
            a.start(); b.start(); a.join(); b.join();
        }
    }
  9. 9

    Reverse the words in a sentence, collapsing extra spaces.

    medium

    Split on whitespace, reverse the list and join with a single space. O(n). Mistake: reversing the entire string, which also reverses each word, and splitting on a single space, which leaves empty strings.

    java
    import java.util.*;
    
    public class Words {
        public static String reverse(String s) {
            List<String> parts = Arrays.asList(s.trim().split("\\s+"));
            Collections.reverse(parts);
            return String.join(" ", parts);
        }
    }
  10. 10

    SQL: find employees with the highest salary in each department.

    medium

    Rank within the department and keep rank 1; RANK keeps ties. A correlated subquery with MAX per department is the portable alternative. Mistake: GROUP BY department and selecting the name, which is invalid or arbitrary in most databases.

    sql
    SELECT name, department, salary
    FROM (
      SELECT e.*, RANK() OVER (PARTITION BY department ORDER BY salary DESC) AS r
      FROM employees e
    ) t
    WHERE r = 1;
  11. 11

    SQL: delete duplicate rows from a table, keeping the lowest id for each email.

    medium

    Keep the row with the minimum id per email and delete the rest. The derived-table form below works in PostgreSQL and many databases; MySQL needs the inner query wrapped as a derived table because it disallows selecting from the table being deleted. Mistake: running the delete without first running the equivalent SELECT to inspect what will go.

    sql
    DELETE FROM users
    WHERE id NOT IN (
      SELECT keep_id FROM (
        SELECT MIN(id) AS keep_id FROM users GROUP BY email
      ) k
    );
  12. 12

    Detect a cycle in a singly linked list and find where it starts.

    hard

    Floyd's algorithm: move a slow pointer by one and a fast pointer by two; if they meet there is a cycle. Then reset one pointer to the head and move both by one; they meet at the cycle start. O(n) time, O(1) space. Mistake: using a HashSet of nodes (works, but O(n) space) when constant space is requested, and null checks on fast and fast.next.

    java
    class Node { int val; Node next; Node(int v) { val = v; } }
    
    public class Cycle {
        public static Node start(Node head) {
            Node slow = head, fast = head;
            while (fast != null && fast.next != null) {
                slow = slow.next;
                fast = fast.next.next;
                if (slow == fast) {
                    slow = head;
                    while (slow != fast) { slow = slow.next; fast = fast.next; }
                    return slow;
                }
            }
            return null;
        }
    }

Frequently asked questions

What kind of coding problems suit EPAM preparation?

Strings, arrays, collections, comparators, streams, a singleton or threading task and SQL queries. Contest-level dynamic programming is less central than clean, correct code.

Should I solve in Java or Python?

Use your strongest language. Java is the most commonly practised for this kind of company; know the collections framework thoroughly.

Do I need Spring knowledge for the coding round?

Not for algorithmic tasks, but interviews often cover Spring and REST separately. See the interview questions page.

Are these actual EPAM test questions?

No, they are practice problems in the style of such tasks, not copies of any test.

How do I show quality in a timed test?

Name variables clearly, handle empty and null input, keep methods short and state the complexity in a comment.

Related guides

More in Company Interview Questions

See all in this section