Skip to content

Coding Interviews in Java

Glossary

136 terms from Coding Interviews in Java, in plain words, each with the chapter that teaches it.

A

AI-assisted round
A coding round where an AI chat assistant is part of the setup. You are scored on solving the problem, on understanding the code the AI writes, and on testing and fixing it.
API endpoint
An address that other programs call, written as a method and a path, such as `GET /orders/{id}/status`. At Kettle & Crane it is how a browser asks for an order's status.
ArrayDeque
Java's general-purpose double-ended collection, used through the `Deque` interface as either a stack (`push`, `pop`, `peek`) or a queue (`add`, `poll`). It is preferred over the old, slower `Stack` class.
assert
A Java statement that checks a condition is true and stops with an `AssertionError` if it isn't. Assertions are off by default, so you must run with `java -ea`.

B

Back-of-the-envelope estimate
Quick, rounded arithmetic that shows the scale of a system, such as requests per second or storage per year. Only the order of magnitude matters.
Backtracking
Building every possible answer one choice at a time: choose an item, explore the rest by recursion, then un-choose it so the next branch starts clean. It costs O(2ⁿ), so it suits small inputs.
Base case
The simplest input of a recursive method, answered directly without recursing, such as an empty tree adding 0 or `i == items.length` in backtracking. Without it, recursion never stops.
Base salary
Your fixed yearly pay, before any bonus or equity.
Behavioral interview
A round that asks about your past work, such as 'Tell me about a time…', to predict how you will work with others. At Kettle & Crane, Sam runs it.
BFS (breadth-first search)
A search that uses a queue to visit cells or nodes in order of distance from the start, so the first time it reaches the goal is by the fewest steps. It is used to find the shortest path across a grid, such as a warehouse floor.
Big-O
A way to describe how the work or memory of a solution grows as the input size n grows, such as O(n) or O(n²). It is used to compare approaches and to choose one fast enough for the input limits.
Binary search
Finding a value, or the first position that works, in sorted data by repeatedly checking the middle and discarding half. It costs O(log n).
Bonus
Extra cash on top of base salary, often a target percentage of base. It is not guaranteed.
Bottleneck
The part of a brute-force solution that costs the most time, which you attack first. In the missing-ticket problem it is the `contains` check on a list.
Bottom-up
Dynamic programming with no recursion: you fill a table from the smallest subproblem upward, such as the fewest bags for 0 lb, 1 lb, 2 lb and so on. It avoids stack overflow on large inputs.
Brute force
The simplest correct solution, which tries every possibility and is usually slow. You state it first, with its Big-O, so you have a working answer to improve.
Brute-force checker
A slow but obviously correct function used to test a fast one by comparing both on many random inputs. It finds bugs in cases you didn't think to try.

C

Cache
Fast memory that keeps recent answers so repeated reads skip the database. The trade-off is that the data can be slightly out of date.
Call stack
The memory Java uses to track active method calls. Very deep recursion fills it and throws `StackOverflowError`, which is why bottom-up DP or an explicit stack is safer for huge inputs.
CDN (content delivery network)
Servers around the world that keep copies of images and scripts close to users so pages load faster. Kettle & Crane's product images would be served this way.
Checking in
Pausing at the end of a step to ask the interviewer a short question, such as 'Does that approach sound reasonable?'. It happens after each step, not after every line.
Clarifying question
A question that pins down what a problem means before you solve it, such as whether the input can be empty or what to return when there is no answer.
Client
The customer's browser or app, which sends requests to a system.
Cliff
A waiting period, often one year, before any equity vests; at the first anniversary a quarter vests at once.
CoderPad
A common online shared editor where you and the interviewer both see your code as you type. Some versions can run code and some can't.
Comparator
A Java object or lambda that says which of two items sorts first. It is used to order heap entries, sort slots by start time, or order customers by count and then name.
Competing offer
An offer from another company. Mention a real one with its numbers if asked, and never invent one.
Constraints
The limits stated in a problem, such as 'up to 100,000 items'. They tell you how fast your solution must be.
Counteroffer
Your request for different terms after an offer. Ask for a specific number and give a reason, such as market data or another offer.
CSV (comma-separated values)
A plain-text table where each line is a row and columns are separated by commas. The take-home reads `orders.csv` and splits each line on commas.
Cycle
A linked list whose last node links back to an earlier one, so walking it never ends. Fast and slow pointers detect it because the fast one laps the slow one.

