Skip to content

XinheLIU/Coding-Interview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Preparing a Coding Interview

Principles

  • Build Knowledge Structures
  • Deliberate Practice
    • 5 to 7 times every question and expand
  • Constant Feedback
  • By Topics and Review

7 Steps for a Coding Interview

  1. Listen and Clarification
  2. Example (big, non-special cases)
  3. Brute Force Solutions
  4. Optimize
    1. Improve Step by Step
    2. Think up all possible Solutions
  5. Walk through the solution
    • Explain clearly
    • Time and Space Complexity
  6. Code
    1. White board or computer
    2. Coding Style
      1. indentation, naming, variable naming
    3. Modularization
  7. Test Cases
    1. small and fast cases first
    2. edge case
    3. big test cases

Coding Style

  • Naming - "Naming and Cache Failure"
    • Camel Style Naming
      • Python, Java
    • snake_case
      • C++
  • Indentation
  • Comments
    • file comment at head
    • TO DO
    • parameter specification, function header
    • type hint
  • Test Habit
    • function test
      • do test case in mind
    • edge case test
      • stack overflow
      • out of range situation
    • negative case test
      • invalid inputs
  • Error Handling
    • Use Return Value
    • Use Global Variable
    • Throw Error
  • Robustness
    • Defensive Programing

Suggestions

  • leave blank lines (~20%)

Coding Style Examples

PEP8 Coding Style Guid for Python

Google Python Coding Style

Google C++ Coding Style Guide

About

Coding Interview Q&A

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published