Category: math
Given a number of coordinates (could be any dimensions, but for simplicity we use 2 dimension X/Y coordinates for demonstration), you can get the ‘central’ point by averaging all …
If we want to compute , and if the y is integer, we can easily do this using a straigtforward loop O(n), or a O(logn) approach. However, if the …
We all know that the 32-bit signed/unsigned integer takes 4 byte while 64-bit signed/unsigned integer takes 8 bytes to store. If there is a very big integer which is …
Given a non-negative integer n, please find out the number of integers that have the unique digits between [0, 10^n). For example, if n = 2, there are 91 …
The Interview Question: Assume the Rand5() gives a random integer from 1 to 5. Each possible return is given with the same probability. How do you construct the Rand7() …