mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2025-07-27 20:22:33 +08:00
content: add new math suggestion (#233)
* content: add new math suggestion * Update math.md Co-authored-by: Yangshun Tay <tay.yang.shun@gmail.com>
This commit is contained in:
@ -13,6 +13,8 @@ Check for and handle overflow/underflow if you are using a typed language like J
|
|||||||
|
|
||||||
Consider negative numbers and floating point numbers. This may sound obvious, but under interview pressure, many obvious cases go unnoticed.
|
Consider negative numbers and floating point numbers. This may sound obvious, but under interview pressure, many obvious cases go unnoticed.
|
||||||
|
|
||||||
|
When dealing with floating point numbers, take note of rounding mistakes. Consider using epsilon comparisons instead of equality checks. E.g. `abs(x - y) <= 10e7` instead of `x == y`).
|
||||||
|
|
||||||
If the question asks to implement an operator such as power, squareroot or division and want it to be faster than O(n), binary search is usually the approach to go.
|
If the question asks to implement an operator such as power, squareroot or division and want it to be faster than O(n), binary search is usually the approach to go.
|
||||||
|
|
||||||
#### Some common formulas:
|
#### Some common formulas:
|
||||||
|
Reference in New Issue
Block a user