In a row of cinema seats, taken[i] is true if someone is sitting there. Two friends want to sit together. Write seats_for_two(taken) to return every seat number where that seat and the one to its right are both free. Seats are numbered from 1 (taken[0] is seat 1).
seats_for_two({false, false, true, false})→[1]seats_for_two({false, false, false})→[1, 2]vector<int> seats_for_two(const vector<bool> &taken)#include <vector>
using namespace std;
vector<int> seats_for_two(const vector<bool> &taken) {
vector<int> starts;
for (int i = 0; i + 1 < (int)taken.size(); i++) {
// your code here: if this one and the next are free, save the seat number
}
return starts;
}
Run tries the examples. When they look right, Submit.