Skip to content

Accenture Coding Questions

Practice with 20+ Accenture placement paper coding questions covering the Accenture NLT (National Level Test) coding section. These questions are representative of what you’ll encounter in Accenture’s online assessment and technical interviews.

What’s Included:

  • 20+ Coding Problems: Easy and Medium level problems with solutions
  • Multiple Language Solutions: Java, Python, and C++ solutions
  • Time Complexity Analysis: Every solution includes complexity analysis
  • Accenture-Specific Patterns: Focus on business logic and practical coding

Accenture NLT Coding Section Breakdown:

Section Questions Time Difficulty Focus Areas
Coding Test 2 30-35 min Easy-Medium Arrays, strings, basic algorithms, business logic

Languages Allowed: C, C++, Java, Python

Passing Criteria: Solve at least 1 problem completely with all test cases passing

Find Maximum and Minimum in Array

Problem: Find the maximum and minimum elements in an array.

Example:

Input: [3, 5, 1, 8, 2]
Output: Max: 8, Min: 1

Solution (Java):

public int[] findMaxMin(int[] arr) {
if (arr == null || arr.length == 0) return new int[]{};
int max = arr[0], min = arr[0];
for (int num : arr) {
if (num > max) max = num;
if (num < min) min = num;
}
return new int[]{max, min};
}

Solution (Python):

def find_max_min(arr):
if not arr:
return None, None
return max(arr), min(arr)

Time Complexity: O(n) | Space Complexity: O(1)

Second Largest Element

Problem: Find the second largest element in an array without sorting.

Example:

Input: [12, 35, 1, 10, 34, 1]
Output: 34

Solution (Java):

public int secondLargest(int[] arr) {
if (arr.length < 2) return -1;
int first = Integer.MIN_VALUE, second = Integer.MIN_VALUE;
for (int num : arr) {
if (num > first) {
second = first;
first = num;
} else if (num > second && num != first) {
second = num;
}
}
return second == Integer.MIN_VALUE ? -1 : second;
}

Solution (Python):

def second_largest(arr):
if len(arr) < 2:
return -1
first = second = float('-inf')
for num in arr:
if num > first:
second = first
first = num
elif num > second and num != first:
second = num
return second if second != float('-inf') else -1

Time Complexity: O(n) | Space Complexity: O(1)

Rotate Array by K Positions

Problem: Rotate an array to the left by k positions.

Example:

Input: arr = [1, 2, 3, 4, 5], k = 2
Output: [3, 4, 5, 1, 2]

Solution (Java):

public void rotateLeft(int[] arr, int k) {
int n = arr.length;
k = k % n;
reverse(arr, 0, k - 1);
reverse(arr, k, n - 1);
reverse(arr, 0, n - 1);
}
private void reverse(int[] arr, int start, int end) {
while (start < end) {
int temp = arr[start];
arr[start] = arr[end];
arr[end] = temp;
start++;
end--;
}
}

Solution (Python):

def rotate_left(arr, k):
n = len(arr)
k = k % n
return arr[k:] + arr[:k]

Time Complexity: O(n) | Space Complexity: O(1) or O(n)

Find Duplicate in Array

Problem: Find if there are any duplicates in an array.

Example:

Input: [1, 2, 3, 1]
Output: true (1 appears twice)

Solution (Java):

public boolean containsDuplicate(int[] nums) {
Set<Integer> seen = new HashSet<>();
for (int num : nums) {
if (seen.contains(num)) {
return true;
}
seen.add(num);
}
return false;
}

Solution (Python):

def contains_duplicate(nums):
return len(nums) != len(set(nums))

Time Complexity: O(n) | Space Complexity: O(n)

Sum of Array Elements

Problem: Find the sum of all elements in an array.

Example:

Input: [1, 2, 3, 4, 5]
Output: 15

Solution (Java):

public int sumArray(int[] arr) {
int sum = 0;
for (int num : arr) {
sum += num;
}
return sum;
}

Solution (Python):

def sum_array(arr):
return sum(arr)

Time Complexity: O(n) | Space Complexity: O(1)

Find Missing Number (1 to N)

Problem: Find the missing number in an array containing 1 to n.

Example:

Input: [1, 2, 4, 5, 6] (n = 6)
Output: 3

Solution (Java):

public int findMissing(int[] nums, int n) {
int expectedSum = n * (n + 1) / 2;
int actualSum = 0;
for (int num : nums) {
actualSum += num;
}
return expectedSum - actualSum;
}

Solution (Python):

def find_missing(nums, n):
expected = n * (n + 1) // 2
return expected - sum(nums)

Time Complexity: O(n) | Space Complexity: O(1)

Master one language

  • Choose Java, Python, or C++
  • Know standard library functions
  • Practice writing code quickly
  • Handle input/output properly

Focus on common patterns

  • Array manipulation
  • String processing
  • Mathematical operations
  • Pattern printing

Time management

  • 15-17 minutes per problem
  • Read problem carefully
  • Test with given examples
  • Handle edge cases

Common mistakes to avoid

  • Off-by-one errors
  • Not handling empty inputs
  • Integer overflow
  • Wrong output format
Practice More Accenture Coding Questions →

TCS · Infosys · Wipro · HCL · Cognizant · Capgemini


Practice Accenture coding questions regularly! Focus on array manipulation, string processing, and mathematical problems. These are the most common problem types in Accenture NLT.

Pro Tip: Accenture values working code that handles all test cases. Focus on correctness first, then optimize if time permits.