leetcode 717 1-bit and 2-bit Characters
来源:互联网 发布:古诗文阅读优化卷答案 编辑:程序博客网 时间:2024/05/16 05:20
Java
class Solution { public boolean isOneBitCharacter(int[] bits) { int len=bits.length,i=0; while(i<len-1){ if(bits[i]==0) i++; else i+=2; } return i==len-1; }}
Python
class Solution: def isOneBitCharacter(self, bits): """ :type bits: List[int] :rtype: bool """ l,i=len(bits),0 while i<l-1: if bits[i]==0: i+=1 else: i+=2 return i==l-1
阅读全文
0 0
- leetCode-1-bit and 2-bit Characters
- 1-bit and 2-bit Characters(leetcode)
- LeetCode.717 1-bit and 2-bit Characters
- leetcode 717 1-bit and 2-bit Characters
- 1-bit and 2-bit Characters[Leetcode 717]
- 717 1-bit and 2-bit Characters
- LeetCode-717. 1-bit and 2-bit Characters
- LeetCode之1-bit and 2-bit Characters(Kotlin)
- Leetcode#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
- 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
- 717. 1-bit and 2-bit Characters。
- 717. 1-bit and 2-bit Characters
- 制作业务流程 timeline 结合AdminLTE
- CentOS搭建MySQL主从复制,读写分离
- JSP的MVC模式
- 【Scikit-Learn 中文文档】分解成分中的信号(矩阵分解问题)
- 【Scikit-Learn 中文文档】优化估计器的超参数
- leetcode 717 1-bit and 2-bit Characters
- C++Error2208:...尝试引用已删除的函数
- 尺取法
- 面试题28:字符串排列
- STM32系统学习——DMA(直接储存器访问)
- IntelliJ IDEA调整控制台输出字体大小
- NSThread的属性
- Linux下通过SSH实现远程连接
- 【Scikit-Learn 中文文档】协方差估计 / 经验协方差 / 收敛协方差 / 稀疏逆协方差 / Robust 协方差估计