Sopra Steria coding round questions
Last updated 2026-11-19
Sopra Steria is a European consulting and software group whose work spans banking platforms, public administration, aerospace and defence IT. For graduate hiring in India, candidates generally describe an online round that blends aptitude, English and technical questions with a modest programming portion. The company has not released a syllabus we can quote, so the problems here are our own practice material in the same easy to medium range.
Each of the twelve questions has a short story from a bank, a ticket desk or a civic records office, followed by Java and Python code, or SQL where the task is a query. Complexity and the most likely mistake are written beside each. For the human rounds, see Sopra Steria interview questions.
| Round style (commonly reported) | Aptitude, English and technical sections with a coding part |
|---|---|
| Practice difficulty | Easy to medium, one harder dynamic-programming item |
| Code shown | Java, Python and two SQL queries |
Pacing a balanced paper
When coding is only one block of a longer test, finishing one hard problem perfectly is worth less than finishing two easier ones. Scan the coding section first, solve the question you can do from memory, and then take on the next. Partial credit for passing some test cases is common on online judges, so a working brute force beats a half-written clever idea.
Reading is a skill here as well. The English section and the problem statements share the same habit: slow down on the sentence that carries the constraint, such as whether numbers can be negative or whether the input may be empty.
Dynamic programming in small doses
Three of the problems, minimum notes, non-adjacent sums and the increasing subsequence, are dynamic programming at different depths. Do them in that order. For each, write the recurrence in words before any code, say what the state means, and only then decide whether a table or two running variables is enough. The wider topic is covered in dynamic programming interview questions.
Hiring status
We have no sourced Sopra Steria statement on fresher numbers, dates or eligibility and so state none. Check the invitation you receive and the company's careers site. For the SQL items, the SQL interview guide gives extra drills.
Sopra Steria coding round questions: questions with worked answers
1 Two account codes are written as binary strings, such as "1011" and "110". Return their sum as a binary string without converting to integers.
easySchoolbook addition from the right. Walk both strings from the end with a carry, add the digits and carry, emit the sum modulo 2 and carry the sum divided by 2. Continue while either string has digits or a carry remains. O(max(m, n)) time and space. Stopping when the shorter string ends drops the carry and the remaining digits of the longer one.
javaclass BinAdd { static String addBinary(String a, String b) { StringBuilder sb = new StringBuilder(); int i = a.length() - 1, j = b.length() - 1, carry = 0; while (i >= 0 || j >= 0 || carry > 0) { int s = carry; if (i >= 0) s += a.charAt(i--) - '0'; if (j >= 0) s += b.charAt(j--) - '0'; sb.append(s % 2); carry = s / 2; } return sb.length() == 0 ? "0" : sb.reverse().toString(); } }pythondef add_binary(a, b): i, j, carry, out = len(a) - 1, len(b) - 1, 0, [] while i >= 0 or j >= 0 or carry: s = carry if i >= 0: s += int(a[i]) i -= 1 if j >= 0: s += int(b[j]) j -= 1 out.append(str(s % 2)) carry = s // 2 return "".join(reversed(out)) or "0"2 Given an array of treasury bond yields (in basis points) and a number k, count the distinct pairs of values whose difference is exactly k.
mediumHash set lookup. For each distinct value x, check whether x + k is also in the set. That counts every unordered pair once. O(n) time, O(n) space. The case k = 0 needs separate handling: count values that occur at least twice, since a value cannot pair with its own single occurrence. Taking the absolute difference for negative k avoids double counting.
javaimport java.util.*; class Pairs { static int countPairs(int[] a, int k) { k = Math.abs(k); Map<Integer, Integer> freq = new HashMap<>(); for (int x : a) freq.merge(x, 1, Integer::sum); int count = 0; for (Map.Entry<Integer, Integer> e : freq.entrySet()) { if (k == 0) { if (e.getValue() > 1) count++; } else if (freq.containsKey(e.getKey() + k)) count++; } return count; } }pythonfrom collections import Counter def count_pairs(a, k): k = abs(k) freq = Counter(a) if k == 0: return sum(1 for v in freq.values() if v > 1) return sum(1 for x in freq if x + k in freq)3 Validate an IPv4 address given as text for a network-inventory tool: four dot-separated decimal parts, each 0 to 255, with no leading zeros except for a lone zero.
mediumSplit on dots and test every part. There must be exactly four, each non-empty and all digits, with a value no larger than 255 and no leading zero unless the part is "0". O(length). Calling int() on the text alone accepts forms like "+1" or " 7" in some languages, so check the characters first. Splitting with a limit hides a trailing dot.
javaclass Ip { static boolean validIpv4(String s) { String[] p = s.split("\\.", -1); if (p.length != 4) return false; for (String part : p) { if (part.isEmpty() || part.length() > 3) return false; for (char c : part.toCharArray()) if (c < '0' || c > '9') return false; if (part.length() > 1 && part.charAt(0) == '0') return false; if (Integer.parseInt(part) > 255) return false; } return true; } }pythondef valid_ipv4(s): parts = s.split(".") if len(parts) != 4: return False for p in parts: if not p or len(p) > 3 or not (p.isascii() and p.isdigit()): return False if len(p) > 1 and p[0] == "0": return False if int(p) > 255: return False return True4 An ATM holds notes of given denominations. What is the fewest notes that make exactly a withdrawal amount, or -1 if it cannot be made?
mediumCoin-change dynamic programming. Let best[v] be the fewest notes for value v; best[0] = 0, and best[v] is one plus the minimum of best[v - note] over notes not exceeding v. O(amount x notes) time, O(amount) space. Greedy largest-first fails for sets such as {1, 3, 4} with amount 6, where 3 + 3 beats 4 + 1 + 1. Use a sentinel larger than any real count, not zero, for unreachable values.
javaimport java.util.*; class Atm { static int fewestNotes(int[] notes, int amount) { int[] best = new int[amount + 1]; Arrays.fill(best, amount + 1); best[0] = 0; for (int v = 1; v <= amount; v++) { for (int n : notes) { if (n <= v) best[v] = Math.min(best[v], best[v - n] + 1); } } return best[amount] > amount ? -1 : best[amount]; } }pythondef fewest_notes(notes, amount): INF = amount + 1 best = [0] + [INF] * amount for v in range(1, amount + 1): for n in notes: if n <= v: best[v] = min(best[v], best[v - n] + 1) return -1 if best[amount] >= INF else best[amount]5 A charity drive collects donations at consecutive counters, but two neighbouring counters cannot both be used. Choose counters to maximise the total collected.
mediumTake-or-skip recurrence. For each amount, the best so far is the larger of skipping it (the previous best) or taking it (the best from two steps back plus the amount). Two running variables replace the table: O(n) time, O(1) space. Initialising both variables to the first element breaks the single-element case; start both at zero.
javaclass Drive { static int maxCollect(int[] amt) { int skip = 0, take = 0; for (int x : amt) { int next = Math.max(take, skip + x); skip = take; take = next; } return take; } }pythondef max_collect(amt): skip = take = 0 for x in amt: skip, take = take, max(take, skip + x) return take6 Find the length of the longest strictly increasing subsequence in a series of daily exchange rates.
hardPatience technique. Keep a list where tails[i] is the smallest possible last value of an increasing subsequence of length i + 1. For each rate, find with binary search the first tail that is at least the rate and replace it; append if none exists. The list length is the answer. O(n log n) time, O(n) space. The list itself is not a valid subsequence, which surprises many candidates. Using an upper bound instead of a lower bound would allow equal values, which is wrong for strict growth.
javaimport java.util.*; class Lis { static int lengthOfLis(int[] a) { int[] tails = new int[a.length]; int size = 0; for (int x : a) { int pos = Arrays.binarySearch(tails, 0, size, x); if (pos < 0) pos = -(pos + 1); tails[pos] = x; if (pos == size) size++; } return size; } }pythonfrom bisect import bisect_left def length_of_lis(a): tails = [] for x in a: i = bisect_left(tails, x) if i == len(tails): tails.append(x) else: tails[i] = x return len(tails)7 Remove the n-th node from the end of a singly linked list of citizen records in a single pass and return the head.
mediumGap of n between two pointers. Put a dummy node before the head, advance a fast pointer n steps, then move fast and slow together until fast reaches the last node; slow then stands just before the target. O(length) time, O(1) space. The dummy node makes deleting the head the same as any other deletion. Moving fast n + 1 steps from the head instead of n from the dummy is a common off-by-one.
javaclass ListNode { int val; ListNode next; ListNode(int v) { val = v; } } class Records { static ListNode removeFromEnd(ListNode head, int n) { ListNode dummy = new ListNode(0); dummy.next = head; ListNode fast = dummy, slow = dummy; for (int i = 0; i < n; i++) fast = fast.next; while (fast.next != null) { fast = fast.next; slow = slow.next; } slow.next = slow.next.next; return dummy.next; } }pythonclass ListNode: def __init__(self, val, nxt=None): self.val, self.next = val, nxt def remove_from_end(head, n): dummy = ListNode(0, head) fast = slow = dummy for _ in range(n): fast = fast.next while fast.next: fast, slow = fast.next, slow.next slow.next = slow.next.next return dummy.next8 For each day in a list of temperatures, report how many days you must wait for a warmer one, or 0 if none comes.
mediumMonotonic stack of indices. Keep indices of days still waiting for a warmer day, with temperatures decreasing from bottom to top. When a new day is warmer than the top, pop it and record the index gap, repeating while the condition holds. Every index is pushed and popped once, so O(n) time and O(n) space. The brute-force nested loop is O(n^2). Storing temperatures rather than indices loses the distance.
javaimport java.util.*; class Weather { static int[] waitDays(int[] t) { int[] ans = new int[t.length]; Deque<Integer> st = new ArrayDeque<>(); for (int i = 0; i < t.length; i++) { while (!st.isEmpty() && t[st.peek()] < t[i]) { int j = st.pop(); ans[j] = i - j; } st.push(i); } return ans; } }pythondef wait_days(t): ans, st = [0] * len(t), [] for i, x in enumerate(t): while st and t[st[-1]] < x: j = st.pop() ans[j] = i - j st.append(i) return ans9 Sort a list of department names by length first and alphabetically among names of equal length.
easyCompound ordering. Sort with a key of length then the text itself, or chain comparators. O(n log n) comparisons. In Java the comparator must be consistent: comparing lengths by subtraction is safe here but alphabetical order should use compareTo. The typical error is sorting alphabetically first and then by length with an unstable sort, which scrambles ties.
javaimport java.util.*; class Names { static void sortNames(List<String> names) { names.sort(Comparator.comparingInt(String::length).thenComparing(w -> w)); } }pythondef sort_names(names): return sorted(names, key=lambda w: (len(w), w))10 Clean a name typed into a registration form: drop any character that is not a letter or space, collapse repeated spaces and capitalise each word.
easyFilter, split, rebuild. Keep letters and whitespace, split on whitespace (which also trims and collapses), then title-case each token and join with one space. O(n). Using a title() helper directly is risky on strings with apostrophes, which is why the filter step comes first here. Splitting on a single space leaves empty tokens when spaces repeat.
javaimport java.util.*; class NameClean { static String clean(String s) { StringBuilder kept = new StringBuilder(); for (char c : s.toCharArray()) { if (Character.isLetter(c) || Character.isWhitespace(c)) kept.append(c); } StringJoiner out = new StringJoiner(" "); for (String w : kept.toString().trim().split("\\s+")) { if (w.isEmpty()) continue; out.add(Character.toUpperCase(w.charAt(0)) + w.substring(1).toLowerCase()); } return out.toString(); } }pythondef clean(s): kept = "".join(c for c in s if c.isalpha() or c.isspace()) return " ".join(w[0].upper() + w[1:].lower() for w in kept.split())11 Tables departments(id, name) and employees(id, dept_id). List the departments that have no employees.
easyAnti-join. LEFT JOIN departments to employees and keep rows where the employee side is NULL, meaning no match. An alternative is NOT EXISTS with a correlated subquery, which reads clearly and handles NULLs in dept_id safely. NOT IN with a subquery returns nothing at all if the subquery contains a NULL, which is the classic trap.
sqlSELECT d.id, d.name FROM departments d LEFT JOIN employees e ON e.dept_id = d.id WHERE e.id IS NULL ORDER BY d.name;12 Table tickets(id, team, status) with statuses OPEN and CLOSED. Produce one row per team with the number of open tickets, closed tickets and total.
mediumConditional aggregation. GROUP BY team and count rows per status with SUM over a CASE expression that returns 1 or 0, then add COUNT(*) for the total. One scan of the table. Using WHERE status = 'OPEN' would remove the closed rows before they could be counted, so the filter has to live inside the aggregate.
sqlSELECT team, SUM(CASE WHEN status = 'OPEN' THEN 1 ELSE 0 END) AS open_tickets, SUM(CASE WHEN status = 'CLOSED' THEN 1 ELSE 0 END) AS closed_tickets, COUNT(*) AS total FROM tickets GROUP BY team ORDER BY team;
Frequently asked questions
How tough is the Sopra Steria coding portion?
Candidates describe it as easy to medium within a wider test of aptitude, English and technical questions. Treat the three dynamic-programming problems here as the stretch goal.
Do I need all of Java, Python and SQL?
No. Pick one general-purpose language for the coding questions and get comfortable with basic SQL, because services roles tend to touch databases.
Is dynamic programming really tested at this level?
It can appear as a simple one-dimensional recurrence. The notes and non-adjacent-sum problems here are at that depth; the increasing subsequence is optional.
What should I do when I cannot finish a problem?
Submit the version that passes the sample cases, note the idea you did not complete, and move on. Partial test-case credit is common on online judges.
Where can I check the real hiring process?
On Sopra Steria's own careers pages and in the mail you receive. Nothing on this page states dates, numbers or cutoffs.
Related guides
More in Company Interview Questions
- Sopra Steria interview questions and answers
- Sprinklr Coding Round Questions With Solutions
- Sprinklr Interview Questions and Answers
- Swiggy Coding Round Questions with Solutions
- Swiggy Interview Questions and Answers
- Synopsys Coding Round Questions with Solutions
- Synopsys Interview Questions and Answers for India R&D Software Roles
- Target Coding Round Questions
- Target Interview Questions with Answers
- TCS Coding Round Questions with Solutions
- TCS Interview Questions for Freshers
- Tech Mahindra Coding Round Questions with Solutions