Mathematics
Mathematics is a very wide topic and there are many fields in it that could be covered. There are also plenty of different tasks that one could face that require math in one form or another. In this section we will try to outline some very popular ideas that may be helpful at tech interviews. Let’s focus on topics and practice tasks that are likely to be used at the interviews. We will only briefly mention different problems and techniques, so that you can get a better sense of what’s important.
Representing numbers in different bases
This is fundamental to computer science as a whole. It’s important for everyone in the industry to be familiar with how a number is represented in different bases and how to convert between these representations. The most often used bases are probably 2, 8, 10, 16. Base 10 is what we mainly use nowadays and the others happen to be degrees of 2 and have application in computer science.
Integer number factorization
Breaking down an integer into the product of smaller integers is something that is often useful for solving various algorithmic problems. It usually boils down to finding the prime divisors of an integer as they can be the basis for finding all divisors of a number, for example.
Prime numbers
Prime numbers play a major role in mathematics. In computer science they are probably most widely used in cryptography. For your tech interviews and everyday work as a computer scientist it’s good to know how to efficiently find all prime divisors of an integer. Also, checking if a number is prime or finding the Nth prime number are fundamental tasks with multiple applications.
Greatest common divisor (GCD)
The GCD of two integers gives you the greatest integer that divides both integers. It can help you when working with fractions. You will see that in the practice tasks. Or, for example, it could be useful when solving some sort of a fitting problem where smaller objects need to fit into bigger ones and we don’t know how many times. There is a efficient algorithm for computing GCD and it will be covered in more detail in the practice tasks.
Geometry
This is a huge topic on its own. Such tasks could be expected less often at regular tech interviews. Well, if you happen to apply for a more specialised position, say in computer graphics, you may need to prepare more extensively here. However, some popular tasks that come to mind are finding the area of a triangle or a shape with more sides (convex vs non-convex), finding intersections of rectangles or the total area covered by overlapping rectangles, computing the convex hull of a set of points and many more. Take a look at the link to the TopCoder tutorial below for some additional examples.
Resources
- TopCoder tutorial on mathematics
- TopCoder tutorial on prime numbers, factorization and euler function