Saturday, March 3, 2012

Programming Interviews Exposed reading notes 1

Approaches to Programming Problems
 (Secrets to Landing Your Next Job)

Take the time to make your code solid and pretty.

Lesson1: These problems are hard! Some of the questions are designed to see how you handle a problem when you don't immediately see the solution.

Lesson2: Brush up on the languages you expect to use, and write your best code.

Lesson3: Keep talking! Always explain what you are doing.

Lesson4: Many questions involve ridiculous restrictions, use obscure feature of languages, and seem silly and contrived. Play within the rules.

Lesson5: Make sure you understand the problem before you start solving it, then start with an example to solidify your understanding.

Lesson6: Explain what you are doing to your interviewer before and while coding the solution. Keep talking!

Lesson7: Try an example, and check all error and special cases.

Lesson8: When all else fails, return to a specific example. Try to move from the specific example to the general case and from there to the solution.

Lesson9: Sometimes a different data structure or advanced language feature is key to the solution. (advanced feature: bit operators, union types, complex pointer casting and advanced keywords )

p.s.
1. One of the shared traits of almost all interview coding questions is that the correct solutions are short. You rarely need to write more than 15 lines of code and almost never more than 30. If you start writing lots of code, it should be a warning that you may be heading in the wrong direction.
2. You often need to compare a value to NULL or 0.
    if ( elem != NULL ) { or if ( elem ) {


No comments:

Post a Comment