Skip to content

Instantly share code, notes, and snippets.

@natachaS
Forked from irmiller22/interview_prep.md
Created August 26, 2014 13:23
Show Gist options
  • Save natachaS/1a2ca421d265d79fa706 to your computer and use it in GitHub Desktop.
Save natachaS/1a2ca421d265d79fa706 to your computer and use it in GitHub Desktop.

Interview Prep

General Thoughts for Interviewing

Three Primary Responsibilities

  • Build.
  • Blog.
  • Bresent.

Problem Solving

"Make it work, make it right, make it fast."

Common Mistakes

  • Misallocation of time
  • Start writing code right off the bat
  • Attempt to solve problem on the first run through

How to Approach a Problem

  • Read through the problem twice
  • Solve the problem manually first (you should be able to explain the problem clearly to someone else)
  • Verbally walk through each step you take to manually solve the problem
  • Optimize (if there is a loop that can be put in somewhere, take that into account)
  • Pseudo-code the optimized manual solution steps in comments
  • Write out the code for each comment underneath
  • Optimize the code solution

Whiteboarding

  • Use Pseudocode to document your thought process.
  • UML/diagram out your solution to the problem (boxes to represent classes, cylinders to represent database, etc)

Lightning Code Questions

Resources

Big O Notation

Objectives of Big O

  • Determine the complexity of an algorithm
    • Best Case
    • Average Case
    • Worst Case
  • Algorithms are used in terms of:
    • Time efficiency (how much time it takes to run through a collection)
    • Space efficiency (how much memory it's taking up)
  • Big O used to determine usability of algorithms in cases such as:
    • Corporate databases with millions of records accessed frequently
    • Search engines
    • Computer games
    • Jet plane technology that needs to determine a flight path in real-time

How Do We Measure Algorithms?

  • Two ways: counting the number of operations, and timing via system time comparison
  • For algorithmic efficiency, it's best to count the number of operations, which can be represented as some sort of cost function that's based upon the input size
def iterate(size)
  array, n = [], 0 # declare and initialize array and n => 2 (there are 2 variables being set)
  while n < size # comparison and  => 1n (because it performs this for every number you iterate through) + 1 (it will eventually reach a point where n = size)
    n += 1 # increment => 1n (performs this for every number you iterate through)
    array << n # shovel => 1n (performs this for every number you iterate through)
    puts array.inspect
  end
end
  • The exercise above results in a complexity cost of: Ct = 3n + 3

Resources

Quizzes

Ruby Interview Questions

Interview Insight

Be Yourself

  • Interviewers tend to also be programmers. They're just as nervous as you are.
  • Connect with them.
  • Be curious. If you don't know an answer to a question, be honest. Ask them if they could explain it to you, and follow up with them afterwards about what you've learned.

Share Programmers You Admire

  • Have at least 1 or 2 programmers that you look up to.
  • Why you like them, etc.

Current Events and Newsletters

  • Read up on current events in the programming world.
  • I personally like Ruby Weekly (my favorite), Rails Weekly, and frequently read Hacker News

Resources

Final Thoughts

For When You Get Bored of Interview Prep...

I always turn to inspiration to keep me going. Here are some resources I've dug up.

Postwork at Flatiron

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment