Candidate Qualification Check

Challenge 📝

Given is an array times and a number totalTime. The array times contains the time taken by a candidate to solve each question in an imaginary coding interview, and totalTime is the total time taken by the candidate to complete the interview.

The interview has the following criteria:

  • The interview contains 8 questions in the order: easy, easy, easy, medium, medium, medium, hard, hard.
  • The maximum allowed time for the entire interview, including a buffer time, is 140 minutes.

The maximum time allowed for each question is as follows:

  • Easy questions: 10 minutes each.
  • Medium questions: 15 minutes each.
  • Hard questions: 20 minutes each.

The function should return "qualified" if the candidate meets all the criteria. Otherwise, it should return "disqualified".

Examples:

// Example 1
let times = [8, 9, 10, 13, 14, 15, 18, 19];
let totalTime = 110;
console.log(isQualified(times, totalTime)); // Output: "qualified"

// Example 2
times = [8, 11, 10, 13, 14, 15, 18, 19];
totalTime = 110;
console.log(isQualified(times, totalTime)); // Output: "disqualified"
// Explanation: The second easy question took 11 minutes, which is more than the allowed 10 minutes.

#JavaScript Logic

Hard

unsolved

function isQualified(times, totalTime) {
}
Test Cases
Console Logs
JS Errors
Run Code!
flag