Fitness Test in Indian Navy Problem Statement

The selection process in the Indian Navy includes a fitness test conducted in seawater, where a group of 3 trainees undergo a swimming test over three rounds. The oxygen level of each trainee after each round will be recorded in a 2D matrix/list OXYGEN of size 3 x 3.

The task is to calculate the average oxygen level for each trainee over the three rounds and select the ones with the highest average oxygen level as the fittest. If there is a tie in the highest average levels, all such trainees should be selected.

Rules:

1. Only consider oxygen levels in the range [1, 100] inclusive; otherwise, treat it as 0.
2. If the highest average oxygen level among trainees is less than 70, declare them as "Unfit".
3. Round the average oxygen level to the nearest integer.

Example:

Output:
Trainee1
Unfit
Trainee3
Explanation:
In this example, the highest average oxygen level is 70, which is acceptable. Trainees 1 and 3 have the same average value of 70. Trainee 2 is declared "Unfit" because their average is less than 70.

Input:

The first line of input contains an integer 'T', the number of test cases.
Each test case consists of 3 lines, each with 3 space-separated integers denoting the oxygen levels of each trainee after each round.

Output:

For each test case, output the numbers of the fittest trainee(s) in increasing order.
Print "Unfit" if the average oxygen level is below 70.
Output results for each test case on separate lines.

Constraints:

  • 1 ≤ T ≤ 100
  • 1 ≤ OXYGEN[i][j] ≤ 100, where OXYGEN[i][j] is the oxygen level of the i-th trainee after the j-th round.
  • Time Limit: 1 sec

Note:

You do not need to print anything. Just implement the given function.

Be the first one to answer
Add answer anonymously...
TCS iON Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter