Accenture Crack PDF
Accenture Crack PDF
CRACK
ACCENTURE
Find the Maximum Element in an Array: Write a function that finds the
G
maximum element in a given array of integers.
IN
Check if a String is a Palindrome: Write a function that checks if a given string
reads the same backward as forward.
D
with one missing element, write a function to find the missing number.
Find the Intersection of Two Arrays: Write a function that finds the elements
O
present in both a given pair of arrays.
C
Remove Duplicates from an Array: Write a function that removes duplicate
elements from a given array while preserving the order.
Find the Second Largest Element in an Array: Write a function that finds the
second largest element in a given array.
Merge Two Sorted Arrays: Write a function that merges two sorted arrays into
PR
Reverse a Linked List: Write a function that reverses a given linked list.
PRIME CODING
Accenture coding round Cheatsheet 1
PRIME CODING
Find the Lowest Common Ancestor in a Binary Tree: Write a function to find
the lowest common ancestor (LCA) of two given nodes in a binary tree.
Check if a Binary Tree is a Binary Search Tree (BST): Write a function that
checks if a given binary tree adheres to the properties of a BST.
Find the Level Order Traversal of a Binary Tree: Write a function that
performs a level-order traversal of a binary tree, returning the elements level
G
by level.
IN
Clone a Linked List with Random Pointers: Write a function that creates a
deep copy of a linked list where each node also has a random pointer to
another node in the list.
D
Find the Kth Largest Element in an Array: Write a function that finds the kth
largest element in a given array.
O
Find All Combinations of a Sum: Write a function that finds all unique
combinations of numbers in a given array that add up to a specific target sum.
C
Binary Operations on Strings: Write a function that performs binary
operations like AND, OR, and XOR on a given string of binary numbers with
E
respective operators.
operators (AND, OR, XOR), write a function to calculate the result by scanning
from left to right.
PR
Find the Maximum and Its Index in an Array: Write a function to find the
greatest number in an array and its index.
Food Distribution Among Rats: Given the number of rats and their food
requirement, write a function to determine if the food available in different
houses is sufficient.
You are given a function, intMaxExponents(int a, int b) Find and return the
number between ‘a’ and ‘b'(range inclusive on both ends) which has the
PRIME CODING
Accenture coding round Cheatsheet 2
PRIME CODING
maximum exponent of 2.
Form an array of 1000 integers and find out the second-largest number. If
there is no second-largest number, return the value to –1.
Adam decides to do some charity work. From day 1 till day x, he will give i^2
coins to charity. On the day ‘i’ (1 < = i < = x), find the number of coins he
gives to charity.
G
Find the sum of the divisors for the N integer number.
IN
Write a program that accepts the integer array of length ‘size’ and finds the
largest number that can be formed by permutation.
D
Write a function SmallLargeSum(array) which accepts the array as an
argument or parameter, that performs the addition of the second largest
O
element from the even location with the second largest element from an odd
location?
C
Rules
PRIME CODING
Accenture coding round Cheatsheet 3
PRIME CODING
Write a function FindMaxInArray, which will find the greatest number from
an array with its desired index? The greatest number and its desired index
should be printed in separate lines.
G
c. (a b) if the value of c=3.
d. (a / b) if the value of c=4.
IN
You are required to input the size of the matrix then the elements of matrix,
then you have to divide the main matrix in two sub matrices (even and odd)
in such a way that element at 0 index will be considered as even and
D
element at 1st index will be considered as odd and so on. Then you have sort
the even and odd matrices in ascending order and print the sum of second
O
largest number from both the matrices.
which are not divisible by m. You must also return the distinction between
the sum of integers not divisible by m with the sum of integers divisible by
m.
PR
Assumption
m > 0 and n > 0
Sum lies within the integral range
def LargeSmallSum(arr)
The function takes an integral arr which is of the size or length of its
arguments. Return the sum of the second smallest element at odd position
‘arr’ and the second largest element at the even position.
PRIME CODING
Accenture coding round Cheatsheet 4
PRIME CODING
Assumption
Array is 0 indexed.
Write a function to validate if the provided two strings are anagrams or not.
If the two strings are anagrams, then return ‘yes’. Otherwise, return ‘no’.
The given function has a string (str) and two characters, ch1 and ch2.
Execute the function in such a way that str returns to its original string, and
G
all the events in ch1 are replaced by ch2, and vice versa.
IN
Write a function to find roots of a quadratic equation ax^2 + bx + c = 0.
D
Perform a function to reverse a string word-wise. The input here will be the
string. In the output, the last word mentioned should come as the first word
and vice versa
O
Write a program to count the number of swaps required to sort a given list of
C
integers in ascending order using the selection sort algorithm.
The function accepts an integer array ‘arr’ of size ‘n’ as its argument. Each
E
The function accepts a character array ‘arr’ of size ‘n’ as its argument. Each
PR
element of ‘arr’ represents the status of a parking slot, where ‘S’ represents an
empty slot and ‘X’ represents an occupied slot. The function needs to return
the maximum number of cars that can be parked in the parking lot. It is
assumed that two cars cannot occupy the same slot and cars can only park in
consecutive empty slots.
The function accepts a string ‘str’ as its argument. The function needs to
return the transformed string by replacing all occurrences of the character ‘a’
with the character ‘b’ and vice versa.
PRIME CODING
Accenture coding round Cheatsheet 5
PRIME CODING
The function accepts an integer array ‘arr’ of size ‘n’ as its argument. The
function needs to return the index of an equilibrium point in the array, where
the sum of elements on the left of the index is equal to the sum of elements on
the right of the index. If no equilibrium point exists, the function should return
-1.
The function accepts an integer array ‘arr’ of size ‘n’ and an integer ‘d’ as its
argument. The function needs to rotate the array ‘arr’ by ‘d’ positions to the
right. The rotation should be done in place, without using any additional
G
memory.
The function accepts two strings ‘str1’ and ‘str2’ as its argument. The function
IN
needs to return the index of the first occurrence of substring ‘str2’ in string
‘str1’ or -1 if the substring is not found.
The function accepts a string ‘str’ as its argument. The function needs to
D
reverse the order of the words in the string.
O
Given an array of integers and an integer sum, find a pair of numbers (a, b) in
the array where a + b = sum.
C
Given an array of integers, find the maximum subarray sum. A subarray is a
contiguous subsequence of the array.
Given a string str, a character ch1, and a character ch2, replace all
E
Given an integer array, find the minimum value and its index in the array.
Given an array of integers, find the average of all positive numbers in the
array.
PR
Given an integer array and an integer element, check if the array contains the
element.
PRIME CODING
Accenture coding round Cheatsheet 6