(1)代码:
1 class Solution { 2 public: 3 bool isOneBitCharacter(vector<int>& bits) { 4 int len=bits.size(),i=0; 5 while(i<len-1) 6 { 7 if(bits[i]==0) 8 i++; 9 else 10 i=i+2; 11 } 12 return i==len-1; 13 } 14 };
(1)代码:
1 class Solution { 2 public: 3 bool isOneBitCharacter(vector<int>& bits) { 4 int len=bits.size(),i=0; 5 while(i<len-1) 6 { 7 if(bits[i]==0) 8 i++; 9 else 10 i=i+2; 11 } 12 return i==len-1; 13 } 14 };