Bird
0
0
DSA Cprogramming~10 mins

Meeting Rooms Problem Minimum Rooms Required in DSA C - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare the variable that stores the number of meeting rooms needed.

DSA C
int [1] = 0;
Drag options to blanks, or click blank then click option'
AmaxRooms
Bcount
Cintervals
Drooms
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'intervals' which is usually the input array.
Using 'count' which is too generic.
2fill in blank
medium

Complete the code to sort the start times of meetings.

DSA C
qsort(start, n, sizeof(int), [1]);
Drag options to blanks, or click blank then click option'
AcompareInts
BcompareIntervals
CcompareStart
Dcompare
Attempts:
3 left
💡 Hint
Common Mistakes
Using a comparator meant for intervals instead of integers.
3fill in blank
hard

Fix the error in the loop that checks overlapping meetings.

DSA C
for (int i = 1; i < n; i++) {
    if (start[i] < [1]) {
        rooms++;
    } else {
        endIndex++;
    }
}
Drag options to blanks, or click blank then click option'
Astart[endIndex]
Bend[i]
Cstart[i-1]
Dend[endIndex]
Attempts:
3 left
💡 Hint
Common Mistakes
Comparing start times instead of end times.
Using wrong indices.
4fill in blank
hard

Fill both blanks to correctly update the number of rooms and the end index.

DSA C
if (start[i] < end[[1]]) {
    [2]++;
} else {
    endIndex++;
}
Drag options to blanks, or click blank then click option'
AendIndex
Brooms
Ci
Dcount
Attempts:
3 left
💡 Hint
Common Mistakes
Incrementing the wrong variable.
Using wrong indices for comparison.
5fill in blank
hard

Fill all three blanks to create a dictionary of meeting start times and their counts for overlap.

DSA C
for (int i = 0; i < n; i++) {
    countMap[[1]] = countMap[[2]] + [3];
}
Drag options to blanks, or click blank then click option'
Astart[i]
C1
Dend[i]
Attempts:
3 left
💡 Hint
Common Mistakes
Using end[i] as key.
Adding wrong increment value.