摘要: !!!题目地址!!! int subtractProductAndSum(int n){ int product = 1; int sum = 0; while(n != 0){ product *= n%10; sum += n%10; n /= 10; } return product-sum; 阅读全文
posted @ 2022-05-18 00:37 ReaIms 阅读(13) 评论(0) 推荐(0) 编辑
摘要: !!!题目地址!!! int hammingWeight(uint32_t n) { int total = 0; for (int i = 0; i < 32; i++) { total += (n & 1); n = n >> 1; } return total; } 阅读全文
posted @ 2022-05-18 00:31 ReaIms 阅读(10) 评论(0) 推荐(0) 编辑