Approach
I have learned from reading Cracking The Coding Interview, Interview Cake and Project Euler that problems can be approached in similar ways. I have noticed that Greedy and Brute Force Algorithms are very helpful in breaking down a problem. Most of the time, there are keywords in the problems that help determine which algorithm to use. For example when you want to find the highest value in an array, use the greedy approach to keep track of the highest value as of yet.
Implementation
During practice implementation, I try to not optimize while I code. I have noticed as I was making notes for each problem, my weakness is optimizing as I code which can result in lost time. It is great to have a basic understanding of optimization of space and time in mind when coding for example, the number of initialized variables used or nested for loops.
Review
The review stage is important because I can then fully optimize my solution. Below are the questions I ask myself when reviewing:
- Are all initialized variables used?
- Are the functions optimized in space and time?
- Is the code readable? documented?
- What is the big O notation of the functions?
Hacker Rank
The below are notes about what I have learned from solving each problem at HackerRank.com @csmattjohnston
Contact
Feel free to contact me at johnston.matt.vt@gmail.com for questions and solutions.