📌  相关文章
📜  day 10 二进制数hackerrank解决方案javascript代码示例

📅  最后修改于: 2022-03-11 15:04:31.695000             🧑  作者: Mango

代码示例1
// day 10 binary numbers hackerrank solution javascript
function main() {
    const n = parseInt(readLine().trim(), 10);
    const arr = n.toString(2).split("0");
    const arrlengths = arr.map(x => x.length);
    const maxLength = Math.max(...arrlengths);
    console.log(maxLength);
}