Accenture 2023 Coding & Mock
Accenture 2023 Coding & Mock
Accenture 2023 Coding & Mock
Presented by-
Tekno UF
Welcome to a comprehensive guide designed to elevate your performance
in Accenture's online assessments for Lifetime (2023-24). This meticulously crafted
document offers an in-depth analysis and solutions for the coding challenges you'll
encounter, providing a strategic advantage in your preparation.
Discover the focal points of the assessments for various roles. Aspirants aiming for
PADA roles will find a concentration on Array and String-based queries, while those
eyeing ASE and AASE roles will encounter a broader scope, delving into Array, String,
and Dynamic Programming questions.
This document is not just a collection of questions and answers; it’s a strategic asset.
It goes beyond the ordinary, providing step-by-step solutions accompanied by
detailed analyses. It aims not only to equip you with answers but to fortify your
understanding of core coding principles.
Prepare yourself for success in Accenture's online assessments. Let this document
serve as your ally, offering insights and strategies to navigate through the
complexities of these evaluations. Elevate your performance and pave the way for a
successful assessment experience.
Package of Associate Software
Engineer :- 4.5 LPA
Asked for
All codes..............
26 Free Materials
Sum of Digits *Repeated - Aug,2021
You are required to implement the following function:
int DifferenceSumofDigits (int* arr, int n);
The function accepts an array arr of 'n positive integers as its argument. Let's suppose
Sum of digits of an integer f(x)
You are required to calculate the value of following:
F
F1= [f(arr[0])+f(arr[1])+ f(arr[2]) + ...f(arr[n-1])] %10
F2 = [(arr[0] + arr[1] + arr[2] + ... +arr[n-1])]%10.
F=F1-F2
U
and return the value of F.
Note: n > 0
Example:
o
Input:
arr: 11 14 16 10 9 8 24 5 43
n
n: 10
Output:
k
-4
Explanation:
The value of F, is (1 + 1) +(1+4)+(1+6) (1+0) + (9) + (8)
e
(2+4)+(5)+(4)+3 equal to 50 and 50%10=0 and the value of 11+14+16+10+9+8+24+ 5+4+3
which is equal to 104 and (104%10)=4 So , F=0-4=-4
T
(The first line represents "n", the second line represents the elements of the array arr)
Sample input
Input:
Arr: 16 18 20
n: 3
Sample Output
4
Click Here
26 Free Materials
Rearrange Array
You are required to implement the following function:
int ReArrangeArray( int arr, int len); The function accepts an array 'arr' of length 'len' as
its argument. You are required to re-arrange the elements : positive integers are on right,
but retaining their order of appearance as in the original array. Return the modified
array.
F
Note:
U
All operations are to be performed in-place i.e. you cannot use another array.
If 'arr' is NULL (None, in case of Python), then return NULL.
Assumption: Consider 0 as positive number.
o
Example:
Input: arr: 1 7-5 9-12 15
n
Output:
-5 -12 1 7 9 15
k
Explanation:
Re-arranging the elements of array {1, 7, -5, 9, -12, 15) such that negative integers are on
e
left and positive integers are (1,7, 9, 15) at the right.
T
Sample input
arr: -6 10 8 -5 -14 -17 23 -20 -18 -19
Sample Output
-6-5-14 -17 -20 -18 -19 10 8 23
Instructions.
This is a template based question, DO NOT write the "main" function. Your code is judged
by an automated system, do not write any additional
Welcome greeting message
Click Here
27 Free Materials
Apple Distribution *Asked @ Wipro also
F
his pals. Since B and C received an identical quantity of apples, the weight of the apples
they received must also be equal. A, however, is unable to divide an apple into multiple
U
pieces because he is currently without a knife. If there is a fair way to distribute all the
apples among his friends, let him know.
o
Example:-
Input:
3 100 200 100
n
Output:
Yes
ek
T
Click Here
27 Free Materials
HCF *Repeated - Aug,2021;Nov 23
Example :
input :
F
a:
675
U
b:
835
Output: 5
no
This seems to be very easy questions though it was asked to test
k
atleast the basic knowledge.
Te
Click Here
29 Free Materials
Ball and Box Problem
*Repeated - Aug,2021
F
Implement the function to find number of balls required to complete each row of the box
and return the total number of balls required, Assumption: arr[k] <= (k+1)^2
U
Note:
Return -1 if array is null or None (in the case of python).
Array Indexing starts from 0.
o
Example:
n
Input:
arr: 12 7 13
k
Output:
7
Explanation:
e
No. of balls each now needs - 1 4 9 16
No. of halls each row have - 1 2 7 13
T
Total number of balls required-> 0+2+2+3=7. Thus, output is 7.
Click Here
29 Free Materials
Keys Problem
*Repeated - Aug,2021
Few keys in the keyboards are not working properly. While typing, there are few alphabets
that gets included with multiple Occurrences.
This has cause a huge problem to the user.
Now they have to come up with a feature that removes all these duplicates alphabets
F
within a word.
Only those alphabets have to be removed which have occurred more than once exactly
adjacent to each other.
U
Example 1
Input:
o
"abciijklma" ->input string containing multiple occurrences of adjacent duplicate. Output:
n
"abcjklma" ->output string without any adjacent duplicate alphabets.
k
Explanation:
Consider the above string, it contains 2 I's next to each other. These are the ones that need
to be removed. There are also 2 a's, but they are not adjacent to each other.
Te
Click Here
19 Free Materials
JULY
ODD and EVEN
*Repeated - sep,2020
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 element at 1st index will be considered
as odd and so on. then you have to sort the even and odd matrices in ascending order
F
then print the sum of second largest number from both the matrices
Example
U
i/p
enter the size of array: 5 enter element at 0 index: 3
o
enter element at 1 index: 4 enter element at 2 index: 1
enter element at 3 index: 7
n
enter element at 4 index: 9
k
o/p
Sorted even array: 1 3 9
Sorted odd array: 4 7
Te
Click Here
19 Free Materials
JULY
Maximum Revenue Garage
A garage is represented as:
struct garage {
int bikes;
int cars;
int trucks;
F
implement the function MaxRevenue(struct garage garages[], int m) ;
The function accepts an array 'garages’ of type garage consisting of M elements at its
U
argument, each element of garages consists of three non-negative integers bikes, cars
and trucks referring to the count of bikes cars and trucks in a garage respectively.The
cost of servicing a bike, car and truck are 100,250 and 500 respectively. Implement the
o
function to calculate the revenue generated by each garage and return the maximum
revenue generated.
n
Revenue generated by garage = (100*bikes+ 250*cars + 500*trucks)
Note:
k
1. computed value lies within integer range
2. Return -1 if garages is null (or None in the case of python)
e
Example:
input:
T
4 (no of garage)
3 (elements in garage)
bikes cars trucks
6 8 2
5 7 8
14 10 11
11 13 5
output
9400
Click Here
20 Free Materials
JULY
MODIFIED ARRAY
The function accepts an integer array "arr" of size n.
Rearrange the given array in such a way that smallest element of array is the 1rst element
of array and 2nd element is the largest element of array, 2nd smallest element of array is
the 3rd element of array, 2nd largest element of the array is the 4th element of the array.
F
Note:
return Null if array is empty
Example:
U
input:
5 2 3 4 6 5 -2
output:
o
-2 6 2 5 3 5 4
kn
Te
Click Here
20 Free Materials
JULY
SMALL NUMBER PROBLEM
*Repeated - June,2023
Implement the following function
int* NextSmallerNumber (int a[], int n );
the function accepts an integer array 'a' of size n. replace each number of array with
nearest smaller number on its right in the array.
F
Assumptions: all integers are greater than zero
note:
return Null if array is Null. (None in case of python.)
U
Replace the number with -1 if no smaller number is present on its right
input:
o
3 2 11 7 6 5 6 1
output:
n
2 1 7 6 5 1 1 -1
ek
T
Click Here
20 Free Materials
JULY
DIVISIBILITY CHECK PROBLEM
*Repeated - June,2023
Implement the following function int NearestInteger (int num, int m);
The function accepts two positive integer num and a as it's argument.
implement the function to find and return a number value which
1. number is divisible by 'm'.
2. number is nearest to 'num. (have the least distance from num) .
F
Distance between two numbers is the number of integers between them.
Note:
U
if there are two numbers with least distance from 'num' which is divisible by m then
return the larger number.
o
input:
67
n
8
output:
k
64
Te
Click Here
21 Free Materials
JULY
FINE NUMBER PROBLEM
*Repeated - June,2022
The function accept two arrays 'a' and 'b' of size 'n' and 'm' respectively. Implement the
function to compute a fine number and return the same.
F
A fine number is the greatest number that can be obtained by taking the difference of
two numbers such that one of the two numbers is taken from array 'a' and other from
U
array 'b'.
input:
n: 5
o
m: 6
a: 1 2 3 4 5
n
b: 10 12 34 24 89
output:
k
88
e
input:
n: 4
T
m: 3
a: 6 7 8 11
b: 3 1 2
output: 10
Click Here
21 Free Materials
JULY
Standard Deviation
F
Formula Used:
Let sqrt(x) be square root of a positive integer 'x'
U
Average of data set
' arr[0]', 'arr[1]', 'arr[2]',
(A) = arr[0] + arr[1]+'arr[2]', 'arr[n-1]' .., 'arr[n-1]}/n
Std Deviation for data set
o
'arr[0]', 'arr[1]', 'arr[2]'. ..., arr[n-1]' :
sqrt{[(arr[0]-A)^2 + (arr[1] - A)^2 + (arr[2] - A)^² +........+(arr[n-1] -A)^2/n)
n
Note:
n>0
k
Example:
Input:
e
arr: 3 8 4 2 5 6 7
n: 7
T
Output:
2.00
Explanation:
The avg of no of array 'arr' is (3+8+4+2+5+6+7)/7.0 is 5 and std deviation is sqrt{(3-5.0)^2
+ (8-5.0)^2 + (4-5.0)^2+......+(7-5.0)^2)/7.0 which is 2.00, hence output is 2.00
Input:
arr: 10 15 17
n: 3
output:
2.94
Click Here
21 Free Materials
JULY
Count Binary
F
If n = 0 return -1
• Do not allocate extra memory
U
Example:
Input:
n:3
o
Output:
5
n
Explanation:
All possible 3 bit binary strings are 000, 001, 010, 011, 100,
k
101, 110 and 111. Count of binary strings without consecutive set bits is 5
(000,001,010,100 and 101 )
e
I/p :
T
4
o/p:
8
Click Here
22 Free Materials
JULY
Star Pattern
* *
* *
*
F
* *
* *
U
Only this much information was given. So try to solve .
no
ek
T
Click Here
22 Free Materials
JULY
Number Pattern
Input : 5
Output :
F
1 1
2 2
U
3 3
4 4
5
66
o
7 7
8 8
n
9 9
ek
Only this much information was given. So try to solve .
T
Click Here
22 Free Materials
JULY
Metro code
Ann recently began using the metro to work. We are aware that a single ride on the
metro costs one ruble. Ann also learned that she can purchase a unique ticket for the
rides (she can buy it several times). The price is b rubles. Ann calculated that she would
need to take the subway n times. Help Ann out by letting her know how much money
F
she must have in order to buy n rides.
Input
U
The four numbers n, m, a, b (1 n, m, a, b 1000) on a single line represent the number of
rides Ann has scheduled, the number of rides covered by the m ride ticket, the cost of a
one ride ticket, and the cost of a m ride ticket.
o
output:
Print a single integer the minimum sum in rubbles that Ann will need to spend .
n
input:
k
62 12
output:
e
6
T
input:
5223
output:
8
Click Here
23 Free Materials
JULY
Find Max
F
be printed in separate lines.
Note:
U
Array index starts with 0
Maximum element and its index should be separated by a line in the output.
Assume there is only 1 maximum element in the array.
o
Print exactly what is asked, do not print any additional greeting messages
Example:
n
Input:
23 45 82 27 66 12 78 13 71 86
k
Output:
86
e
9
T
Explanation : 86 is maximum element at index 9
Click Here
23 Free Materials
JULY
Distinct and Duplicate
*Repeated - July,2023
Problem Statement:-
Implement the following function:
int AdistinctandDuplicate(int a, int b, int c, int d);
The function accepts four integers 'a', 'b', 'c' and 'd' as its argument.
F
Implement the function to find the sum of distinct numbers and subtract the
duplicate number and return the difference ( sum of distinct numbers - duplicate
number).
U
For sum of distinct numbers add all numbers that appears only once For duplicate
numbers subtract the duplicate number only once.
o
i/p:
a: 5
b: 4
n
c: 4
d: 9
k
o/p:
e
10
T
Explanation:
Note: All computed values lie within integer range Example: Input: b: 4 C: 4 Output 10 2
distinct numbers are 5 and 9. Sum of distinct numbers 5+9-14. Duplicate number 4.
Difference Sum of distinct numbers-Duplicate number-14-4-10. Thus
the op is 10
Click Here
23 Free Materials
JULY
Ribbon Cutting
*Repeated - July,2023
F
Find the amount of ribbon pieces left over after the necessary cutting to aid
Polycarpus.
U
Input
The length of the original ribbon and the acceptable lengths of the ribbon pieces
following the cutting are indicated by the four space-separated integers n. a, b, and c (1
o
≤n, a, b, c≤4000) on the first line respectively. The digits a, b, and c may match.
Output
n
The greatest number of ribbon pieces that can be printed should be one number. There
will always be at least one successful ribbon-cutting.
k
input
e
5532
output
T
2
input
7552
output
2
Click Here
23 Free Materials
JULY
Find Average
*Repeated - June,2023
Calculate the average of numbers divisible by 3 and even at the same time You have
been given an array nums and N, where nums is the array and N will be its size
Return the average of the number divisible by 3 and should be even.
F
Input- An array of nums with size N has been given
Output- A single digit number should be return which is the average of all the required
number
U
i/p:
16 24 32 48 55 64 72
o
o/p:
48
kn
Te
Click Here
06 Free Materials
Aug
Bulbs
*Repeated - Aug,2021
Given an integer n, there are n no of bulbs, initially all the bulbs are on.
In the second round every second bulb is turned off, In the third round every third bulb
is flipped, In the final round the last bulb is turned on, what is the total no of bulbs that
are turned on, at the end of the rounds.
F
Example :
Input:
U
3
Output:
1
o
Input:1
1
Output:
n
0
ek
T
Sol in comment section
Click Here
06 Free Materials
Aug
Print 1rst K word
*Repeated - Aug,2021
F
U
no
ek
T
Sol in comment section
Click Here
07 Free Materials
Aug
Happy Number
*Repeated - 2022,23
A number is called happy if it leads to 1 after a sequence of steps wherein each step
number is replaced by the sum of squares of its digit that is if we start with Happy
Number and keep replacing it with digits square sum, we reach 1.
Examples:
F
Input:
n = 19
U
Output:
True
o
19 is Happy Number,
1^2+9^2 = 82
8^2 + 2^2 = 68
n
6^2+8^2 = 100
1^2 + 0^2 + 0^2 = 1
k
As we reached to 1, 19 is a Happy Number.
e
Input:
n = 20
T
Output:
False
Click Here
07 Free Materials
Aug
Armstrong Number
*Repeated - 2022
Given an integer input, the objective is to check whether or not the given input variable
is an Armstrong number. In order to do so, we check whether the sum of the digits of
each number to the power the length of the number is equal to the number itself or not.
If the number is the same as the original, it's an Armstrong number.
F
Example
Input:
U
371
Output:
It's an Armstrong Number
o
Explanation: 371 can also be represented as 3^3+ 7^3+ 1^3
kn
Te
Click Here
16 Free Materials
Aug
Chocolate Distribution
*Repeated - several times
You have a total of n chocolates that you want to distribute between two individuals, A
and B. However, there are specific conditions for the distribution:
Person A must receive more chocolates than person B.
Person B must receive at least one chocolate.
F
Write a function chocolate_distribution_ways (n) that takes an integer n as input and
returns the number of distinct ways you can distribute the chocolates between A and B,
satisfying the given conditions.
U
Input:
n (1 <= n <= 100): An integer representing the total number of chocolates.
Output:
o
Returns an integer representing the number of distinct ways the chocolates can be
distributed.
Ex:
n
chocolate_distribution ways (4)
# Returns 1
k
chocolate_distribution_ways (12)
# Returns 5
e
Explanation:
T
a, b
For 4 chocolates: (3, 1), is the valid distributions. For 6 chocolates: (11,1),(10,2), (9, 3), (8,
4), (7, 5) are the valid distributions.
Click Here
22 Free Materials
Aug
Rashid’s Game
Rashid dislikes being idle. Because of this, he creates games anytime he gets bored. He
came up with a game and decided to play it one dreary winter evening.
Given is a list of n numbers in sequence a. The player has multiple step options. He can
select an element from the sequence
F
(let's call it ak) and delete it in a single step, at which point all elements equal to ak + 1
and ak- 1 must likewise be eliminated from the series. The player receives ak points
U
after that action Being a perfectionist, Rashid made the decision to score as many
points as he could Aid him.
o
Input:
3
123
n
Output:
4
ek
T
Click Here
23 Free Materials
Aug
Special String
*Repeated - several times
F
Note: Each string contains only lowercase characters.
Input Format:
The first line contains T.
U
Each of the T subsequent lines contains string s.
Output Format:
Print the number of special strings.
o
Constraints:
1<=T<=100.
1<=string length < 5000.
n
Example:
Input
k
4
ab
e
xyz
aab
T
axb
Output:
2
Explanation:
For the third test case, we can have s1= "aa" and s2= "b". Since the given strings are the
concatenation of s1 and s2, where s1 contains all characters as 'a', 's2' contains all
characters as 'b', and both s1 and s2 are non-empty, hence, this is a special string. A
similar explanation can be framed for the first test case as well, and those are the only
two special strings in the given list of strings.
Click Here
27 Free Materials
Aug
Climbing Stairs
*Repeated - several times
Alice climbs a staircase and takes N steps to reach the top. In each turn Alice can climb
1 or M stairs. Find the minimum number of climbs to reach the top.
Input Format:
The input consists of a single line:
F
The first line contains two space separated integers N and M.
The input will be read from the STDIN by the candidate.
U
Output Format:
Print the number that represents the minimum number of climbs required to reach the
top.
o
The output will be matched to the candidate's output printed on the STDOUT.
Constraints:
n
• 1<=N<=10^9
• 1≤M<=10^9
k
Example:
e
Input:
51
T
Output:
5
Explanation:
Alice can reach the top by 0-> 1-> 2 -> 3-> 4 -> 5
Click Here
28 Free Materials
Aug
Add Numbers
Write a program to add two numbers ranging between -10000 and 10000. If the
numbers taken as input are not in specified range your output should be -1.
Example
F
Input:
1000
-1000
U
Example
Output:
0
o
Example
Input:
100000
n
8000
Example
k
Output:
-1
Te
Click Here
28 Free Materials
Aug
Trees & Sprinklers
*Repeated - Aug, 21
There are exactly N trees on a number line. Each tree stands at a unique integral point
T[i]. Exactly M water sprinklers are also placed on the same number line, with each
placed at a unique integral point S[i] A point can contain a tree as well as a water
sprinkler. A water sprinkler can provide its water to the trees, which are not more than k
F
units far in both directions from the water sprinklers. If k=0, then the water sprinklers
will only provide its water to the tree at the same point. Your task is to find the
minimum value of k such that all the trees receive water from the water sprinklers.
U
Input Format:
The first line contains an integer N denoting the number of trees on the number line.
o
The second line contains N space-separated integers where T[i] denotes the position of
the i’th tree.
The 3rd line contains an Integer M denoting the number of water sprinklers on the
n
number line
The fourth line contains M space-separated integers where s[i] denotes the position of
k
the i’th sprinklers.
Output Format:
e
Print the number that represents the minimum value of k possible.
T
Click Here
28 Free Materials
Aug
Trees & Sprinklers
*Repeated - Aug, 21
Constraints:
1<=N<=100
• 500 <T[i]<=500
1<=s[i]<=100
F
Example:
Input
N=5
U
trees= [-10, -5, 0, 5, 10]
M=3
sprinklers = [-8, 2, 7]
o
Output:
3
Input:
n
4
-2 3 5 8
k
2
16
e
Output:
3
T
Click Here
28 Free Materials
Aug
Password Checker
*Repeated - Multiple times
You are given a string str. Your task is to find the number of checks that is not satisfied
by the string str by checking the validation of the string str, if its a strong password or
not.
A password is a strong password only if:
F
It contains at least 6 characters and at most 22 characters.
It must contain at least one uppercase character, It must contain at least one lowercase
character.
U
It must contain at least two special characters (@,!,#, $, %,^,&*)
It must contain at least one numeric value.
It must not contain any two same consecutive character.
o
Input Format:
The input consists of a single line:
-The first line contains a string str.
n
Output Format:
k
-Print the number that represents the number of checks that is not satisfied by the str.
e
Constraints: 1<= |strs|<=100
Example:
T
Input : Test@123#
Output: 0
Explanation:
Password is of length 8 and does contain numeric values, one upper case character, one
lower case character and 2 special characters. Hence the answer is 0.
Sample input
abcd
Sample Output
4
Click Here
28 Free Materials
Aug
Cool String
*Repeated - Aug,22
Bob has a string S of length N that contains lowercase English alphabets only. A string is
considered a Cool String if the following condition meets.
Length of the string is even.
For all odd indices (1 <= N-1) S[1]== S[i+1] .
F
Alice asked you to find the minimum number of characters to remove from S to make it
a Cool String
Input Format:
U
The Input consists of a single line.
-The line contains a string s
The input will be read from the STDIN by the candidate
o
Output Format:
-Print the Number, that represents the minimum number of characters to be
n
removed to make it a Cool String.
k
Constraints:
1 <=S<=10^3
Example:
e
Input:
aabbdabdccc
T
Output:
3
Explanation:
We can remove characters with Indices 6, 7, and 9 to get the Cool String "aabbddcc"
Sample input
aabbcc
Sample Output
0
Click Here
28 Free Materials
Aug
Team Formation
*Repeated - Sep,23,
Alice is planning to organize a contest with 4 players in each team. There are two types
of players named Experienced and Freshers. To make the contest unbiased Alice wants
to have a team in such a way that each team must contain at least 1 Experienced and 1
Fresher. You are given N the number of Experienced and M the number of Freshers.
F
Your task is to determine the maximum number of team formations possible.
Note:
No team member can join more than one team.
U
Input Format:
The input consists of a single line:
-The first line contains two space-separated integers N and M.
o
Output Format:
Print the number that represents the maximum number of team formations possible.
n
The output will be matched to the candidate's output printed on the STDOUT.
k
Constraints:
1<=N<=10^9
1<=M<= 10^9
e
Example:
T
Input:
55
Output:
2
Explanation:
First team: 2 Experienced and 2 Freshers
Second team: 2 Experienced and 3 Freshers
Click Here
28 Free Materials
Aug
Factorial Calculation
*Repeated - Sep,23,
You are given an integer n. Your task is to write a function to calculate and return the
factorial of n.
A factorial of a non-negative integer n is the product of all positive integers less than or
equal to n.
F
Write a Python function named calculate_factorial that takes an integer n as an
argument and returns its factorial.
Input:
U
5
The input consists of a single integer n (0 <= n <= 12).
Output:
o
120
n
** Sometime they specify python for solving problems
ek
T
Click Here
29 Free Materials
Aug
Merry String
A string is called a "merry string" if the frequency of each letter in that string 1.
You are provided with a string S of length N. Find and print the number of merry
substrings of length four that can be formed from the given string if no such string
found then print '0'
F
Input format:
The input consists of two lines:
U
The first line contains N which represents the length of the string S
The second line contains the string S.
o
Output Format:
Find and print the number of merry substrings of length four that can be formed from
n
the given string. if no such string found then print '0',
k
Constraints:
4 ≤ N ≤ 104.
The input string should only consist of lower case English alphabets. Example:
e
Input:
9
T
abcdefgh
output:
4
i/p:
6
gffcgi
o/p
1
Click Here
30 Free Materials
Aug
Equal String
*Repeated - Sep,23
Alice gave you a binary string str containing only 0 and 1 and asked you to count the
unique subsequences which are equal string. Alice defines an Equal String as "A string
which contains an equal number of 1 and o. Your task is to print the total number of
Equal String that can be formed using the given binary string
F
Input Format:
The input consists of a single line::
The line contains a string str, representing the string to be checked.
U
Output Format: Print the count of the unique subsequences which are Equal String.
Constraints:
1<N ≤10^5
o
• str = {0,1}
Example:
n
Input:
001011
k
Output:
5
Explanation:
e
There is a total of 5 subsequences that are equal string.
01
T
10
0011
0101
001011
Sample input
0011
output
2
Click Here
30 Free Materials
Aug
Who is the winner
*Repeated - Sep,23
Elections are conducted in a town that has population N. All the people of the town,
cast votes in the various candidates in town. The people of the town then realized that
the votes of only for the candidates 18 and above years of age should be considered.
Find out the candidate who is the winner if only the votes of age group 18 and above are
F
considered If the winner cannot be decided or there is a tie, print -1.
You are given an array vote which represents the candidate to whom the vote is given
by the ith and another array of age which represents the age of that particular voter.
U
Input Format:
The input consists of three lines:
o
The first line will contain one value N, the size of the arrays.
The second line will contain N space separated positive integers denoting
n
the array of the vote.
The third line will contain N space-separated +ve integers denoting the array of age.
k
Output Format:
Print the number which represents the winner. If the winner cannot be decided or there
e
is a tie, print -1.
T
Constraints:
1<N<=200
Example:
Input:
10
1 1 2 3 4 1 2 2 3 1
24 13 35 15 50 16 20 18 25 64
Output:
2
Click Here
30 Free Materials
Aug
Who is the winner
*Repeated - Sep,23
Explanation:
So, candidate 1 gets 4 votes, candidate 2 gets 3 votes, candidate 3 gets 2 votes, and
candidate 4 gets 1 vote. But the 2nd and the 6th vote given to candidate 1 are from age
F
group. so they are not considered. So, the new vote count is candidate 1 gets 2 votes,
candidate 2 gets 3 votes, candidate 3 gets 2 votes and candidate 4 gets 1 vote.
U
input:
3
o
1 2 3
10 12 15
n
o/p:
-1
ek
T
Click Here
30 Free Materials
Aug
String Manipulation
*Repeated - Sep,23,
You are given a string str consisting of lower case English alphabets only and an integer
k. Your task is to arrange first k alphabets in increasing order then k alphabets in
decreasing order and so on according to the following pattern:
"abcdefghstuvwxyzijklmnopqr"
Print the resultant string.
F
Note:
. The pattern that needs to be followed to arrange the elements in increasing and
U
decreasing order is "abcdefghstuvwxyzjklmnopqr”
Input Format:
The input consists of a two lines:
The first line contains a string str.
o
The second line contains an Integer.
Output Format:
n
Print the resultant string.
Constraints:
k
15<=|str|<=200
1<=k<=6
e
Example:
Input:
T
tocmat
2
Output:
tomcat
inp:
madam
2
op:
amdam
Click Here
01 Free Materials
Sep
Class Toppers
*Repeated - Sep,23,
There are students in a class. you are given the marks of all the students represented by
an array marks. You want to maintain the equality in each section of the class. For that
you have to remove the students having marks. equal to the marks of two toppers.
For example if marks ={1, 2, 3, 4, 3), here you have two toppers having marks 3 and 4 but
two students got 3 marks, so you have to remove this student and send him to another
F
section.
Your task is to find the number of students you need to remove to maintain the
U
equality.
Input Format
The input consists of two lines:
o
The first line contains a single integer n.
The second line contains n space-separated integers denoting the array marks.
n
Output Format:
k
Print a number that represents the number of students to be removed to maintain the
equality.
e
Constraints:
T
2<=n<=10^5
1<=marks[i]<=100
Example:
Input:
5
90 80 90 80 70
Output:
2
Click Here
01 Free Materials
Sep
Class Toppers
*Repeated - Sep,23,
Explanation:
We have two toppers having marks 80 and 90. But there are two more students having
the same marks. So, the answer is 2
Sample input
F
2
78 90
U
Sample Output
0
no
ek
T
Click Here
01 Free Materials
Sep
The Energy and Jumps
*Repeated - Sep,23,
You want to defeat your enemy one last time. Your enemy is much stronger this time,
and it will require exactly T units of energy to defeat him. initially, you do not have any
energy. There are exactly N cities from where you can collect the energy. Initially, you
will enter the first city. Each city will give you some energy. The energy gains from the
cities are in non-decreasing order.
F
Every hour you can do one of the two following things: If you are in some city-u, you can
collect E[u] units of energy.
U
If you are in some city-u and have at least J[u] units of energy, you can spend J[u] units
of energy and jump to the city-u+1.
Your task in to find out the minimum number of hours required to defeat your enemy.
o
Input Format:
The input consists of three lines:
n
The first the contains two space-separated integers, N and T, denoting the number of
cities and the energy required to defeat the enemy respectively.
k
The second line contains N space separated integers denoting the elements of array E
The third line contains N-1 space-separated integers denoting the elements of the array
e
J.
The input will be read from the STDIN by the candidate
T
Output Format :
Print the minimum number of hours required to defeat your enemy.
Constraints :
2<=N<=2*10^3
1<=T<=10^3
1<=E[i]<=10^3
Click Here
01 Free Materials
Sep
The Energy and Jumps
*Repeated - Sep,23,
Example
Input:
2 13
27
5
F
Output:
6
U
Explanation:
In the first hour, we are in city 1, and we collected 2 units of energy.
Now we have 2 units of energy.
In the second hour, we are on city 1 and collected 2 units of energy.
o
Now we have 4 units of energy. In the third hour, we are in city 1, and we collected 2
units of energy.
n
Now we have 6 units of energy.
In the fourth hour, we are in city 1 and move to city 2 after earning 2 units of energy.
k
Now we have 1 unit of energy after moving to the next
city burning 5 units of energy.
e
In the fifth hour, we are in city 2, and we collected 7 units of energy.
Now we have 8 units of energy.
T
In the sixth hour, we are in city 2, and we collected 7 units of energy. Now we have 15
units of energy. It will take a minimum of 6 hours to defeat the enemy.
Sample input
37
556
21
Output :
2
Click Here
03 Free Materials
Sep
248 Numbers
*Repeated - Sep,23,
A number is said to be a 248 number if the count of 2's is equal to the count of 4's and
count of 4's is equal to the count of 8's. The count of 2's should be at least 1.Given a
number N. Your task is to find 248 numbers in the interval [1,N]. Since the answer can be
too long, print it modulo 1000000007.
Input Format :
F
The input consists of a single line.
The first line contains a single integer N.
U
Output Format:
Print the count of 248 numbers in the interval [1, N] mod 1000000007.
o
Constrains:
1<=N<=10^10
n
Example :
k
input:
300
e
Output:
2
T
Explanation :
There are 2 numbers less than or equal to 300 that have 2,4 and 8, all three as their
digits. The two numbers are248 and 284. Both have equal 2's,4's and 8's, i.e 1.
Input:
10
Output:
0
Click Here
05 Free Materials
Sep
Sub-Div Equal
Alice being good at mathematics, Bob assigned him a task by giving him the integer N
and asked him to find the minimum number of operations to make the integer N equal
to 1. In one operation Alice can do either of the following:
Divide N by one of the factor of N.
Subtract N by 1.
F
Input Format:
U
The input consists of a single line:
An integer N
Output Format:
o
The min operation to make N into 1
n
Example:
input:
k
10
output:
e
2
T
input:
17
output:
3
Click Here
07 Free Materials
Sep
Nullify Prefix
*Repeated - Sep,23,
You are given an array arr of size N. You are allowed to perform the following operation
any number of times:
* Choose any index i such that 0 <= N-1 and arr[i] is equal to 0.
* Assign any arbitrary value to arr[i].
Your task is to maximize the number of indices i such that the prefix sum of the array till
F
index i is 0.
More formally, maximize the number of indices such that arr[0] + arr[1]+...+arr[i] = 0.
U
Return the maximum number of such indexes possible after applying the above
operation any number of times.
Input format:
o
The input consists of two lines:
The first line contains an integer N, denoting the size of the array.
n
The second line contains N space-separated integers representing array arr.
k
Output format:
Print the maximum number of the indexes where the prefix sum is 0.
e
Constrains:
T
-1000 <=arr[i]<=1000
Example:
Input:
5
2 0 -1 1 0
Output:
3
Click Here
07 Free Materials
Sep
Nullify Prefix
Explanation:
We can change the value of arr[1] to -2. The new array is: 2-2 -1 1 0
Then the three possible prefix sum are: arr[0] + arr[1] =0.
arr[0] + arr[1] + arr[2] + arr[3] = 0.
F
arr[0] + arr[1] + arr[2] + arr[3] + arr[4] = 0.
Input:
U
4
0000
Output:
4
no
ek
T
Click Here
11 Free Materials
Sep
Fibonacci Series
Example:
Sample Input:
10
Sample Output:
F
0 1 1 2 3 5 8 13 21 34
U
Explanation :
0+1=1
1+1=2
1+2=3
o
2+3=5
5+8=13
n
.....
ek
T
Click Here
12 Free Materials
Sep
Height of Tree
F
You are given a function,
int TallestTree(struct TreeHeight trees[], int n);
U
The function accepts an array 'trees of type 'TreeHeight consisting of
'n' elements as its argument. 'TreeHeight" consists of two integers 'feets' and 'inches'
which represents height of a tree. Implement the function to find the tallest tree among
the 'trees and return its height (in inches).
o
Height of a tree= (12 *feets) + inches
n
Assumption:
k
feets > 0
0 >=inches >= 11
e
Note:
T
Computed value lies within integer range. Return -1 if trees is null (None, in case of
Python).
trees(0) is the first element.
Click Here
12 Free Materials
Sep
Height of Tree
Example:
Sample Input:
Feets Inches
10 4
F
23 5
21 2
U
27 7
Sample Output:
331
o
Explanation:
Height of trees (in inches):
n
trees[0] = (10*12) + 4 = 124
trees[1] = (23* 12)+5=281
k
trees[2]=(21* 12)+2=254
trees[3] =(27* 12)+7=331
e
Maximum of (124, 281, 254, 331) = 331, thus output is 331
T
Click Here
14 Free Materials
Sep
Pipeline
You are given three pipelines, each capable of filling a water tank at different rates. The
three pipelines are represented by their filling rates, which are positive integers:
pipeline1, pipeline2, and pipeline3.
F
take the minimum time to fill the tank completely. The tank has a total capacity of
'capacity' liters, and you need to find the minimum time required to fill it using one of
U
the three pipelines.
The time taken to fill the tank can be calculated using the formula: time = capacity /
filling_rate
o
Your function should take the following parameters:
n
pipeline1 (an integer): The filling rate of pipeline 1 (liters per minute).
pipeline2 (an integer): The filling rate of pipeline 2 (liters per minute).
k
pipeline3 (an integer): The filling rate of pipeline 3 (liters per minute).
capacity (an integer): The total capacity of the tank (liters).
e
The function should return one of the following strings, depending on which pipeline
T
takes the minimum time to fill the tank:
Note:
If multiple pipelines take the same minimum time, return the one with
lowest index (i.e. prioritize pipeline 1 over pipeline 2, and pipeline 2 over pipeline 3).
Click Here
14 Free Materials
Sep
Pipeline
Constraints:
The filling rates (pipeline1, pipeline2, pipeline3) are positive integers
(1 <= capacity <=10000).
The capacity of the tank (capacity) is a positive integer
(1 <= capacity <=10000).
F
The tank can always be filled using at least one of the pipelines.
U
Example 1
pipeline1 = 5
pipeline2 = 8
pipeline3 =12
o
capacity = 40
Output: "Pipeline 3"
n
# Pipeline 1 takes 8 minutes to fill the tank, Pipeline 2 takes 5 minutes, and Pipeline 3
k
takes 3.33 minutes.
e
# Example 2
pipeline1 = 10
T
pipeline2= 15
pipeline3 = 20
capacity= 100
minimum_time_to_fill(pipeline1, pipeline2, pipeline3, capacity)
Output: "Pipeline 3"
# Pipeline 1 takes 10 minutes to fill the tank, Pipeline 2 takes 6.67 minutes, and Pipeline
3 takes 5 minutes.
Click Here
14 Free Materials
Sep
Roots
F
U
no
ek
T
Click Here
14 Free Materials
Sep
Unique Paths II
*Repeated - Aug,21
"Unique Paths II" states that given the m x n grid where a robot starts from the top left
corner of the grid. We need to find the total number of ways to reach the bottom right
corner of the grid. A cell containing an obstacle contains 1 while, & for a free cell.
Example:
F
Input:
obstacleGrid = [[0,0,0], [0,1,0], [0,0,0]]
U
Output:
2
Explanation:
There exists an obstacle in the middle of the grid.
o
There exists exactly 2 unique paths to reach from the top-left corner to bottom right
corner of the matrix.. I
n
Right, Right, Down, Down.
Down, Down, Right, Right.
k
Input:
e
obstacleGrid = [[0,1],[0,0]]
Output:
T
1
Explanation:
There is exactly 1 unique path. Down, Right. Hence, 1 is our answer.
Click Here
14 Free Materials
Sep
Mango Distribution
*Repeated - Aug,21,23
Given a number of mangoes and number of persons. Find the number of ways to
distribute identical mangoes among identical persons.
Input Specification:
input1: the number of mangoes
F
input2: the number of persons
U
Output Specification:
Return the number of ways to distribute identical mangoes among identical persons.
Example 1:
o
input1: 2
input2: 2
n
o/p : 3
k
Explanation:
All possible distributions of 2 identical mangoes to 2 identical persons are (1,1)(2,0) and
e
(0,2). Hence the output is 3.
T
Click Here
18 Free Materials
Sep
Regions on a Plane
*Repeated - Aug,21,23
Mr. Professor is a great scientist, but he is not able to find a solution to one problem.
There are N straight lines that are not parallel, and no three lines go through the same
point. The lines divide the plane into M regions. Write a function to find out the
maximum number of such regions he can get on the plane.
F
Input Specification:
input1:
U
An integer N representing the number of straight lines (0 <=N<= 100)
Output Specification:
Return the maximum number of regions
o
Example:
Input
n
2
Output
k
4
Explanation
e
Given the above scenario, 2 lines divide the plane into 4 regions. Therefore, 4 is
returned as the output.
T
Input
3
Output
7
Given the above scenario, 3 lines divide the plane into 7 regions. Therefore, 7 is returned
as the output
Click Here
18 Free Materials
Sep
Check Subsequence
*Repeated - Aug,23
You are given an array A of size N. Your task is to find the maximum length of the
subsequence in which the difference of every consecutive element is divisible by K.
Note:
The input array is sorted in ascending order. The length of the subsequence must be
F
greater than 1 and if there is no subsequence satisfying the condition, return -1.
U
Input Format:
The input consists of two lines:
The first line contains two space separated integers N and K.
The second line contains n space-separated integers denoting the array A.
o
Output Format:
n
Print a number representing the maximum length of the subsequence satisfying the
condition.
ek
T
Click Here
18 Free Materials
Sep
Check Subsequence
*Repeated - Aug,23
Constraints:
1<= N, K<= 10^4.
1 <=arr[i]<= 10^3
Example:
F
Input:
22
U
24
Output:
2
Explanation:
o
Subsequence (2, 4) satisfies the condition as it is of length 2 and difference between
consecutive Element is 2 i.e divisible by 2. So, the answer is 2.
n
Sample input
k
33
112
e
Sample Output
2
T
Click Here
19 Free Materials
Sep
Sum of Digits
*Repeated - Aug,23
Return the sum of the digtes of after converting from base 10 to base k, given an integer
n (in base 10) and a base k .
Each digit should be treated as a base-10 number after conversion, and the result
should be provided in base-10
Constraints:
F
1 <= n <= 100
2 <= k <= 10
U
Example 1:
Input: n = 34, k = 6
Output: 9
Explanation: 34 (base 10) expressed in base 6 is 54. 5+ 4 = 9.
o
Example 2:
Input: n = 10, k = 10
n
Output: 1
Explanation: n is already in base 10. 1+0= 1.
ek
T
Click Here
19 Free Materials
Sep
Equal Number
given two integers N and M make the two integers equal by doing minimum number of
operation on N and M.
F
you can increment M by +2
U
input:
34
Output:
1
o
Input:
n
55
output:
k
0
e
input:
83
T
o/p:
3
Click Here
19 Free Materials
Sep
Binary Substring
give an integer N and a string S of length as N. String S consists of 0's,1's and 2's only.
A binary substring is valid if the maximum length of palindrome substring don't exceed
4.
String S to be a binary string by replacing 2's by either 1 or 0 or not.
If the string cannot be a binary string - Return -1, else return the count of replaceable
F
2's
U
input:
7
1012010
op
o
-1
n
i/p:
4
k
2002
o/p:
e
2
T
Click Here
21 Free Materials
Sep
Unique Characters
*Repeated - Aug,23
Write a java program that counts the number of unique characters in a given string and
return the count
input:
“abcd”
F
op
4
U
i/p:
“aabbccddee”
o/p:
o
5
kn
Te
Click Here
21 Free Materials
Sep
Count Substring
*Repeated - sep,23
You are given a binary string containing only ‘0’ and ‘1'.
substring is defined as a contiguous sequence of characters within the given string.
valid substring is defined as a substring that starts and ends with '1' and may contain
zero or more ‘0’s in between.
F
Write a function countSubstrings that takes a binary string as input and returns the
count of valid substrings in it.
U
Input:
binary string s consisting of '0's and 1's. The Length of s will be at least 1.
Output:
Ap integer representing the count of valid substrings in the given binary string.
o
Input:
n
1001101101
Output:
k
3
e
Input:
11110110110000110001
T
Output:
4
Click Here
21 Free Materials
Sep
Googly Prime
A "googly number" is defined as a number that is derived from the sum of its individual
digits. For example, if N = 43, the sum of it’s individual digits is 4+ 3 = 7, making it a
googly number.
F
googly prime or not.
U
A googly prime is a googly number that is also a prime number.
Write a function is googly prime (N) that takes an integer N as input and returns True if
it is a googly prime, and False otherwise.
o
Input:
An integer N (1 <= N <= 10^6), where N is the number to be checked.
n
Output:
Return True if N is a googly prime, and False otherwise.
ek
T
Click Here
22 Free Materials
Sep
Good Integer
You are given two integers N and K. Your task is to print the smallest possible good
integer. An integer is said to be a good integer, only if it’s greater than k and it can be
obtained by deleting zero or more digits from N without changing the order of the
remaining digits.
F
Note:
There will always be a good integer.
U
Input Format:
The input consists of, a single line:
The line contains two space separated integers N and K.
o
Output Format:
n
Print the smallest possible good integer.
k
Constraints:
1<=N, K<= 10^9.
e
Example: I
Input:
T
7195 11
Output:
15
Explanation:
15 is the smallest possible number greater than K i.e 11 which is obtained by deleting 7
and 9.
Sample input
25 2
Sample Output
5
Click Here
25 Free Materials
Sep
2D Array
*Repeated - sep,23
F
U
no
ek
T
Click Here
26 Free Materials
Sep
Anagram Checker
*Repeated - Oct,23
F
Input:
Two strings, str1 and str2, where the length of each string is at most 10^5.
U
Output:
Return "Yes" if str1 and str2 are anagrams, and "No" otherwise.
Sample input:
o
anagram
manarga
n
output:
Yes
k
Sample input:
e
anagram
mmanagr
T
output:
No
Click Here
28 Free Materials
Sep
Equillibrium Index
*Repeated - Nov,23
You are given an array of integers. An equilibrium index of this array is an index such
that the sum of elements at lower indexes is equal to the sum of elements at higher
indexes. Your task is to write a function to find the equilibrium index of the given array.
Write a function find equilibrium_index(arr) that takes an integer array arr as input and
F
returns the equilibrium index if one exists, or 1 if there is no equilibrium index.
U
Input:
An integer array arr of length n (1 <= n <= 10^5) where each element is an integer (-10^4
<= arr[i] <= 10^4).
Output:
o
Return the equilibrium index (an integer) if one exists, or -1 if there is no equilibrium
index.
n
Note:
k
If there are multiple equilibrium indices, return the one with the
lowest index.
e
Example:
Input:
T
-7, 1, 5, 2, -4, 3, 0
Output:
3
Input:
14,2,5,1,3,4,1
Output:
1
Click Here
29 Free Materials
Sep
Odd Even
You are given a string s. Your task is to write a function print_odd_even_positions (s)
that takes the input string and returns two strings, one containing characters at odd
positions and the other containing characters at even positions.
Input
F
The function takes a single input string s (1 <= len(s) <= 100), where s consists of only
alphabetic characters (both uppercase a Lowercase).
U
Output.
The function should print two strings. The first string should contain characters at even
positions, and the second str should contain characters at odd positions. The output
o
strings has no space.
n
Example
Input:
k
ABCDEF
Output:
e
BDF
ACE
T
Input:
123456
Output:
246
135
Click Here
30 Free Materials
Sep
Convert to Palindrome
*Repeated - Oct,Nov,23
Write a function minAppendsToPalindrome that takes a string as input and returns the
minimum number of characters that need to be appended to the end of the string to
make it a palindrome.
A palindrome is a string that reads the same forwards and backwards.
F
Input:
A string s where 1 <= |s|<= 1000 (the length of the string).
U
Output:
An integer representing the minimum number of appends needed to make the string a
palindrome.
o
Example
Input:
n
ABCDE
Output:
k
4
e
Input:
ABBA
T
Output:
0
Click Here
08 Free Materials
Oct
Perfect Number
*Repeated - Sep,23
A number is a perfect number if is equal to sum of its proper divisors, that is, sum of its
positive divisors excluding the number itself. Write a function to check if a given
number is perfect or not.
Input:
F
n = 22
Output:
U
14
Divisors of 22 are 1, 2 and 11. Sum of divisors is 14 which is not equal to 22.
Input:
o
n=6
Output:
n
true
k
Divisors of 6 are 1, 2 and 3. Sum of divisors is 6.
Te
Click Here
09 Free Materials
Oct
Rotate Words
*Repeated - Sep,23
Rotating a string one step means each word of that string is shifted by one position left
and the left word to the end. You are given a string str and an integer k. You are required
to rotate the string str as mentioned.
F
Note:
If str in empty, print NULL
If k is 0, print the original string.
U
Assumption:
Words in string str are separated by a single space.
o
Input Format:
n
The input consists of the 3 lines
The first line contains an integer, i.e. string length of str
k
The second line contains the string, i.e. str.
The third line contains an integer k, i.e. the number of steps.
e
Output Format:
The output consists of the rotated string in a single line.
T
constraints:
0<= length of the string str <= 60000
0<= number of steps <=60
Click Here
09 Free Materials
Oct
Rotate Words
*Repeated - Sep,23
Example
Input:
19
abcd efgh ijkl mnop
F
2
Output:
ijkl mnop abcd efgh
U
Explanation:
The words in 'str' are (“abcd", "efgh", "ijkl", "mnop”), rotating words of 'str' by 1 step will
form 'efgh’, ‘ijkl’, ‘mnop’, ‘abcd’, similarly rotating again by 1 step, hence ijkl mnop abcd
o
efgh printed.
n
.
ek
T
Click Here
31 Free Materials
Oct
Sum of Binary Digits
*Repeated - Aug,23
You are given an integer ‘n’. Write a Python function to calculate and return the sum of
the digits in ‘n’ after converting it to it’s binary representation .
For example, 15, which has a binary representation of 1111, should return 4
F
U
no
ek
T
Click Here
31 Free Materials
Oct
Smallest Number
Two friends are playing a game. The rules of the game are as follows :
Friend 1 provides a 4-digit natural number.
Friend 2's task is to find the smallest 4-digit number that is greater than the number
provided by Friend 1 and has distinct digits
F
Write a function to solve this problem. You are given an integer num (1000 <=num
9000) representing the number provided by Friend 1. Your task is to find and return the
smallest 4-digit number that meets the criteria mentioned above.
U
Input
⚫ num (1000<=num<=9000): A 4-digit natural number provided by Friend 1.
o
Output
Return a single integer, the smallest 4-digit number that is greater than num and has
n
distinct digits. For example, if Friend 1 provides the number 1234, the smallest 4-
digit number greater than 1234 with distinct digits is 1235.
ek
T
Click Here
31 Free Materials
Oct
Min num of steps
Raju is passionate about mathematics and has created an intriguing problem. He has a
circle with it’s center at coordinates (x, y) and a radius of r. He wishes to move the
center of the circle to a specific target location (x’, y’). Raju can attach a pin to the edge
of the circle at a specific point, rotate the circle around the pin at any angle, and then
F
remove the pin. The challenge is to help Raju determine the minimum number of steps
required to move the center of the circle to the destination point.
U
Input:
The input consists of five integers: r, x, y, x’, y’. Here's what each of these values
represents:
⚫
o
r(1 <=r<= 10^5): The radius of the circle.
• x, y (-10^5<=x, y<= 10^5): The current coordinates of the circle's center .
n
x’, y' (-10^5 <=x’, y'<=10^5): The desired destination coordinates for the circle's
center.
k
Output:
You need to find and return the minimum number of steps required to move the center
of the circle from it’s initial position (x, y) to the target position (x’,y’).
Te
Click Here
31 Free Materials
Oct
Winning Team
F
each goal. Vasya needs your help to identify the winning team. It is certain that the
match did not end in a tie.
U
Input:
The input starts with an integer 'n' (1 ≤ n ≤ 100), which represents the number of lines in
the description.
o
Each of the following 'n' lines contains the name of the team that scored a goal.
Output:
n
You should output the name of the winning team. In football, the team with the most
goals wins.
k
Input :
4
e
TeamA
TeamA
T
TeamA
TeamB
output:
TeamA
Click Here
01 Free Materials
Nov
Reverse String
*Repeated - Sep,23
Input :
A single line of text containing words separated by spaces. The input string consists of
only printable ASCII characters.
F
Output :
The string With Words reversed in order
U
Example :
Input :
Hello World
o
Output:
World Hello
kn
We found only this much questions
Te
Click Here
02 Free Materials
Nov
Swap Characters
*Repeated - Sep,23
You are given a string, and your task is to swap the cases of it’s characters. Specifically,
convert all lowercase letters to uppercase and vice versa while leaving non-alphabetic
characters unchanged.
F
Input:
A string containing a mix of uppercase and lowercase alphabetic characters, as well as
non-alphabetic characters.
U
Output:
Return the input string after swapping the cases of it’s alphabetic characters.
o
Sample Input:
n
He2llO WorLd
Output:
k
hE2LLo wORld
Te
Click Here
02 Free Materials
Nov
Sum of Even
*Repeated - Sep,23
You are given a list of integers , you have print the sum of all even numbers among the
list numbers.
Input:
F
A list of integers .
Output:
U
Return the sum of all even numbers
Sample Input:
o
123456
Output:
n
12
ek
T
Click Here
03 Free Materials
Nov
2nd Smallest
*Repeated - Sep,23
You are given an array of integers, and your task is to write a Python function to find the
second smallest number in the array. Your function should handle user Input for the
array elements and return the second smallest number found in the array.
F
For example, if the user enters the number of elements as 5 and the elements as 3, 1, 7,
4, 2, the function should return 2 as the second smallest number.
U
Your solution should handle user-provided arrays of varying lengths and types of
integers.
no
ek
T
Ans in the comment
Click Here
04 Free Materials
Nov
Even Odd Array
*Repeated - Aug,22
Input:
Elements of the array
Output:
An array of N integers sorted such that even elements come before odd elements while
F
maintaining their relative order
For example,
U
Input
10
12 34 45 9 8 90 3 1 7 6
o
Output
[12, 34, 8, 90, 9, 45, 3, 1, 7, 6]
kn
** The sample output having typing mistake in the question .
Actual O/p :
12,34,8,90,6,9,45,3,1,7
Te
Click Here
04 Free Materials
Nov
Candy Store
Once upon a time in a candy store, there were colorful candies of various flavors. Each
candy had a price tag, and the candies were arranged on the shelves in a certain order.
Customers came in one by one, and each customer wanted to buy as many candies as
they could with a fixed amount of money.
F
You, as the store manager, want to help each customer get the maximum number of
candies they can buy without exceeding their budget. Your task is to find out how many
U
candies each customer can purchase with their given budget.
Input:
o
A list of candy prices in the order they are arranged on the shelves.
An integer representing the budget of the customer.
n
Output:
. Return the maximum number of candies the customer can buy without exceeding their
k
budget.
For example
e
Input:
23145
T
7
Output
3
Click Here
04 Free Materials
Nov
Divide
You have been given a number N and you have to find out if you divide this N into two
parts both the parts should be even .
F
U
no
ek
T
Click Here
06 Free Materials
Nov
Subarray
*Repeated - Multiple time
Input:
A list of integers nums ( 1<= len(nums) <= 10^5 ) representing an array of numbers.
Output:
Return an integer, the maximum sum of any contiguous subarray in the given array.
F
Example:
Input:
U
-2 1 -3 4 -1 2 1 -5 4
Output:
6
o
Input:
n
3 -1 2 5 -6 3
Output:
k
9
Te
Click Here
06 Free Materials
Nov
Unique Characters
*Repeated - Au,21
You are given string str of length N. You are required to find the number of unique
characters in string str and print the count.
Note:
If str = NULL, print-1.
F
Input Format:
The input consists of two lines:
U
The first line contains an integer denoting N.
The second line contains a string denoting str.
o
Output Format:
The output consists of a single integer denoting the number of unique characters in str.
n
Constraints:
k
• O≤N<=10^5 .
str contains only lower case alphabets.
e
Sample input:
T
6
abccde
Output:
5
I/p:
6
aabbcc
O/p:
3
Click Here
07 Free Materials
Nov
Max Length Path
*Repeated - Multiple Time
Given a nxn integer matrix, find and print the length of the longest sequence (starting
from any cell) such that all the cells along the path are in increasing order with a
difference of 1.
Note:
F
Only 4 possible movements are allowed i.e. up, down, left, and right.
Print 1. If no such sequence is found.
U
Input Format:
The input is given in the following format:
The first line contains an integer representing the side of the matrix i.e. n.
o
. Each of the n subsequent lines contains n positive integers separated by space
representing elements of the matrix.
n
Output Format:
k
Print the length of the longest sequence.
e
Constraints:
⚫ 0 <n< 100
T
0<= elements of the matrix < 1000
Example Input:
3
9 1 3
7 4 2
6 5 0
O/P:
4 ( becoz longest sequence 4,5,6,7 )
Click Here
08 Free Materials
Nov
Star Pattern
Print the Butterfly Pattern.
Input:
5
Output:
F
* *
** **
*** ***
U
**** ****
*********
**** ****
o
*** ***
** **
n
* *
ek
T
Click Here
09 Free Materials
Nov
Nth Prime
Write a program that takes an integer N as input and returns the Nth prime number,
starting from 2.
Input:
5
F
Output:
11
U
input:
11
Output:
o
31
kn
** These questions seems to be very easy , Fact is - this was asked .
Te
Click Here
17 Free Materials
Nov
Perfect String
A string str of size ‘n’ is said to be a perfect string only it there is no pair of Indices [i,j]
such that 1<=i<j<=n and str[i]=1 and str[j]=0
You are given a binary string S of size N. Your task is to print the minimum number of
operations required to make S a Perfect String.
In each Operation, you can choose an index ‘i’ in the range [1,M] (where M is the current
F
size of the string) and delete the character at the ith position.
Note:
U
String S contains only 1's and 0's.
Input format:
o
The input consist of two lines:
The first line contains an integer N.
n
The second line contains the string S.
Output Format:
k
Print minimum number of operations required to make S as a Perfect String.
e
Constraint:
•1≤ N ≤ 10^5
T
Example:
Input:
6
010101
output:
2
Click Here
17 Free Materials
Nov
Sum of Circular Prime
You have to find sum of circular prime in a range .
input format :
input consists of two lines
First line contains an integer minRange.
F
Second line contains an integer MaxRange
Output format :
U
Return the sum of all Circular Prime number
Input :
o
60
80
n
Output:
223
k
Explain: 71,73,79 are prime and circular prime because their rotated version 37,17,97 are
also prime . So the sum of all those is 223 .
e
Input :
T
100
200
Output :
640
Click Here
2023 Free Materials
Free Mock Tests
Click Here
F
Click Here
U
Second Mock Test Sixth Mock Test
o
Click Here Click Here
n
Third Mock Test Seventh Mock Test
Click Here
ek Click Here
T
Fourth Mock Test Eighth Mock Test
Click Here
2023 Free Materials
Free Mock Tests
Click Here
F
U
no
ek
T
Click Here
2023 Free Materials
Communication Round
Section 1- Reading
In this round you will have 8 sentences that are going to display on screen in text
form . You just have to read it loudly in the window for 20-30 sec.
This process is basically an exercise to examine the reading ability of the candidate.
F
Section 2- Repeating Sentences
As an advancement to the above reading assessment, this section will be more of
U
duplication. On this round you will be given 16 audio sentences. You have to clearly
listen what the audio reads (probably a sentence) and then repeat it loudly which
will test your pronunciation ability.
o
Section 3- Jumbled Sentence
n
In this section, there will be 10 jumbled sentence audio will be given.This section
tests more of your intellectual skills than verbal. You will be given a jumbled
k
sentence which you will have to unscramble and read aloud thus diving into your
sentence mastery skills.
e
Section 4- Question and Answer
In this section. There will be 24 easy questions asked orally and there will be no text
T
that is displayed on screen. You have to answer each question in one or two words.
This round is a quick question and answer round that takes into account your
promptness in thinking and speaking while testing your vocabulary as well. The
answer should be in one or two words.
1. Introduce yourself
2. Explain your project
F
3. Learnings from your project
4. Feedback got from your project
5. Teamwork related questions
U
6. How do you handle conflicts in team
7. Your least favourite subject
8. Any questions for me
no
ek
T
Coding Questions
Till Today Available
F
U
no
ek
T