# Interview Question: Which Side of a Square?

Q: Given a square and a point outside of the square, how do I quickly determine which "quadrant", (top, bottom, left, or right) the point is in?

It's helpful to draw a picture:

Remember what slope is? It's a measure of how slanted a line is. You can find it easily with arithmetic: $m=\frac{y_2-y_1}{x_2-x_1}$. If you look closely at my picture, you can see exactly how this can give us the answer. We know that if $-1, the point is either on the right or the left of the square. If $P$ has a greater $x$, then $P$ is on the right. Using this method we can very quickly determine which side of the square the point is.