717. 1-bit and 2-bit Characters

Posted 西瓜刀刀刀

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了717. 1-bit and 2-bit Characters相关的知识,希望对你有一定的参考价值。

(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 };

 

以上是关于717. 1-bit and 2-bit Characters的主要内容,如果未能解决你的问题,请参考以下文章

717. 1-bit and 2-bit Characters

717. 1-bit and 2-bit Characters

717. 1-bit and 2-bit Characters@python

LeetCode 717. 1比特与2比特字符(717. 1-bit and 2-bit Characters)

Leetcode 717: 1-bit and 2-bit Characters

LeetCode 717. 1-bit and 2-bit Characters