当前位置:网站首页>Li Kou daily question - day 30 -1281 Difference of sum of bit product of integer
Li Kou daily question - day 30 -1281 Difference of sum of bit product of integer
2022-06-29 06:37:00 【Chongyou research Sen】
2022.6.28 Did you brush the questions today ?
subject :
Give you an integer n, Please help calculate and return the integer 「 The product of your numbers 」 And 「 The sum of your numbers 」 Difference .
analysis :
Given an integer , Complete the multiplication of the product of each bit , And yours , Then use the product - and . for example
123
product :1*2*3=6
and :1+2+3=6
result = product - and =6-6=0
analysis :
class Solution {
public:
int subtractProductAndSum(int n) {
int mul = 1;
int sum = 0;
while (n != 0)
{
mul *= n % 10;
sum += n % 10;
n /= 10;
}
return mul - sum;
}
};边栏推荐
- 力扣每日一题-第30天-1523.位1的个数
- Can redis implement hot standby?
- Client and server working modes of JVM
- The simple problem of leetcode is to divide an array into three parts equal to sum
- Failure: unable to log in to "taxpayer equity platform"
- Alphacode made its debut! The programming version of "Alpha dog" competed quietly and defeated half of the programmers
- Fault: NetBt log for id4321
- Presto-Trial
- Teach you how to develop your own NPM package (publish to the NPM official website)
- 关于 localStorage 的一些高阶用法
猜你喜欢

Why are keys unordered in golang map

Failure: unable to log in to "taxpayer equity platform"

What are the uses of wireless pressure collectors?

Chapter IV introduction to FPGA development platform

Delete tag

Hyperledger Fabric 2. X custom smart contract

Unity AR Shadow 阴影

Will the order of where conditions in MySQL affect the union index? Will where 1 =1 affect the use of the index? Does where 1 =1 affect the use of indexes?

分享 10 个 JS Promise 相关的面试题

Hyperledger Fabric 2. X custom smart contract
随机推荐
Is there any difference between a=a+b and a+=b?
Share 10 interview questions related to JS promise
Introduction to Ceres Quartet
Benign competition will promote each other
二叉树的迭代法前序遍历的两种方法
Draw smooth curves - methods needed - drawing smooth curves - methods needed
Antlr4 recognizes the format of escape string containing quotation marks
About: deleting unwanted event log lists
Longest substring between two identical characters of leetcode simple question
Difference between static and final
Linux Installation redis
SCM engineering experience - time slice
Labor skills courses integrated into steam Education
[c language] [sword finger offer article] - print linked list from end to end
Haar cascades and LBP cascades in face detection [closed] - Haar cascades vs. LBP cascades in face detection [closed]
Jenkins operation Chapter 5 trigger, configuration webhook, Jenkins parameterized construction
ASP. Net core 6 framework unveiling example demonstration [03]:dapr initial experience
[Flink] flinksql and table programming cases
Character pointer as function parameter
Pointer from beginner to advanced (2)