codekofi
← All problems

Problem 106

Easy

1 · Worked examples

0 / 3

Type an input and write what you think is the output . Each problem is converted to Web Assembly, so any possible input will show the corresponding output. Only correct predictions count.

solution()
returns

2 · Which problem is it?

Locked until you have predicted 3 outputs correctly.

The accepted solution

1bool solution(vector<vector<int>> times) {
2
3 sort(times.begin(), times.end());
4
5 int n = times.size();
6
7 for (int i = 1; i < n; i++) {
8
9 if (times[i][0] < times[i - 1][1]) {
10 return false;
11 }
12 }
13
14 return true;
15}

Names have been stripped. The signature is the only clue you get for free. Compiled as C++20 with the standard headers and using namespace std; already in scope.