0% found this document useful (0 votes)
9 views12 pages

Part 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views12 pages

Part 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

DEBUG WITH SHUBHAM

Accenture Technical Assessment Detailed Overview

Coding Question

https://www.youtube.com/@DebugWithShubham

https://www.linkedin.com/in/debugwithshubham/

https://www.instagram.com/debugwithshubham/

https://topmate.io/debugwithshubham

https://t.me/debugwithshubham
Coding Question 1
The function def differenceofSum(n. m) accepts two integers n, m as arguments Find the sum of all numbers
in range from 1 to m(both inclusive) that are not divisible by n. Return difference between sum of integers not
divisible by n with sum of numbers divisible by n.
Assumption:
• n>0 and m>0
• Sum lies between integral range
Example
Input
n:4
m:20
Output
90
Explanation
• Sum of numbers divisible by 4 are 4 + 8 + 12 + 16 + 20 = 60
• Sum of numbers not divisible by 4 are 1 +2 + 3 + 5 + 6 + 7 + 9 + 10 + 11 + 13 + 14 + 15 + 17 + 18 + 19
= 150
• Difference 150 – 60 = 90
Sample Input
n:3
m:10
Sample Output
19
Python

C++

JAVA
Coding Question 2
You are required to implement the following Function def LargeSmallSum(arr).
The function accepts an integers arr of size ’length’ as its arguments you are required to return the sum of second largest largest element
from the even positions and second smallest from the odd position of given ‘arr’.
Assumption:
• All array elements are unique
• Treat the 0th position a seven
NOTE
• Return 0 if array is empty
• Return 0, if array length is 3 or less than 3
Example:-
Input
arr:3 2 1 7 5 4
Output
7
Explanation
• Second largest among even position elements(1 3 5) is 3
• Second largest among odd position element is 4
• Thus output is 3+4 = 7
Sample Input
arr:1 8 0 2 3 5 6
Sample Output
8
Python C++

JAVA
Coding Question 3
Implement the following Function
The function def ProductSmallestPair(sum, arr) accepts an integers sum and an integer array arr of size n. Implement the
function to find the pair, (arr[j], arr[k]) where j!=k, Such that arr[j] and arr[k] are the least two elements of array (arr[j] + arr[k]
<= sum) and return the product of element of this pair
NOTE
• Return -1 if array is empty or if n<2
• Return 0, if no such pairs found
• All computed values lie within integer range
Example
Input
sum:9
Arr:5 2 4 3 9 7 1
Output
2
Explanation
Pair of least two element is (2, 1) 2 + 1 = 3 < 9, Product of (2, 1) 2*1 = 2. Thus, output is 2
Sample Input
sum:4
Arr:9 8 3 -7 3 9
Sample Output
-21
C++ JAVA
Python
Coding Question 4
A carry is a digit that is transferred to left if sum of digits exceeds 9 while adding two numbers from right-to-
left one digit at a time
You are required to implement the following function, Int NumberOfCarries(int num1 , int num2);
The functions accepts two numbers ‘num1’ and ‘num2’ as its arguments. You are required to calculate and
return the total number of carries generated while adding digits of two numbers ‘num1’ and ‘ num2’.
Assumption: num1, num2>=0
Example:
• Input
◦ Num 1: 451
◦ Num 2: 349
• Output
◦2
Explanation:
Adding ‘num 1’ and ‘num 2’ right-to-left results in 2 carries since ( 1+9) is 10. 1 is carried and (5+4=1) is 10,
again 1 is carried. Hence 2 is returned.
Sample Input
Num 1: 23
Num 2: 563
Sample Output
0
C++ JAVA
Python

You might also like