
Programming/Coding Interviews stand between you and your dream job.
Practice is the key to understanding key pointer concepts, solve pointer problems by visualizing the memory layout.
Arrays are pointers at heart, work with them exactly like you would with pointers.
Strings are character pointers which are equivalent to character arrays. Solve functions from the string.h library for practice dealing with pointers.
Linked lists are favorite interview questions for software engineering roles. If you can work linked lists you're on your way to tackling more complicated problems. Understand the memory set up of linked lists and start with a few problems to gain confidence.
Get the length of a linked list, access the nth element in a list, and append an element to the end of the list - all this while handling null lists and other details.
For a simple concept, linked lists can get surprisingly tricky very quickly. Practice and practice again to gain mastery over linked list problems
Append an element to the end of the list - all this while handling null lists and other details.
For a simple concept, linked lists can get surprisingly tricky very quickly. Practice and practice again to gain mastery over linked list problems.
Use the linked list as a stack and implement pop, delete all the elements in a list - tricky memory freeing here, insert an element at a specified position and in a sorted list - these are similar but the edge cases differ.
Once you've actually solved all the examples we've got so far, you'll find that linked lists are fun! This class has a particularly difficult sample problem which will introduce you to the fast and slow pointers which traverse a linked list at different speeds. Useful for a lot of tricky maneuvering.
Append one list to another and split a list into two by using fast and slow pointers. This second problem is much, much harder than it seems.
By now you should be able to solve linked list problems in your sleep. Let's practice a few last ones to gain complete master over them.
Remove duplicates from a sorted list, move the first node from one list to another, merge two sorted lists and finally reverse a linked list.
Functions to get the nth bit of an integer and to set the nth bit of an integer. These are the building block functions and the concepts underlying these will be used for harder bit manipulation problems.
Print all the bits used to represent an integer from the most significant bit to the least significant. Learn some subtle details about the shift right (>>) with negative numbers!
Count the number of 1s in an integer, and learn a neat trick which allows you to do it in complexity O(number of 1s).
Play the game of life where every cell can change states from live to dead based on its neighbours.
Run length encoding involves specifying the number of times a character is repeated in a string. Decoding run-length-encoded strings can be pretty tricky, let's find a solution for both.
If a number were represented by its digits, can you write code to add 2 numbers represented in this way? Let's walk through a solution and see if you can get this right.
Write code to check whether a Sudoku board is valid. This should work for both complete and incomplete boards. Sudoku is tricky and this has many conditions to check.
Lastly set up your own numeric system and then increment a number represented in that system by 1.
What is the performance of your code? How do you measure this? What is complexity and what is its relationship with performance?
Insertion sort is an improvement over both bubble sort and selection sort. Let's see how exactly it works and why it's preferred in many cases.
Binary trees lend themselves to problems which have really beautiful recursive solutions. The problem may seem hard but the solutions end up being simple. Checking for whether 2 trees are the same is one such problem.
Say you were given all the tasks needed to build a complete car. These tasks may depend on one another. Set up a data structure to represent a task and it's dependencies and write code to build a car.
A common, fast but slightly tricky implementation of the queue is the array where the last element wraps around to the first. An interview favorite, let's see how to implement the circular queue.
Depth first traversal can be of 3 types based on the order in which the node is processed relative to it's left and right sub-trees. Pre-order traversal processes the node before processing the left and then the right sub trees.
Depth first traversal can be of 3 types based on the order in which the node is processed relative to it's left and right sub-trees.
In-order traversal processes the left subtree, then the node itself and then it's right sub trees. Post-order traversal processes the node *after* it's left and right subtrees.
The algorithms are all remarkably similar and very easy once you use recursion.
Programming interviews are like standard plays in professional sport - prepare accordingly. Don't let Programming Interview gotchas get you down!
What's Covered: