Starting your interview preparation: 01 Programming Mathematic

Sankalp Sharma
7 min readMay 31, 2020

--

About

These are challenging times and many of us are preparing for job interviews of big software companies. Whether you are trying for (FANG) or any other company, the idea behind this article is to help you by sharing some of my insights. If you are new to this domain, it might be very helpful to see someone else prepare alongside you. This article and upcoming ones will be based on how I am preparing for the interviews on a specific topic. Have a read.

Is it for you?

I didn’t write this for any specific college or country’s education system or any specific programming language. Its OPEN FOR ALL, Hurray! (Hurray with a straight face of course).

I hope you guys can scavenge something useful out of this. I will be delighted that I could help even a single soul.

There are a lot resources or personal experiences of other people out there, many of them might be better than this one but this is my way of preparing and I hope you find something useful in it. You figure out what works best for you.

it aint much but its honest work, meme
Credits: knowyourmeme.com

Future details about this blog

I will be uploading articles after finishing a certain topic myself. Therefore, there will be gaps of days between articles.

This is my first article, people wondering why is this guy just not telling the stuff. It is for once, I am introducing about my ideas for these articles and won’t be repeating in upcoming ones. So before you go like “IMMA HEAD OUT”, hold your horses for a minute. (Please)

About my level

Nothing special, I am familiar with python basics and have rookie coding skills. Although I have a fair idea about the concepts of Time Complexity and Space Complexity. I will not be sharing that part.

Time Complexity and Space Complexity

Pro tip: Read about the importance of constraints in any programming challenge, it could be a life saver.

I would suggest you get familiarised with these in a day or a few then you can hop along the journey.

The Real Stuff

Without any further ado, let us begin.

waiting skeleton, referring to long wait for real information
Image Credits: iStock

If you need to choose a programming language

comparison between python and C++ in terms of speed. C++ is faster
Credits: Hogwarts
Readability comparison of C++ and Python, python is more suitable for new coders
Credits: Man of Many, Ford cars

I would suggest C++ for its performance (if you are planning for competitive, go for this).

Python can help beginners with its simplicity (not good for competitive programming).

No pressure for switching, go with what you are comfortable with right now.

My Remedy to prepare for programming mathematic

Theory to learn

If you didn’t have a math background, study the basic elementary level concepts of these topics:

· Number system (Binary, Hexadecimal, so on)

· Prime Numbers (primality check)

· Catalan Numbers (it is okay if you didn’t understand at first)

· Basic geometry (line equations, collinearity, circle, tangent, el cetera)

· Basic calculus (it will be helpful if you know some of it, but no pressure. Don’t burn out)

· Factorials

· Basic functions (logarithmic, exponential, polynomial, et cetera.)

· Series (Arithmetic Progressions, Geometric Progressions, Harmonic Progressions)

· Sum of natural numbers with power of k. ( 1<=k<=3 or k=[1,3])

· Basic Mensuration

· Matrices

· Implementing simple math functions (LCM, GCD)

· Properties of LCM and GCD

· Set theory

If you get frustrated while studying or solving questions. Don’t please, It happens with everyone including myself.

Sarcasm meme
Credits: MEME

Let me tell you if you give up by getting frustrated. It is the most common point in this journey where people back out. If you do, this song is for you.

Nobody has ever quit because they were able to solve the problems.

Another one bites the dust
Credits: Cover of an album. Artist: Queen

Youtube channels to take a look

These are some channels which I follow and think are pretty good

Rachit Jain: Mostly good for getting motivation when frustrated and coding problems.

Gaurav Sen: Channel for System Design (will be covering that later) also preparation experiences of other SDE out there.

Errichto: This guy is all for competitive programming.

CSDojo: Some projects, programming concepts and so on. This is a go to.

MIT OpenCourseWare

After you study the above topics you can check out the Algorithms course on MIT OCW, it will be helpful in the future too with all the other topics.

truth scroll meme saying practice is the key for better coding skills
Credits: Imgflip

PRACTICE

Practice is the only key to get through this. There can be no knowledge without sacrifices.

If you think you cannot find enough time for this, you will have to get your priorities figured out whether you really want this or not.

But we do not have years of patience or time before the interviewing begins. So, our practice must be optimised for efficient results. (hey look I made a pun, you know pun about time complexity of practice. *laughs in nerd*)

Go for Interviewbit, Leetcode, Hackerearth, Codeforces et cetera. I do leetcode. (not that anybody asked but ok)

Once you are done with the above steps, math based question are not the most common questions asked in the interviews. So don’t beat yourself, what I mean is don’t overdo.

Most questions will look straightforward, but your straightforward answer will get you Time Limit Exceeded and your shot goes in the garbage can.

For any company, second most priority after first being able to solve a problem is the time complexity of the solution. It is highly unlikely that they would get shortlisted you if you did not give them the most efficient answer. Don’t go running with dumb answers, hold and think of a clever solution.

comparison between two coders. coder with efficient programs is better
Credits: SpongeBobia- Fandom

Algorithms and Theorems

Things to learn after this. (Importance of the topic out of 5, with 5 being the highest)

· Karatsuba Multiplication (2)

· Properties of all elementary topics asked to study before (5)

· Primes and factors (5)

· Goldbach’s conjecture (2)

· Twin prime conjecture (3)

· Legendre’s Conjecture (3)

· Sieve of Eratosthenes (5) (can be implemented in many forms)

· Euler’s phi/totient function (4)

· Modular Arithmetic (5)

· Pigeonhole Theorem (3)

· Chinese remainder theorem (3)

· Lucas theorem (3)

Problem Solving

Leetcode problems to refer, it is based on my experience there are many good problem to attempt.

Problem numbers are 168, 633, 914, 441, 970, 628, 1232, 149 ,50 ,279 ,202 ,268 ,287, 326, 13, 171, 645, 204.

Also filter math tag from top 100 liked questions and top 100 interview questions.

· Start with some basic easy questions to get familiar with any inbuilt functions of your programming language.

· Implement GCD, it’s a must

· If you are good in math and like math problems check out Project Euler try some basic questions on the platform.

Note: if any Dynamic Programming question comes just mark it and move ahead, that will be done later.

Tips while solving problems.

· Always read the solution after submitting your answer, also read submissions by other coders to see other ways of solving the problem.

· Mark the question if it is important, always write the most efficient code don’t be lazy.

If there is O(n) solution write it, don’t give O(n²) solutions even if it gets accepted. It won’t be accepted in the interview.

· Test your code in your mind, don’t depend on submit button because this will not be the case in the interview. If you cannot review your code, it is against your favour.

And the secret for getting a decent job

Encouragement that you can do it. crack the interview
Credits: Kung Fu Panda (The Quotes)

P.S: Take a look in float datatype arithmetic, they don’t behave the way you think.

I hate goodbyes :’(

For now this is it, If you want any specific details about the prep in upcoming articles, let me know in the comments. This is my first article so I am open for suggestions, do provide your insights. I will probably be coming up with Arrays next. You guys practice math and many of these concept is going to be applied in Arrays also, as programming topics are connected.

Follow if you want to get notified. Happy Coding. Be safe. Have a good day.

basic program in C taken from wikipedia for showing coding
Credits: wikipedia.org

--

--

Sankalp Sharma

In order to understand recursion, one must first understand recursion. (not mine)