What things you should know how to do in your programming language

The heights by great men reached and kept were not attained by sudden flight, but they, while their companions slept, were toiling upward in the night.

In a coding interview, you are judged on multiple attributes like analytical abilities, problem-solving skills, computer science fundamentals, software engineering practices, coding style and also programming language proficiency. And you might already know that you are expected to write a correct & runnable code i.e. code free of logical as well as syntax errors. The purpose of this post is to remind you of a variety of common things that you would need when writing the code in the coding interview. What you must do is to check the syntax of that thing in the language of your choice.


Core Programming Language

  1. Loops
    1. `for`, `while`, `do` … `while`
    2. Many languages provide shorter, easier versions of loops, know them so that it saves you time during the interview. 

  2. Conditions
    1. `if` .. `else` ..
    2. Python uses `elif` while C++, Java use `else if`.
    3. Python does not have a `switch` but C++, Java do.
    4. Ternary operator `?`. C++, Java have it, Python doesn’t.

  3. Defining functions, classes. Creating objects, variables.

Data Structures

  1. Array
    This is by far the most common data structure that you will use in the interview. So know how to –
    1. Declare a 1-D array and 2-D array.
    2. How to initialize it to 0.
    3. How to access an item at some index.
    4. Inserting an element at the {beginning, middle, end}.
    5. Deleting an element from {front, back, middle}.

  2. String
    1. Copy a string to another, concatenation of two strings, adding a character to the string, removing a character from the string.
    2. Converting a string to a character array.
    3. Finding a substring in the string. Finding a substring using regular expressions (if your language provides this easily).
    4. Find and replace in the string.
    5. Convert a string to lowercase, uppercase, titlecase.
    6. Remove trailing, leading whitespaces from a string. 

  3. Linked List
    1. Creating a linked list.
    2. Inserting and deleting an element.

  4. Stack, Queue
    1. Creation.
    2. Names of the methods for inserting and deleting an element. (Some use push-pop while others use insert-remove. Method names insert, add, append, push, push_back, push_front, offer, erase, remove, delete, pop, pop_front, pop_back, peek can create a lot of confusion in an interview. So know what names your language uses and confirm what they really do.)

  5. Heap/Priority-queue
    1. Creation, insertion, deletion.

  6. Map and Set
    1. Creating a hash-map vs tree-map, hash-set vs tree-set.
    2. Insertion, deletion.

  7. Trie
    1. Implementation with create, insert, search methods.


I assume most of you would already know the syntax for all items in the “Basic” section. Here come some relatively advanced things to know. This section primarily focuses on knowing the internal details and additional library support available. Knowing the available methods in the library can save a lot of time in an interview which has the potential of making or breaking your interview.

  1. Array
    1. How is an array implemented internally? 
    2. Is it a dynamic array or fixed-size array?
    3. What are the additional methods available for arrays? (E.g. in C++, the push_back() method of a vector class can be used to insert an element at the end and you can also use the insert() method.)
    4. What are the return values of those methods?
    5. How are those methods implemented and what are their time complexities?
    6. How to sort an array?

  2. String
    1. How is string copy done? How is one string appended to another? What is the time complexity?
    2. How much time does finding a substring take?
    3. How to take a part of the string out?
    4. What are some in-built methods available? Convert to lower case, upper case, convert to an integer, integer to string, etc.
    5. String parsing – How to split a string at spaces (or any other character) and make it a list of strings? Tokenization.

  3. Linked List
    1. How is a linked list implemented internally? Is it a singly linked list or a doubly-linked list?
    2. What are the time complexities of various operations?
    3. What are the additional methods available on this? (E.g. C++ has merge(), reverse(), sort(), etc. methods that can be very helpful in an interview)

  4. Stack, Queue
    1. How are they implemented internally? Are they implemented as a circular array? Is it a linked list?
    2. Does top() method on a stack also remove the element? Does pop() method return the value of the element removed?

  5. Heap/Priority-Queue
    1. Is it a max-heap or min-heap? What is the default behavior? How to achieve the opposite behavior? How to pass a custom comparator to the priority queue?
    2. What is the time complexity of each operation?

  6. Map (Set)
    1. Is it a hash-map or a tree-map? How to create each of them? How are they internally implemented?
    2. How to get the value based on the key? What is the returned value when the key does not exist?
    3. What is the time complexity of insert, delete, lookup operations?

  7. In-built methods that can be very useful
    1. Sort
      1. Time complexity? What is the sorting method used internally?
      2. Default order? How to alter the default way?
    2. Binary Search
    3. Max/Min between two items, max/min in an array
    4. Set operations – Intersection, Union
    5. Convert an array to heap
    6. Random – Getting a random number between two numbers


  1. Passing a custom comparator.
    This can be so useful when it is needed that I can’t stress enough. 
    1. An example use case is when you have an array of instances/objects of a class that you have written. The in-built sort() method does not know how to compare the two objects of your class and so can’t order them. You will have to provide your own comparator to let the method know how to compare two objects – which one of the two should be ordered relatively higher compared to the other. Just because you don’t know how to pass the custom comparator to the sort method, you don’t want to write a quick sort method on your own, do you?
    2. Similarly, sometimes you would want to insert your custom objects into a priority-queue/heap. Again, you will have to provide a way for the priority-queue to order two objects.
    3. Also, say you have a list of pairs of integers and you want to sort them based on the second value of the pair in descending order. But if second values are the same, then you want to order based on the first value in ascending order. A custom comparator is going to save you a lot of time and trouble.

  2. Implementing the equals method or equality operator for your custom class
    Say you have a list of objects of your class and you want to see if some object exists in your list. The find() method will have to compare the object you are searching with the object in your list. For primitive types like integers or strings, the method knows how to compare them. But it does not know how to decide if two objects are equal, so you must know how to implement the equals method and pass it to find() method. If you don’t implement the equals method, only the references will be checked and it might not give the desired result. 

  3. Hash function for a Map
    Sometimes you need to add your own object as a key to the hash-map. Obviously, hash-map does not know how to hash your object. So you need to implement a way to hash your object. Sometimes it may be beneficial to pass your own hash function to the map. Knowing this will save your interview. But let me also be honest and say that this is very rare in a coding interview that you will need this.

  4. Lambda Expressions
    This can be a way to save time and maybe show your proficiency in the language. 

I have listed most of the things that I have ever had to use across all the interviews I have appeared for. Some things are necessary for pretty much every interview while others are rare. I recommend studying everything even if it is a rarely necessary thing because I want to enable you to crack every coding interview.

Even though I tried to include a lot of things, I might have still missed a few. What have helped you in your interviews so far? What do you think I should add to the list to help everyone? Let me know in the comments your thoughts and interview experiences.

Don’t forget to like, share the post and subscribe to the blog.

Happy interviewing!

Related Posts

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s