Here are some tips I have found to be quite useful while doing programming interviews:
- Have a whiteboard nearby (really helps to draw out your thoughts!)
Here are some technical tips: 1. A common theme is iterating down the columns of a 2D list of lists (without using numpy!) 2. Graphs! Many problems are just waiting to be solved using graphs. But the translation from the problem into the graph has some flexibility (which affects the runtime, and everything really): 1. For instance, do we represent the graph as an adjacency matrix, or an adjacency list? 1. I had been a big proponent of adjacency matrices, but find that adjacency lists are really quite useful these days: they take less memory, and can support sets (which allow for very quick indexing and membership lookup) 2. Have BFS/DFS in the back of your head constantly. 3. Use special data structures: sets, deques, heapq, OrderedDicts, DefaultDicts etc. 1. Side note: if I ever teach a CSC263 course, one of my assignments will be to empirically compare these data structures in real life with the Python data structure 4. Hashmap, regex, indexing with arrays, all of this is useful.
Still upcoming: solving knapsack problem etc.