Cracking the coding interview: 150 questions and solutions

  1. Interview process

Timeline and Preparation Map

Top 10 Mistakes

Frequently Asked Questions

  1. Behind the Scenes
  1. Special Situations
  1. Before the Interview

5.Behavioral Questions

6.Technical question

  1. The Offer and Beyond
  1. Interview Questions

1+ year

build side project

expand network

build website/portfolio
showcasing

focus work on "meaty" project

3-12 month

try to add on
one more project

create draft of resume and
send it out for resume review

make target list of
preferred companies

read intro sections of Cracking the coding interview

begin practicing
interview questions

form mock interview group with
friends to interview each other

1-3 month

4 weeks

1 week

day before

Day of

After

Do mini-projects to solidify
understanding of key concepts

Do several mock interviews

Create list to track mistakes
you've made solving problems.

create interview prep grid

review/update resume.

re-read intro to CtCi, especial tech & behavioral section,

practice questions, writing code on paper

onsite interview

phone interview

Do a final mock interview

rehearse stories from the interview prep grid

re-read 5 algorithm approaches

Rehearse each story from interview prep grid once.

continue to practice interview questions

review list of your mistakes

continue to practice questions &
review your list of mistakes

re-read 5 algorithm approaches.
Make sure remember them

review powers of 2 list. Print list if a phone screen

be on time and confident

Write thanks you note to recruiter

check in after 1 week
if not information from recruiter

if no offer, ask when you can re-apply. don't give up hope

Dress Code

Incorrect Answers

The Evaluation Process

How Questions are Selected

Experienced Candidates

Tester and SDETs

Special Situations

Program and Product Manager

Start-Ups

Getting the right experience

Building a Network

Writing a great resume

Employment History

Length

Projects

Programming Languages and Software

Advice for Non-Native English Speakers and Internationals

Behavioral Preparation

How to Prepare

What are your weaknesses?

What was the most challenging part of that project?

What questions should you ask the interviewer?

Genuine Questions

Insightful Question

Passion Question

"Tell me about a time when you...,"

Most Challenging

What You Learned

Most Interesting

Hardest Bug

Enjoyed Mos

Conflicts with Teammates

Handling Behavioral Question

let note arrogant by being specific!

Limit Details, just state the key points

Give Structured Answer

S.A.R. (Situation, Action, Result)

Technical Preparation

How to practice a question

  1. try to solve problem by your own
  1. write on the paper
  1. test you code on paper
  1. type your paper cade as is into a computer

handling technical questions

What You Need To Know

must-have to knowledge table image

powers of 2 table

step 1: ask to detail question

Five Algorithm Approaches

2: design an algorithm

3: Write pseudocode first, but tell interviewer

4: write code

5: test your code

\What Good Coding Looks Like

Error Checking

Flexible and Robust

Modular

Appropriate Code Reuse

Use Data Structures Generously

aspects of "good" code

Correct

Efficient

Simple

readable

maintainable

handling offers and rejection

evaluating the offer

negotiation

on the job

set a timeline

build strong relationships

build strong relationships

ask for what you want

just do it

have a viable alternative

have a specific "ask"

Overshoot

Think Beyond Salary

Use Your Best Medium

Offer Deadlines and Extensions

Declining an Offer

Handling Rejection

The Financial Package

Career Development

Company Stability

The Happiness Factor

Data Structures

Concepts and algorithms

Knowledge Based

Additional review Problems

  1. Solutions

Data Structures

Concepts and algorithms

Knowledge Based

Additional review Problems

Arrays and strings

hash tables

string buffer

array list (Dynamically resizing array)

Linked lists

stacks and queues

trees and graphs

Creating a Linked List

Deleting a node

the runner technique

recursive problems

implementing a stack

implementing a queue

Potential Issues to Watch Out For

Binary Tree vs. Binary Search Tree

Balanced vs. Unbalanced

Full and Complete

Binary Tree Traversal

Tree Balancing: Red-Black Trees and AVL Trees

Tries

Graph Traversal

Breadth First Search

Depth First Search (DFS)

Bit Manipulation

Bit Manipulation By Hand

Bit Facts and Tricks

Brain Teasers

Mathematics and probability

Object-Oriented Design

Recursion and Dynamic Programming

scalability and Memory Limits

Sorting and searching

Testing

moderate

hard

C and C++

java

Databases

Threads and Locks

Common Bit Tasks: Get, Set, Clear, and Update Bit

Prime Numbers

Divisibility

Checking for Primality

Probability

A and B

A or B

Independence

Mutual Exclusivity

How to Approach OOD Questions

step1: handle ambiguity ( six Ws: who, what, where, when, how, why)

step 2: Define the core objects

step 3: analyze, relationships

step4: Investigate actions

Design patterns

singleton

factory

How to Approach Recursion

Bottom-Up Recursion

Top-down

start solve to simplest case

think about dividing problem for case in into sub problems with overlap between case

Dynamic Programming problem

click to edit

Recursive vs. Iterative Solutions

The Step-By-Step Approach

Step 1: Make Believe

Step 2: Get Real

Step 3: Solve Problems

: Information, Strategies and Issues

A Typical System

Dividing Up Lots of Data

By Order of Appearance

Hash Value

Actual Value

Arbitrarily

Common Sorting

Bubble Sort \ 0(n2) average and worst case. Memory: 0(1).

Selection Sort \ 0(n2) average and worst case. Memory: 0(1).

Merge Sort \ 0(n Log(n)) average and worst case. Memory: Depends.

Quick Sort | Runtime: 0(n Log (n)) average, 0(n2) worst case. Memory: 0( Log (n) )

Radix Sort Runtime: 0(kn)

Searching

binary search

interviewers want to test the following

Testing a Real World Object

Big Picture Understanding

Knowing How the Pieces Fit Together Organizatio

Organization

Practicality

Step 1: Who will use it? And why

Step 2: What are the use cases?

Step 3: What are the bounds of use?

Step 4: What are the stress/failure conditions?

Step 5: How would you perform the testing?

Testing a Piece of Software

Testing a Function

Troubleshooting Question

SQL Syntax and Variations

Denormalized vs. Normalized Databases

SQL Statements

Small Database Design

Large Database Design