D

Data model
The tables a system stores and their main columns, such as `orders` and `order_events` for order tracking.
Debrief
The meeting after the loop where interviewers share notes and scores and decide whether to hire.
Deep dive
The last step of a design round, where you examine the hardest part, or the one the interviewer picks, in detail and discuss trade-offs.
DFS (depth-first search)
A search that follows one path as far as it can, usually by recursion, before backing up. It is used, for example, to mark every cell of a connected shelf block in a grid.
Dry run
Running your code by hand on a small example while tracking every variable. A trace table keeps the record tidy.
Dynamic programming (DP)
Solving each overlapping subproblem once and saving the answer, either with a memo in recursion (top-down) or with a table (bottom-up). It can find, for example, the fewest bags needed to make up a wholesale order.

E

Edge case
An unusual input at the limits, such as an empty list or a single item, where code most often breaks.
Edge-case checklist
A list to run through after your main example: empty, one item, two items, all the same, duplicates, zero or negative, already sorted, very large.
Equity
Part ownership of a company, usually given as RSUs or stock options.
Exploding offer
A job offer that expires very soon, such as 'decide by tomorrow'. You can politely ask for a few more days.
Exponential time
Work that doubles with every extra item, written O(2ⁿ). It is fine for about 20 items (around a million steps) but far too slow for 50.

F

