package
Version:
v0.0.0-...-db5e768
Opens a new window with list of versions in this module.
Published: Jul 25, 2019
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
题目
Divide two integers without using multiplication, division and mod operator.
If it is overflow, return MAX_INT.
解题思路
不能使用乘法,除法和取余运算,编写一个除法函数。大的步骤是
- 取出两个数的符号和绝对值
- 使用绝对值做除法
- 还原结果的符号
- 检查是否溢出
其中,使用绝对值做除法是重点,思路参考程序注释。
总结
递归果然简洁有力
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.