版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/cyrususie/article/details/78695056
Ans
class Solution {
public:
bool isOneBitCharacter(vector<int>& bits) {
int i = 0;
int size = bits.size();
if (size == 1) {
if (bits[0] == 0) return true;
return false;
}
while(i < size - 1) {
i += bits[i] + 1;
}
if (i == bits.size() - 1) return true;
return false;
}
};