Accenture Coding Round Questions with Solutions
Last updated 2026-11-19
Accenture's coding round is commonly reported to be two easier problems in around 45 minutes. These ten problems practise that range with Python and Java solutions, complexity and the mistakes that lose marks.
Pair it with Accenture interview questions and how to crack the DSA coding round.
| Format | About two easier problems in ~45 minutes (prep sources) |
|---|---|
| Languages | Python and Java shown |
| Level | Easy, a few medium |
What the Accenture coding round looks like
Prep sources (FACE Prep and PlacementPreparation, listed below) describe the Accenture coding round as about two problems in roughly 45 minutes, on the easier side, usually string, array or number logic. Reports also describe language choices such as Python, Java, C and C++, though this varies by drive. The ten problems below match that level and are practice in the style of those topics, not a recorded paper. Because time is short, the winning habit is writing a correct simple solution first.
Time management for a two-problem, 45-minute round
- Read both problems first and start with the easier one.
- Write the plain solution, run the sample input, then test one edge case.
- Leave a few minutes at the end to re-read the output format.
- If a problem stays stuck for ten minutes, submit what passes and move on.
Accenture Coding Round Questions with Solutions: questions with worked answers
1 Check whether a sentence is a pangram
easyA pangram uses every letter a to z at least once. Put lower-cased letters in a set and compare its size with 26. Complexity: O(n) time, O(1) space. Common mistakes: counting characters instead of distinct letters and treating digits or punctuation as letters.
pythondef is_pangram(s): return len({c for c in s.lower() if 'a' <= c <= 'z'}) == 26 print(is_pangram("The quick brown fox jumps over the lazy dog")) # Truejavaclass Solution { static boolean isPangram(String s) { boolean[] seen = new boolean[26]; int n = 0; for (char c : s.toLowerCase().toCharArray()) if (c >= 'a' && c <= 'z' && !seen[c - 'a']) { seen[c - 'a'] = true; n++; } return n == 26; } }2 Frequency of each digit in a number
easyExtract digits with % 10 and / 10, incrementing a ten-slot array. Handle 0 explicitly, and accept the number as a string if it may be huge. Complexity: O(d) time, O(1) space. Common mistakes: skipping the case n = 0 (the loop never runs) and mishandling negatives.
pythondef digit_freq(n): f = [0] * 10 n = abs(n) if n == 0: f[0] = 1 while n: f[n % 10] += 1; n //= 10 return f print(digit_freq(112330)) # [1, 2, 1, 2, 0, 0, 0, 0, 0, 0]javaclass Solution { static int[] digitFreq(long n) { int[] f = new int[10]; n = Math.abs(n); if (n == 0) f[0] = 1; while (n > 0) { f[(int) (n % 10)]++; n /= 10; } return f; } }3 Intersection of two arrays (distinct values)
easyPut one array in a set and collect elements of the other that appear in it, using a result set to avoid duplicates. Complexity: O(m + n) time, O(m) space. Common mistakes: returning duplicates and sorting both arrays when a set is simpler.
pythondef intersect(a, b): return sorted(set(a) & set(b)) print(intersect([1, 2, 2, 1], [2, 2, 3])) # [2]javaimport java.util.*; class Solution { static List<Integer> intersect(int[] a, int[] b) { Set<Integer> s = new HashSet<>(), out = new TreeSet<>(); for (int x : a) s.add(x); for (int x : b) if (s.contains(x)) out.add(x); return new ArrayList<>(out); } }4 Rearrange positives and negatives alternately
mediumSeparate positives and negatives into two lists preserving order, then interleave them starting with a positive. Append the leftovers of the longer list at the end. Complexity: O(n) time, O(n) space. Common mistakes: assuming equal counts and losing relative order by sorting.
pythondef rearrange(a): pos = [x for x in a if x >= 0] neg = [x for x in a if x < 0] out, i, j = [], 0, 0 while i < len(pos) or j < len(neg): if i < len(pos): out.append(pos[i]); i += 1 if j < len(neg): out.append(neg[j]); j += 1 return out print(rearrange([1, 2, 3, -4, -1, 4])) # [1, -4, 2, -1, 3, 4]javaimport java.util.*; class Solution { static List<Integer> rearrange(int[] a) { List<Integer> pos = new ArrayList<>(), neg = new ArrayList<>(), out = new ArrayList<>(); for (int x : a) (x >= 0 ? pos : neg).add(x); int i = 0, j = 0; while (i < pos.size() || j < neg.size()) { if (i < pos.size()) out.add(pos.get(i++)); if (j < neg.size()) out.add(neg.get(j++)); } return out; } }5 Maximum consecutive ones in a binary array
easyKeep a running count that resets to 0 on a zero, and track the maximum. Complexity: O(n) time, O(1) space. Common mistakes: forgetting to update the maximum after the loop when only checking at zeros.
pythondef max_ones(a): best = cur = 0 for x in a: cur = cur + 1 if x == 1 else 0 best = max(best, cur) return best print(max_ones([1, 1, 0, 1, 1, 1])) # 3javaclass Solution { static int maxOnes(int[] a) { int best = 0, cur = 0; for (int x : a) { cur = x == 1 ? cur + 1 : 0; best = Math.max(best, cur); } return best; } }6 Happy number
mediumReplace the number by the sum of the squares of its digits repeatedly. It is happy if it reaches 1. Detect loops with a set of seen values (or Floyd's cycle detection). Complexity: O(log n) per step, O(1) steps in practice. Common mistakes: looping forever by not detecting a cycle, and treating 0 as happy.
pythondef is_happy(n): seen = set() while n != 1 and n not in seen: seen.add(n) n = sum(int(d) ** 2 for d in str(n)) return n == 1 print(is_happy(19), is_happy(4)) # True Falsejavaimport java.util.*; class Solution { static boolean isHappy(int n) { Set<Integer> seen = new HashSet<>(); while (n != 1 && seen.add(n)) { int s = 0; for (int t = n; t > 0; t /= 10) s += (t % 10) * (t % 10); n = s; } return n == 1; } }7 Check whether one string is a rotation of another
easyIf lengths are equal, s2 must appear inside s1 + s1. For example 'cdab' is inside 'abcdabcd'. Complexity: O(n) time with a linear substring search, O(n) space. Common mistakes: skipping the length check, which can accept a shorter string that merely sits inside s1 + s1.
pythondef is_rotation(a, b): return len(a) == len(b) and b in a + a print(is_rotation("abcd", "cdab"), is_rotation("abcd", "acbd")) # True Falsejavaclass Solution { static boolean isRotation(String a, String b) { return a.length() == b.length() && (a + a).contains(b); } }8 Count pairs with a given sum
easyUse a frequency map: for each element x, add the count of target - x seen so far, then record x. This counts each pair once and handles duplicates. Complexity: O(n) time, O(n) space. Common mistakes: counting each pair twice and pairing an element with itself.
pythonfrom collections import defaultdict def count_pairs(a, t): seen, c = defaultdict(int), 0 for x in a: c += seen[t - x] seen[x] += 1 return c print(count_pairs([1, 5, 7, -1, 5], 6)) # 3javaimport java.util.*; class Solution { static int countPairs(int[] a, int t) { Map<Integer, Integer> seen = new HashMap<>(); int c = 0; for (int x : a) { c += seen.getOrDefault(t - x, 0); seen.merge(x, 1, Integer::sum); } return c; } }9 Caesar cipher encryption
easyShift each letter by k positions within its case, wrapping modulo 26 and leaving non-letters unchanged. Use ((c - base + k) mod 26) + base. Complexity: O(n) time, O(n) space. Common mistakes: applying the shift to non-letters and mishandling negative k (use modulo that stays positive).
pythondef caesar(s, k): out = [] for c in s: if c.isalpha(): base = ord('A') if c.isupper() else ord('a') out.append(chr((ord(c) - base + k) % 26 + base)) else: out.append(c) return ''.join(out) print(caesar("Hello, World!", 3)) # Khoor, Zruog!javaclass Solution { static String caesar(String s, int k) { StringBuilder sb = new StringBuilder(); for (char c : s.toCharArray()) { if (Character.isLetter(c)) { char base = Character.isUpperCase(c) ? 'A' : 'a'; sb.append((char) ((c - base + k % 26 + 26) % 26 + base)); } else sb.append(c); } return sb.toString(); } }10 Strong number check (sum of digit factorials)
mediumA strong number equals the sum of the factorials of its digits (145 = 1! + 4! + 5!). Precompute factorials 0 to 9 once and sum them over the digits. Complexity: O(d) time, O(1) space. Common mistakes: recomputing factorials repeatedly and forgetting that 0! is 1.
pythonF = [1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880] def is_strong(n): return n == sum(F[int(d)] for d in str(n)) print([x for x in range(1, 2000) if is_strong(x)]) # [1, 2, 145]javaclass Solution { static final int[] F = {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880}; static boolean isStrong(int n) { int s = 0; for (int t = n; t > 0; t /= 10) s += F[t % 10]; return s == n; } }
Frequently asked questions
How many problems does Accenture's coding round have?
Prep sources report about two, in roughly 45 minutes, but this varies by drive.
Which languages are allowed?
Check your test instructions; Python, Java, C and C++ are commonly reported.
Is Accenture coding easy?
Commonly reported as easier than product-company tests, but with a tight time limit.
What after the coding round?
Prep sources describe a communication assessment and interviews; see Accenture interview questions.
Sources
Related guides
More in Company Interview Questions
- Accenture Interview Questions for Freshers
- Adobe Coding Round Questions with Solutions in Python and Java
- Adobe Interview Questions and Answers for SDE Roles
- Amazon Coding Round Questions with Solutions in Python and Java
- Amazon Interview Questions and Answers for SDE Roles
- AMD Coding Round Questions with Solutions
- AMD Interview Questions and Answers for India Software Roles
- American Express coding round questions with solutions
- American Express interview questions with answers (engineering)
- Analog Devices Coding Round Questions with Solutions
- Analog Devices Interview Questions and Answers for India Embedded and DSP Roles
- Apple Coding Round Questions with Solutions in Python and Java