Relative Content

Tag Archive for math

Interview puzzle on traveling on a line segment

On a number line of length M, where 0 < M <= 1,000,000,000, you given N (1 < N <= 100,000) integer pairs of points. In each pair, the first point represents where an object is currently located, and the second point represents where an object should be moved. (Keep in mind the second point may be smaller than the first).

Algorithm to detect a CLICK within Square range

It might be a simple question but I am looking for optimal solution. I will have numbers printed on a screen and I will be aware of coordinates. Numbers/Symbols will have 4 points(Square) to define their boundaries. Coordinates of that particular symbol will be stored in a file. Lets’ say there is a number 5 and it’s 4 coordinates on screens are:(2,20,20,20,2,40,20,40)

Randomness of wrapped RNG

There are plenty of questions around regarding random number generation, but I couldn’t find anything that exactly matched my question. Apologies if I missed one.

strategies for dealing with machine epsilon

Say you have a situation where you divide and then multiply a float, and you need to guarantee that it survives macheps (ie multiplication output equals division input). What are known strategies for guaranteeing this? Rounding would work, but anything else?