class Solution {
public:
int maxDistance(vector& colors) {
int i = 0;
int j = 0;
int res = 0;
for (i = 0; i
下面是没看清题目写错的版本。中间是不允许有不同变量的。
//中间不允许有不同的颜色。
class Solution {
public:
int maxDistance(vector& colors) {
int i = 0;
int j = 0;
int res = 0;
for (i = 0; i


![街上有 n 栋房子整齐地排成一列,每栋房子都粉刷上了漂亮的颜色。给你一个下标从 0 开始且长度为 n 的整数数组 colors ,其中 colors[i] 表示第 i 栋房子的颜色。2078. 街上有 n 栋房子整齐地排成一列,每栋房子都粉刷上了漂亮的颜色。给你一个下标从 0 开始且长度为 n 的整数数组 colors ,其中 colors[i] 表示第 i 栋房子的颜色。2078.](http://www.mshxw.com/aiimages/31/589685.png)
