Stage 1 · Code
Interview Preparation
Whiteboard Problem Solving
Writing clean code on whiteboard, edge case handling, thinking aloud.
Whiteboard Tips
- Write large, legible — interviewer reads from distance
- Leave space between lines for edits
- Use descriptive names:
left,right,maxSumnotl,r,ms - Write function signature first:
func solve(input []int) int - Draw diagram for data structures (tree, graph, array)
- Box off sections: // Helper, // Main logic, // Tests
Code Structure
Edge Case Handling
| Category | Cases to Check |
|---|---|
| Array/String | Empty, single element, all same, strictly increasing/decreasing |
| Tree/Graph | Null root, single node, skewed, cycles |
| Numbers | Zero, negative, overflow, INT_MIN/INT_MAX |
| DP | Empty input, n=1, n=2, all negative values |
| Two Pointers | Left=right, pointers cross, target not found |
Thinking Aloud
Narrate every decision: 'I'll use sliding window because...', 'This edge case could break...', 'Time complexity is O(n) because...', 'Let me trace through example...'. If stuck: 'I'm considering two approaches...', 'Let me try a simpler version...', 'Can I assume input is sorted?'
Mark this lesson complete to store local progress and unlock a cleaner resume path the next time you visit.