Hello Champions,
Role 1:
Specialist Programmer - 8 LPA
Role 2:
Written Test Dates: 07-08-2021 (VASAVI)
08-08-2021 (CBIT)
Test Format
|
No of questions |
3 (Easy, Medium, Hard) |
|
Test Duration |
3 hours |
|
Sectional Cut-off |
Yes |
|
Total Cut-off |
Yes |
|
Allowed languages for coding |
C/C++/Java/Python/JavaScript |
How to prepare ?
Easy
Medium
What is Greedy Alogirithm ?
Hard
What is Dynamic Programming ?
Answers for Samples Of Infosys online tests
2020-21 Last Year Infosys written test quetions
Quetion 1 - Easy
Multiplication Grid
|
|
Name |
Type |
Description |
|
Parameters |
N |
INTEGER |
The rows and columns
of the grid |
|
X |
INTEGER |
The given
Integer |
|
|
Return |
The function must
return an Integer denoting the number of times X occurs in the grid |
||
Constraints
- 1 <= N <= 10^5
- 1 <= X <= 10^5
Input Format For Custom Testing
Sample Cases
|
Input |
Output |
Output Description |
|
4 4 |
3 |
The grid is like 1 2 3 4 2 4 6 8 3 6 9 12 4 8 12 16 4 occurs 3 times |
Question 2 - Medium
Maximize sum
- every contiguous sub array has at-least one element in common with these choosen elements, and
- sum of the chosen elements is maximum
Function Description
|
Parameters |
Name |
Type |
Description |
|
N |
INTEGER |
Size of array |
|
|
A |
INTEGER |
Sub array
size |
|
|
B |
INTEGER |
No of elements to be
selected |
|
|
arr |
INTEGER ARRAY |
Array of
length N |
|
|
Return |
The function must return
an integer denoting the maximum sum possible |
||
Constraints
- 1 <= N <= 100
- 1 <= A <= 100
- 1 <= B <= 100
- 1 <= arr [i] <= 10^6
Input format for custom testing
Sample Cases
|
Input |
Output |
Output description |
|
6 4 6 80958 94240 44065 27316 71783 1438 |
319800 |
Select all elements |
Question 3 - Hard
Car Trip
Function Description
|
Parameters |
Name |
Type |
Description |
|
n |
INTEGER |
The length of the line |
|
|
k |
INTEGER |
The capacity
of the fuel tank |
|
|
m |
INTEGER |
The number of fuel
stations |
|
|
a |
INTEGER Array |
The positions
of the fuel stations |
|
|
b |
INTEGER Array |
The prices of the fuel
stations |
|
|
return |
The function
must return an integer denoting the minimum possible price You have to
pay in order to reach the end of the line |
||
Constraints
- 1 <= n <= 10^5
- 1 <= k <= 10^5
- 1 <= m <= 10^5
- 1 <= a[i] <= n
- 1 <= b[i] <= 10^9
Input format for custom testing
Sample Cases
|
Input |
Output |
Output description |
|
10 10 2 0 1 5 2 |
23 |
We buy 1 liter from
the first station for 5$ then we buy 9 liters from the second one for 18$
resulting in a total of 23$ |