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 here | Java, SQL, Python |
|---|---|
| Themes | Strings, collections, streams, concurrency, SQL |
| Level | Easy 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 Check whether a string is a palindrome, ignoring case and non-alphanumeric characters.
easyUse 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.
javapublic 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 Find the missing number in an array containing n distinct numbers from 0 to n.
easyThe 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.
javapublic 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 Count the frequency of each word in a sentence and print words sorted by count descending, then alphabetically.
easyBuild 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+.
javaimport 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 Find the first non-repeating character in a string.
mediumCount 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.
pythonfrom 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")) # w5 Sort a list of employees by salary descending, then by name ascending, using a comparator.
mediumUse 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.
javaimport 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 Remove duplicates from a sorted array in place and return the new length.
mediumKeep 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.
javapublic 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 Implement a thread-safe singleton in Java.
mediumThe 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.
javapublic class Config { private Config() {} private static class Holder { static final Config INSTANCE = new Config(); } public static Config get() { return Holder.INSTANCE; } }8 Two threads must print odd and even numbers alternately up to N.
mediumShare 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.
javapublic 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 Reverse the words in a sentence, collapsing extra spaces.
mediumSplit 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.
javaimport 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 SQL: find employees with the highest salary in each department.
mediumRank 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.
sqlSELECT 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 SQL: delete duplicate rows from a table, keeping the lowest id for each email.
mediumKeep 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.
sqlDELETE FROM users WHERE id NOT IN ( SELECT keep_id FROM ( SELECT MIN(id) AS keep_id FROM users GROUP BY email ) k );12 Detect a cycle in a singly linked list and find where it starts.
hardFloyd'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.
javaclass 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
- EPAM Interview Questions with Answers
- EY coding round questions
- EY interview questions and answers
- Fidelity Investments coding round questions with solutions
- Fidelity Investments interview questions with answers (engineers)
- Flipkart Coding Round Questions with Solutions
- Flipkart Interview Questions and Answers
- Fractal Analytics Coding Round Questions
- Fractal Analytics Interview Questions with Answers
- Freshworks Coding Round Questions with Solutions
- Freshworks Interview Questions and Answers
- Goldman Sachs coding round questions with solutions