Fast and slow pointers
Walking a linked list with two references, one moving one node per step and one moving two. When the fast one reaches the end the slow one is at the middle, and if they ever meet the list has a cycle.
Flood fill
Starting at one grid cell and spreading, like paint, to every connected cell of the same kind. It is used to mark or count connected groups, such as shelf blocks on a warehouse floor.
Functional / non-functional requirements
Functional requirements say what a system does (customers see an order's status). Non-functional requirements say how well it does it: speed, uptime, scale and cost.

G

Greedy, topological sort, union-find, trie, bit tricks
Less common algorithm patterns. Greedy takes the best-looking choice at each step (it fails for 13 lb with bags of 2, 5 and 6), topological sort orders tasks that depend on each other, union-find tracks groups that merge, a trie is a tree of letters for prefix search, and bit tricks use binary operations.
Grid
Rows of cells read as `grid[row][col]`. Many problems hide a graph in a grid, like the warehouse floor of `.` and `#` characters.

H

HashMap / HashSet
Java collections for fast lookups: a `HashSet` answers 'have I seen this?' and a `HashMap` stores counts or other values by key, both in O(1) on average. A `HashMap` makes no promise about its printing order.
Heap / PriorityQueue
Java's `PriorityQueue` is a min-heap with the smallest item on top. Keeping a heap of size k and dropping the smallest each time finds the top k in O(n log k).
Helper function
A small method that does one job for the main method, so the main code reads like the problem and the helper can be tested alone.
High-level design
The main boxes of a system and the arrows showing how requests flow between them.
Hint
A nudge from the interviewer, such as 'What if the list were sorted?'. Taking one well counts as communication: say how it changes your plan, then use it.
Hiring committee
A group at some large companies that did not meet you and decides from the written interview feedback.

I

Idempotency key
An id sent with a request, such as the reminder id, so a service can ignore a repeat of the same request. It prevents sending the same email twice after a retry.
In-bounds check
Making sure a neighbor's row and column are on the grid before reading it, for example `r >= 0 && r < rows`.
Integer overflow
What happens when an `int` calculation passes about 2.1 billion and wraps around to a wrong, often negative, number. It can be avoided by using `long` (as in `n * (n + 1) / 2`) or, for an "infinity" value in DP, by using half of `Integer.MAX_VALUE`.
Interval
A range with a start and an end, such as Alex's delivery slot `(540, 570)`. Two intervals overlap when the second starts before the first ends, and sorting by start makes merging them one pass.
Island
A group of connected cells of one kind in a grid, such as a block of shelves.

J

java -ea
The Java option that turns on `assert` checks. Without it, a plain `java File.java` skips every assert and tests silently 'pass'.
javac
The Java compiler, which turns `.java` source files into runnable classes. A single-file program can run with `java File.java`, but when code spans two files you compile both with `javac A.java ATest.java` and then run `java ATest`.
JUnit
The usual Java testing library, whose tests are methods marked `@Test`. It typically needs a build tool such as Maven, so a tiny hand-made checker can replace it when a project must run with plain `java`.

L

Latency / throughput
Latency is how long one request takes. Throughput is how many requests the system handles per second.
Leveling
The company's judgment of which level, junior, mid-level or senior, your interviews show. The same problem is scored with different expectations at each level.
Linked list
A chain of `Node` objects, each holding a value and a reference to the next node (null at the end). Alex's delivery route is a linked list of stops.
LinkedHashMap / TreeMap
Java maps with a predictable order: `LinkedHashMap` remembers insertion order and `TreeMap` keeps its keys sorted. They are useful for stable printing and for a report sorted by name.
List copy
A new list holding the same items, made with `new ArrayList<>(path)`. Backtracking must save a copy, because saving `path` itself saves one list that keeps changing.
Load balancer
A system component that spreads incoming requests across several web servers.
Loop (onsite)
The set of final rounds, 2 to 5 back to back, held in person (onsite) or on video (virtual onsite). It mixes coding, system design and behavioral rounds.

M

Memo
A map that saves each subproblem's answer so it is calculated only once. In top-down DP you check it first and store every answer before returning.
Message queue
A waiting list of jobs, such as 'send this email', that a worker does later, with retries. It keeps a slow email service from slowing the rest of the system.
Mock interview
A full practice interview under real conditions, with a timer and ideally a friend as interviewer.
Monotonic stack
A stack kept in increasing (or decreasing) order, used for "next bigger value" questions. Each new item pops the entries that break the order before it is pushed.

N

NullPointerException
A Java error thrown when you use a reference that is null. In the linked-list code it happens if you read `fast.next` without checking `fast` first.

O

Off-by-one error
A bug where a count or index is wrong by exactly one, such as measuring a window's length as `right - left` instead of `right - left + 1`. A trace table on a small example reveals it.
Offer
A company's proposal for your pay and terms, usually given by phone first and then in writing.
Online assessment
A timed set of coding problems on a website that runs your code against hidden tests and grades it automatically.
Online judge
A practice site that checks your code against hidden tests. It helps with the Code and Test steps.
Overlapping subproblems
The same smaller question coming up again and again, such as the fewest bags for 28 lb being reached by several routes. This is the signal that dynamic programming will help.

P

Palindrome
A word or code that reads the same backward, such as `KC5225CK`. Two pointers checks it from both ends.
Path
The partial answer that a backtracking function is building as it makes choices.
Pattern
A shape of solution that fits many problems, such as 'remember what you've seen in a set'. Signal words in the problem point to it.
Pay range
The lowest and highest pay a company plans for a role. Some laws require it in job postings.
Pay-transparency law
A law requiring employers to include a pay range in job postings.
Practice log
A simple table with a row per problem or mock: date, problem, pattern, time, whether you needed a hint, and one thing to remember.
Prefix sum
An array where `prefix[i]` is the total of the first `i` items, so any range total is one subtraction: `prefix[end] - prefix[start]`. Setup is O(n), then each question is O(1).
printf
A Java method that formats text using codes like `%,d` (thousands commas), `%.2f` (two decimals), `%-12s` (left-aligned) and `%n` (new line).
Pruning
Abandoning a backtracking branch as soon as it can't give a valid answer, such as skipping an item that would push a gift box over budget.
Pseudocode
Plain-language steps written as comments before the real code. It shows the interviewer your plan and becomes your checklist.

Q

Queue
A first-in, first-out collection: you add at the back and `poll` from the front. BFS uses one so the oldest cell is explored first.

R

Random seed
A starting value that makes `new Random(1)` produce the same numbers every run, so a failing random test can be repeated.
Read replica
A copy of the database that serves reads, taking load off the main database.
README
The file a reviewer reads first. It says what a take-home does, how to run and test it, and what decisions you made.
Record
A short Java class for holding data, such as `record Slot(int start, int end)`. Records are immutable, print their field names, and compare by content, so they work as set or map keys.
Recruiter screen
A short first call, usually 20 to 30 minutes, with a recruiter, the person who manages hiring and schedules your rounds. There is no code.
Referral
An employee recommending you for a job, which often gets your application read sooner.
Refresher
A new equity grant given in a later year at some companies.
Requests per second
How many requests a system receives each second. It is a key result of a back-of-the-envelope estimate.
Requirements
What a system must do (functional) and how well (non-functional). It is the first step of the design method.
RSU (restricted stock unit)
A share of company stock you receive gradually as it vests. Large companies often give these.
Rubric
The interviewer's scoring form, listing the qualities (signals) the company looks for, with a score and notes for each.

S

Scaling up / out
Scaling up means a bigger machine; scaling out means more machines behind a load balancer. Scaling out also removes single points of failure.
Scorecard
Your own 1-to-4 scores for each of the four signals after a mock, used to pick what to practice next.
Shared editor
An online editor, such as CoderPad, where you and the interviewer both see the code as you type it.
Sign-on bonus
A one-time payment for joining. Some companies ask for it back if you leave within a year.
Signal
One thing a rubric scores: problem solving, coding, communication or testing. Signals are the evidence an interviewer collects about you.
Signal words
Words in a problem, such as 'top k' or 'first repeated', that point to a pattern.
Signposting
Announcing what you will do next before you do it, such as 'First I'll write a couple of examples.'
Single point of failure
One part whose failure takes the whole system down, such as a lone database.
Sliding window
A run of neighboring items between `left` and `right` that moves along an array, keeping a running total by adding the item that enters and subtracting the one that leaves. A variable window shrinks from the left while over a limit.
Stable sort
A sort that keeps equal items in their original order. Java's `List.sort` for objects is stable (it uses TimSort).
Stack
A last-in, first-out collection used for 'most recent', 'undo' and canceling problems. Alex's scanner cancels repeat scans by comparing each item to the top of a stack.
Stale data
A cached answer that is a little out of date, such as an order showing 'packed' for a minute after it shipped.
STAR
A four-part shape for a behavioral answer: Situation, Task, Action, Result. About 60% of it should be what you did, said with 'I', and the Result should include a number.
Stock option
The right to buy company shares later at a fixed price. Startups often give these instead of RSUs.
Story bank
About six STAR stories, written out and practiced aloud, that cover most behavioral questions.
Subproblem
A smaller version of the same question, such as the fewest bags for 28 lb when the target is 30 lb.
Subset
A selection of items from a list, possibly none. n items have 2ⁿ subsets, such as the 8 possible gift boxes from three products.
System design interview
An open, no-code round where you plan a whole system out loud, such as order tracking for the shop. It is scored on structure, scale reasoning and trade-offs.

T

Take-home
A small project you build on your own time, usually in 2 to 4 hours, and then discuss in a follow-up review. It is judged on running, correctness, clarity, tests and the README.
Target Big-O
The speed your solution must reach, chosen from the input size in the constraints. About 1,000 items allows O(n²), but a million needs O(n log n) or O(n).
Technical phone screen
An early coding round, about 45 minutes, with one engineer in a shared editor.
Test method
A method, named `test` plus what it tests, that groups `assert` lines and checks cases, called from `main`.
Thinking aloud
Saying what you are doing and why as you do it, so the interviewer can follow and score your reasoning.
Timeboxing
Keeping to the stated time for a task, such as a 2-hour take-home. Going far over doesn't impress.
Top-down
Dynamic programming written as recursion plus a memo. It follows naturally from the brute force.
Total compensation (TC)
All yearly pay added up: base, bonus, equity and sign-on bonus. Kettle & Crane's offer is $152,000 in year 1 and $142,000 from year 2.
Trace table
A table with one row per loop pass and one column per variable, used to record a dry run.
Trade-off
What you give up for what you gain, such as a cache making reads fast but letting data be a minute old.
Trading space for time
Using extra memory, such as a set or map, to make a solution faster, so each lookup is O(1).
Tree recursion
Solving a tree question by returning a base answer for an empty tree (`null`), asking each child for its answer, and combining them with the node's value. It costs O(n).
Two pointers
Two indexes, `left` at the front and `right` at the back, moving inward through a sorted array. It finds a pair with a given sum in O(n) time and O(1) space.

V

Vesting
Equity becoming yours gradually, commonly over four years.
Virtual onsite
The loop of final rounds held on video instead of in person.
Visited array
A `boolean` array the same size as a grid that records which cells have been seen, so BFS and DFS never process a cell twice. It starts all `false`.

W

Walk-away number
The lowest total compensation you would accept, decided before any negotiation call so you know when to say no.
Web server
A program that answers requests from clients such as browsers and apps: it takes a request and returns a response.