Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution12 #373

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Solution12 #373

wants to merge 2 commits into from

Conversation

FelixU-github
Copy link

学号:2023120253
姓名:余昊卿
题目:Solution-12
修改思路:
如果 num 1和 num 2之一是 0,则直接将 0 作为结果返回即可。
如果 num 1和 num 2都不是 0,则可以通过模拟「竖式乘法」的方法计算乘积。从右往左遍历乘数,将乘数的每一位与被乘数相乘得到对应的结果,再将每次得到的结果累加。
修复了 ans == 的问题:改为 ans = addStrings(...),确保进行赋值操作。
添加了缺失的分号:在 String ans = "0"; 后添加了分号。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant