Basic Framework
Updated March 14, 2026 · Interview Modes

BASIC for LeetCode and coding interviews

LeetCode control loop

BASIC is especially effective in coding interviews because coding rounds are where sequence errors are brutally punished.

The candidate who starts fast but chooses the wrong pattern often loses.
The candidate who chooses a viable pattern but never checks edge cases also loses.
The candidate who understands the prompt but cannot make the reasoning visible leaves signal on the table.

BASIC solves all three.

Breakdown: define the real problem before you pick the pattern

Good Breakdown for LeetCode sounds like this:

  • What is the exact deliverable?
  • Do we need the value, the index, the path, or the count?
  • Are there ordering guarantees?
  • What are the edge cases?
  • What examples would expose a wrong invariant?

This step is what prevents “pattern autopilot.”

Assess: compare the baseline and the likely pattern

Pattern selection board

Assess is where the coding round becomes engineering instead of recall.

Ask:

  • What is the brute-force baseline?
  • What operation dominates cost?
  • Which data structure matches the access pattern?
  • What invariant would make this efficient?
  • What is the trade-off of the likely optimal path?

Strong candidates almost always do at least a quick baseline comparison. It gives the interviewer something to score and gives you a correctness anchor.

Structure: state the invariant and the plan

Invariant canvas

Before code, name the shape:

  • sliding window with a validity invariant
  • DFS with a postorder calculation
  • heap maintaining the current top-k
  • graph traversal with visited-state discipline
  • binary search over a monotonic condition

If you can state the invariant, implementation gets dramatically easier.

Implement: build in the order that protects correctness

A simple rule helps:

Write the scaffold first, then the state updates, then the tricky branch.

That order keeps you from painting yourself into a corner.

In practice this often means:

  • initialize state
  • define the main loop or recursion
  • add the update rule
  • wire the branch that restores validity
  • return the correct output shape

Check: dry-run and complexity are not optional

Dry-run canvas

Many coding answers fail here. The code looks plausible, but the candidate stops too early.

Check should include:

  • a small dry run
  • one edge case
  • time complexity
  • space complexity
  • one sentence on what would change if constraints changed

The senior move: ask better edge-case questions

Edge-case matrix

Weak candidates ask whether the code passes the sample.
Strong candidates ask whether the invariant survives unusual input.

Examples:

  • empty input
  • repeated values
  • all values identical
  • already sorted
  • skewed tree
  • disconnected graph
  • duplicate intervals
  • overflow or large counts

The after-code move that changes the feel of the round

Complexity review ladder

After the code works, do not stop at “Time is O(n).”

Go one level deeper:

  • What gave us O(n)?
  • What state makes the update constant-time?
  • What is the trade-off?
  • Could a different constraint force a different solution?

That sounds like someone who understands, not someone who memorized.

The one-sentence version

LeetCode BASIC = define the task, compare the paths, state the invariant, code the plan, dry-run the answer.

That single line is enough to change the quality of most coding-round performances.