Exercises VI
1-bit and 2-bit Characters
解法:greedy
class Solution {
public:
bool isOneBitCharacter(vector<int>& bits) {
int i=bits.size()-2;
while(i>=0&&bits[i]>0) i--;
return (bits.size()-i)%2==0;
}
};
Can Place Flowers
最后更新于
这有帮助吗?