mirror of
https://github.com/lWolvesl/leetcode.git
synced 2026-01-12 18:08:38 +08:00
717
This commit is contained in:
19
25/11/717.cpp
Normal file
19
25/11/717.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <vector>
|
||||
|
||||
bool isOneBitCharacter(std::vector<int> &bits) {
|
||||
bool tag = true;
|
||||
int n = bits.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (tag && bits[i] == 1) {
|
||||
tag = false;
|
||||
continue;
|
||||
}
|
||||
if (tag && bits[i] == 0) {
|
||||
continue;
|
||||
}
|
||||
if (i != n - 1) {
|
||||
tag = true;
|
||||
}
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
Reference in New Issue
Block a user