Leetcode 717. 1 bit and 2 bit Characters | | Leetcode 717. 1 bit and 2 bit Characters 文章作者:Tyan博客:noahsnail.com | CSDN | 简书 1. Description 2. Solution123456789101112class Solution {public: bool isOneBitCharacter(vector<int>& bits) { int step = 1; int index = 0; while(index < bits.size()) { step = bits[index]==1?2:1; index += step; } return step == 1; }}; Reference https://leetcode.com/problems/1-bit-and-2-bit-characters/description/ 如果有收获,可以请我喝杯咖啡! 赏 微信打赏 支付宝打赏