Tesco Bengaluru Interview Experience | Set 1 (Online Coding Test)
This is an online coding test conducted by Tesco, Bengaluru.
2 questions – 2 hrs
Question 1
——————-
There are N farms in a row, at each farm you either i) collect apples or ii) drink milk(energy). Visiting each farm costs you one unit of energy. This means if energy becomes zero, you cannot visit anymore farms. Given initial energy (even before first farm is visited) as P, find the maximum number of apples which we can collect.
Input
T (the number of test cases)
N P (in each test case the first line has N-the number of farms and P-the initial energy)
m1 m2 m3 m4 … mN (the milk values at each farm)
a1 a2 a3 … aN (the apples available at each farm)
.
.
.
(t such cases)
Output
In each line, output the maximum number of apples which can be collected.
amax1
amax2
.
.
(t such lines)
Test case 0
2
5 1
5 4 3 2 1
5 4 3 2 1
5 1
3 0 0 1 2
4 5 1 10 20
Expected output for Test case 0
10
6
Question 2
——————-
‘samu’ and ‘vibhu’ are playing a game where there are N integers from 1 to N lying on the table.
In each turn, the player gets to pick one integer to mark as visited from among the previously unvisited ones.
If in a turn, the player picks a number which completes the picking of three consecutive numbers, he wins.
i.e., say at some stage in the game 2 and 4 are already picked(visited) if the player now picks 3, he wins.
Assuming samu starts first and both the players play perfectly optimally, who is the winner.
Input
—————-
T (the number of test cases)
N1 (each case contains just one line with N- the number of integers)
N2
.
.
.
(t such lines)
Output
————-
‘Samu’
‘Vibhu’
.
.
.
(t such lines with just the name of the winner)
Hope this helps.
If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Recommended Posts:
- Tesco Interview Experience | Set 3 (Online Test)
- Tesco Interview Experience | Set 2 (Online Test)
- Microsoft Interview Experience | Set 141 (Off-Campus - Online Coding Test for IDC)
- Atlassian Online Coding Interview Experience
- MakeMyTrip Interview Experience | Set 6 (Online Coding)
- MakeMyTrip Interview Experience | Set 5 (Online Coding)
- BrowserStack Interview Experience | Set 7 (Online Coding Questions)
- Fiberlink (maas360) Interview Experience | Set 5 (Online Coding Question)
- Oracle Online test and Interview Experience | Set 67
- Cigital Interview Experience (Coding Test Round 1)
- Scientific Games, Bengaluru Interview Experience
- Amazon Interview Experience Off Campus - Bengaluru
- Tesco interview Experience for full time (on campus)
- Oyo Coding Interview Experience
- Grofers Interview Experience | Online Round



