add: description

This commit is contained in:
Lam Haoyin 2022-01-16 10:41:18 +08:00
parent 5cd608625b
commit 0c38269333
No known key found for this signature in database
GPG Key ID: 8C089CB1A2B7544F
1 changed files with 8 additions and 0 deletions

View File

@ -1,6 +1,14 @@
#include <iostream>
#include <vector>
/**
* 849. Maximize Distance to Closest Person
* You are given an array representing a row of seats where seats[i] = 1 represents a person sitting in the ith seat, and seats[i] = 0 represents that the ith seat is empty (0-indexed).
* There is at least one empty seat, and at least one person sitting.
* Alex wants to sit in the seat such that the distance between him and the closest person to him is maximized.
* Return that maximum distance to the closest person.
*/
class Solution {
public:
static int maxDistToClosest(const std::vector<int>& seats) {