The goal of the below is how to get to code complete (i.e. no bugs, functioning code). I have noticed many times that I know the pattern, start coding, and yet, I mess up when I write code.
I have found writing pseudocode to be the easiest way to flush out my thoughts. Below is a guide/hack book that I often use.
Some Useful links
Observations
- Rate of code complete much higher when writing pseudocode
- Takes between 8-13 minutes to code a medium problem if pseudocode is written (Assuming it is around 20-30 lines).
- Pseudocode is taking around 9-30 minutes (depending on pattern and comfort level)
- On average 1-2 bugs per problem. Saw a pattern of missing out on different
- Keep forgetting how to declare Queues, Stacks, Iterator, and Comparator in Java without IntelliSense
Pseudocode
Things to focus on when writing pseudocode
Arrays
- Index manipulation results in IndexOutOfBounds. Check for conditions where there is
+1
and -1
.
- Make sure to write the formula to do index manipulation
- Two pointers and fast/slow pointer
- Make sure to handle the case of pointer that is ahead else will get IndexOutOfBounds