2019年3月3日 星期日

Notes on Coding Interviews

  • Search on YouTube.
  • Practice. Practice. Practice.
  • Practice a lot of problems? Not so effective.
  • Effective way: build up your knowledge from Leetcode.
  • My 5 categories: (All-in-one)[doc]
    • Foundations: [doc]
      • Array
      • String
      • Math
    • Data Structure: [doc]
      • Stack
      • PriorityQueue
      • LinkedList
      • Binary Search Tree
    • Advanced Design: [doc]
      • Backtracking
      • Dynamic Programming (too many dissimilar problems, and hard to prepare)
      • Union Find
      • Trie
    • Graph Algorithms: [doc]
      • Graph
      • Tree
      • DFS & BFS
      • Topological Sort
    • Selected Topics: [doc]
      • System Design
      • Random
      • Matrix
      • Bit Manipulation
      • Computational Geometry
  • Read articles in the Discuss.
    • Identify all possible solutions
      • Different algorithms (from brute force to effective algorithms).
      • Same algorithm with different implementations (e.g., segment tree).
      • (My documents are not completed. Try to build up your own documents.)
    • Could analyze time complexity and space complexity of each solution.
      • Analyze line by line.
      • Understand all details of build-in libraries.
      • Know which solution is the best under certain assumption.
    • Official solutions are not always concise (and the best). But it must be correct.
    • Improve your code review ability.
  • Read codes in the Submission (if possible).
    • Not always correct.
    • Learn from undocumented solutions. Need more time to understand.
  • Write down your concise code in your style.
    • About 20 ~ 40 lines in Java.
      • Concise but not tricky. Tricky codes are not easy to remember.
      • Possible to reproduce in the real interview.
      • Lengthy codes might be regarded as messy codes. 
    • Just copy or imitate other's code. 
      • Not shame.
      • Save your time.
    • Align to your style (e.g., binary search, naming convention and so on).
    • Practice makes perfect.
    • Identify your weakness.
  • Could prove the correctness of your code.
    • Demonstrate your codes line by line.
    • Design meaningful test cases.

沒有留言:

張貼留言