Skip to content

Latest commit

 

History

History
284 lines (170 loc) · 9.14 KB

File metadata and controls

284 lines (170 loc) · 9.14 KB

Interview notes

TODO

TODO (done)

Programming interviews exposed

  • Keep talking! Always explain what you are doing.
  • Play within the restrictions of questions.
  • Understand before solving. Then start with an example.
  • Explain what you're doing before and while coding. Keep talking!
  • Try an example, check all error and special cases.
  • If failing, return to specific example. Try to move from specific example to general case to solution.
  • Try different data structures or advanced language features.

Cracking the Coding Interview

  • Use data structures and OOD. e.g. to find the minimum age of a group of people define a Person class.

Five algorithm approaches

  1. Examplify. Specific examples to general rule.
  2. Pattern matching. What is problem similar to?
  3. Simplify (data type, size) and generalize.
  4. Base case (one element) then build (two, three, ...)
  5. Data structure brainstorm (run through list of data structures)

Object-Oriented Design for Software

  1. What are your goals? What is the external interface?
  2. What are the core objects, what is the hierarchy?
  3. Have you missed anything?
  4. What data structures and algorithms will you use in methods?

Steve Yegge's Phone Screen Acid Test

https://sites.google.com/site/steveyegge2/five-essential-phone-screen-questions

  1. Coding: write some simple code with correct syntax.
  2. OO design: define basic OO concepts, simple classes to model simple problem
  3. Scripting and regexs: find phone numbers in 50,000 HTML pages.
  4. Data structures
  5. Bits and bytes and binary.

General notes

### OOD

  • Encapsulate what varies.
    • When desinging softwware, anticipate change and hide it behind an interface. When things change only the implementation changes, not the consumers of the interface.
  • An interface declares but doesn't define a set of related methods that inheriting objects promise to implement.
  • An abstract class is an incomplete class definition that declares, and may or may not define, its methods.
  • Python abstract base class Animal with one method 'make_noise()', and Dog that uses it.
import abc

class Animal(object)
    __metaclass__ = abc.ABCMeta

    @abc.abstractmethod
    def make_noise(self):
        return

class Dog(Animal):
    def make_noise(self):
        print('woof!')