Following question was asked in the Cisco Ideathon OA on 13 June. Can anyone give the optimal answer?

Test Creation

Ralph manages a team if test creators who work on creating N tests for various company's recruitment processes. The team consists of (n1+n2+n3) interns who are categorized into three groups based on thier assigned tasks. The group are as follows:

  • n1 interns work on Test Research
  • n2 interns work on Test Creation
  • n3 interns work on Test Final Reviews

Each intern in a group works with the same efficiency. The time taken by an intern in Test Research is t days. Test Creation is t+2 days, and Test Final Review is t-2 days to complete their task. The HR team wants to ensure that the interns work efficiently and complete their work within d days.

Your task is to determine and return wether it is possible to complete the work within the assigned time. If it is possible, return "Yes X," where X is the number of days it would take to finish the work, otherwise, return "No Y", where Y is the number of days short.

Note:

  • The interns tasks are performed sequentally, starting with Test Research, then Test Creation, and finally Test Final Review.
  • Each of the three types of interns can work simultaneously.

Input Specification:
input1: An integer N, representing the total number of tests to be created.
input2: An integer n1, representing the number of interns working on Test Research.
input3: An integer n2, representing the number of interns working on Test Creation.
input4: An integer n3, representing the number of interns working on Test Final Review.
input5: An integer t, representing the Time Taken.
input6: An integer d, representing the number of days given by the HR team.

Output Specification:
Return a string denoting "Yes X," where X is the number of days it would take to finish the work, otherwise "No Y," where Y is the number of days short.

Example 1:
input1: 1
input2: 1
input3: 1
input4: 1
input5: 5
input6: 20

Output: Yes 15

Explanation:
Here, N=1,n1=1,n2=1,n3=1,t=5, and d=20. So, the tasks can be performed in the following manner:

  • It takes 5 days for n1 interns to complete the Test Research.
  • It takes 7 days for n2 interns to complete Test Creation.
  • It takes 3 days for n3 interns to complete the Test Final Review.

All three activites will be finished in a total of 5+7+3 = 15 days. Hence, Yes 15 is returned as the output.

Example 2:
input1: 5
input2: 3
input3: 3
input4: 9
input5: 6
input6: 30

Output: Yes 26

Explanation:
Here, N=5,n1=3,n2=3,n3=9,t=6, and d=30. So, the tasks can be performed in the following manner:

  • Teams 1 and 2, with 3 member each, will work together to complete their part the 5 tests in 6+8+8 = 22 days.
  • After that, the third team, consisting of 9 members, will review the assessments in 4 days.

Since, the total time required to complete the work within the given deadline is 22+4 = 26 days. Hence, Yes 26 is returned as the output.

Comments (6)