Комментарии:
This is the most easiest and understandable solution....
int jumpingOnClouds(vector<int> c) {
int jump = 0;
int i =0;
while(i < c.size()-1)
{
if(c[i+2] == 0)
{
i+=2;
}
else {
i++;
}
jump++;
}
return jump;
}
completely not understood
Ответитьi = 0
count = 0
length = len(c)-3
test = True
while test:
if i <= length:
if c[i+2] == 1:
i += 1
else:
i += 2
count += 1
elif i > length and length+2-i == 1:
test = False
return count + 1
else:
test = False
return count
i think that some more cleart explanation is needed sir
Ответить