题解 | #求int型正整数在内存中存储时1的个数#

求int型正整数在内存中存储时1的个数

http://www.nowcoder.com/practice/440f16e490a0404786865e99c6ad91c9

console.log(parseInt(readline()).toString(2).split('').filter(el=>el=='1').length)
全部评论
还可以直接替换成空串再获取长度
点赞 回复 分享
发布于 2022-07-03 15:49

相关推荐

评论
10
2
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务