Glossary
180 terms from Coding Interviews in C++, in plain words, each with the chapter that teaches it.
#
- #pragma once
- A line at the top of a header file so the compiler pastes it only once, even when it is included several times.
- -DNDEBUG
- A compiler flag that removes every `assert` from the program. If your tests never fail when they should, this flag is probably the cause.
- -O2
- A compiler flag that turns on optimization. With it, C++ does roughly 100 million simple steps per second, a safe planning figure.
- -Wall -Wextra
- Compiler flags that turn on extra warnings about likely mistakes in code. Each warning is worth fixing, since it often points to a real bug.
A
- AI-assisted round
- A coding round where an AI chat assistant is part of the setup, like Dana's Mock 2. You are scored on solving the problem, on understanding every line the AI wrote, and on testing and fixing it.
- API endpoint
- A named address that other programs call, written as a method and a path, such as `GET /orders/{id}/status`. It is how a client asks Kettle & Crane's server for data or sends it new data.
- assert
- A macro from `<cassert>` that does nothing when its condition is true. When the condition is false it prints the file and line and aborts the program, which makes it a quick way to write tests.
- auto
- A C++ keyword that lets the compiler work out a variable's type from its initial value. It is handy with structured bindings such as `auto [gap, first, second] = ...` and for long type names.
B
- Back-of-the-envelope estimate
- A quick, rounded calculation of scale, such as how many requests per second or how much storage a year Kettle & Crane's order tracking needs. Only the order of magnitude matters.
- Backtracking
- A way to list every possible answer by building one choice at a time. You choose an item, explore the rest by recursion, then un-choose it so the next branch starts clean, as in Sam's gift boxes.
- Base case
- The simplest input of a recursive function, answered directly without further recursive calls, such as an empty tree returning 0. It stops the recursion.
- Base salary
- Your fixed yearly pay, before any bonus or equity. In Kettle & Crane's offer it is $120,000.
- Behavioral interview
- A round that asks about your past work, such as Sam's "Tell me about a time…", to predict how you will work with others. Answers are best given in STAR form.
- BFS (breadth-first search)
- A search that explores all cells one step away, then two steps away, and so on, using a queue. It finds the fewest steps between two cells, such as across the warehouse floor.
- Big-O
- A way to describe how a solution's work grows as the input size n grows, ignoring small details. O(n) grows in step with n, while O(n²) grows much faster.
- Binary search
- Finding something in sorted data by repeatedly checking the middle and discarding half. It costs O(log n), and also solves "first day that reaches a goal" questions.
- Bit tricks
- Shortcuts that work directly on the binary digits of numbers, using operations like shifts, AND, OR and XOR. They can solve some problems faster or with less memory than ordinary arithmetic.
- Bonus
- Extra cash on top of base salary, often a target percentage of base. It is not guaranteed, so a 10% target may not be paid in full.
- Bottleneck
- The slowest or costliest part of a solution, such as searching a vector inside a loop. You attack it first when improving a brute-force answer.
- Bottom-up
- Dynamic programming with no recursion: you fill a table from the smallest subproblem upward, so each entry uses answers already in the table. It cannot overflow the call stack.
- Brute force
- The simplest correct solution, which tries every possibility and is usually slow. You say 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 would not think to try by hand.
C
- Cache
- Fast memory that holds recent answers so repeated reads skip the database. The trade-off is that a cached answer can be a little old.
- Call stack
- A fixed block of memory (often 8 MB) where each recursive call takes a slice. Recursion that goes too deep overflows it and crashes with a segmentation fault.
- CDN (content delivery network)
- A set of servers around the world holding copies of images and scripts close to users, so pages load faster.
- Checking in
- Pausing at the end of each step to ask the interviewer a short question such as "Does that approach sound reasonable?". It lets them steer you early.
- Clarifying question
- A question that pins down what the problem means before you solve it, such as whether the input can be empty or have duplicates.
- Client
- The customer's browser or app, which sends requests to a system.
- Cliff
- A waiting period, often one year, before any equity vests. After it, a first chunk (often a quarter) vests at once.
- CoderPad
- A shared online editor often used in phone screens, where you and the interviewer both see the code as you type. Some versions can run code and some cannot.
- Comparator
- A function you pass to a sorting routine to say which of two items goes first, as in the top-customers tie rule (bigger count first, then name).
- Competing offer
- A job offer from another company. You may mention a real one with its numbers when negotiating, but never invent one.
- const reference
- A parameter written like `const std::vector<int>&` that avoids copying the vector and promises not to change it. Passing by value instead gives the function its own copy to modify.
- constexpr
- A C++ keyword marking a value known at compile time, such as the constant `INF` in the bag-packing code.
- Constraints
- The limits a problem states on its input, such as "up to 100,000 items". They tell you which Big-O your solution needs.
- Counteroffer
- Your request for different terms after an offer. Ask for a specific number with a reason such as market data, not just "more".
- CSV (comma-separated values)
- A plain text file with one row per line and fields separated by commas, like Kettle & Crane's `orders.csv`. The C++ standard library has no CSV reader, so simple code breaks on quoted 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 interview 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 piece, or the one the interviewer asks about, in detail.
- DFS (depth-first search)
- A search that follows one path as far as it can before backing up to try another, usually written with recursion. It is used to flood fill a grid, for example marking every cell of one island of shelves as visited.
- Dijkstra's shortest paths
- An algorithm that finds the cheapest route from one node to the others in a weighted graph, always expanding the closest unfinished node next. It works when edge weights are not negative.
- Dry run
- Running your code by hand on a small example while tracking every variable. A trace table keeps the record.
- Dynamic programming (DP)
- Solving a problem by solving each smaller overlapping subproblem once and saving the answer, with a memo or a table. It turns Alex's slow bag-packing recursion into a fast one.
E
- Edge case
- An unusual input at the limits, such as an empty or one-item vector, 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 negatives, sorted, and very large.
- Email worker
- A separate program that takes jobs, such as emails to send, off a message queue and does them. It keeps slow tasks away from the main system.
- Equity
- Part ownership of a company, given as RSUs or stock options and usually earned gradually.
- Exploding offer
- An offer that expires very soon, such as "decide by tomorrow". You can politely ask for a few more days, and most companies agree.
- Exponential time
- Work that doubles with every extra item, as when listing all subsets. It is fine for about 20 items and hopeless for 50.
F
- Fast and slow pointers
- Walking a linked list with two pointers, one moving one node per step and the other two. When the fast one reaches the end, the slow one is at the middle, and if there is a cycle they meet.
- Flood fill
- Starting at one grid cell and spreading to every connected cell of the same kind, like paint. It is used to mark an island.
- Functional / non-functional requirements
- Functional requirements say what a system does, such as customers seeing an order's status. Non-functional ones say how well it does it: speed, uptime, scale and cost.
G
- g++ / clang++
- Compilers that turn C++ source files into programs you can run. For example, `g++ -std=c++20 -Wall -Wextra file.cpp -o file` builds a C++20 program with g++.
- GET and POST
- The two request methods used in the design examples. `GET` reads data, such as an order's status, and `POST` sends new data, such as a status update from the packing station.
- Greedy
- Taking the best-looking choice at each step. It works for only some problems; for bags of 2, 5 and 6 lb it fails to find the fewest bags for 13 lb.
- Grid
- Rows of cells read as `grid[row][col]`, such as the warehouse floor stored as a vector of strings. Many problems hide a graph in one.
H
- Hash map / hash set
- Structures that look up, add or count items in O(1) on average, so "have I seen this?" or "how many of each?" needs no nested loop. In C++ they are `std::unordered_map` and `std::unordered_set`.
- Header file
- A file such as `points.h` holding functions that other .cpp files pull in with `#include`. Putting functions in a header lets the tests share them with `main`.
- Heap
- A structure that always gives you the biggest (max-heap) or smallest (min-heap) item quickly. Keeping a heap of only k items finds the top k in O(n log k).
- Helper function
- A small function that does one messy job and can be tested alone, so the main code reads like the problem.
- High-level design
- A box-and-arrow sketch of a system's main parts and how requests flow between them.
- Hint
- A nudge from the interviewer, such as "What if the vector were sorted?". Hints are normal, and you take one well by saying how it changes your plan.
- Hiring committee
- At some large companies, a group that did not meet you and decides from the interviewers' written feedback.
I
- Idempotency key
- An id sent with a request, such as a reminder's id, so the receiver can recognise a retry and avoid doing the same job twice. It prevents duplicate reminder emails.
- In-bounds check
- Checking that a grid neighbor is on the grid, such as `0 <= r && r < rows`, before reading it. Note that `0 <= r < rows` compiles but means something else.
- INF
- A big constant, such as 1,000,000,000, used in dynamic programming as "worse than any real answer". It is kept smaller than the int maximum so adding 1 does not overflow.
- inline
- A C++ keyword on a function in a header so the definition may appear in several .cpp files without a "multiple definition" error.
- Integer overflow
- When a number goes past what its type can hold, such as an `int` past 2 billion, so it wraps or gives a wrong result. Use `long long` for big totals.
- Interval
- A start and an end, such as Alex's delivery slot (540, 570) for 9:00 to 9:30. Two intervals overlap if one starts before the other ends.
- Island
- A group of connected cells of one kind in a grid, such as a block of shelves in the warehouse.
L
- Lambda
- A small unnamed function written inline, such as the comparator passed to `std::sort`. `[&]` lets it use outer variables by reference.
- Latency
- How long one request takes, measured in milliseconds.
- Leveling
- The job level, such as junior, mid-level or senior, that your interviews show. Expectations for the same problem differ by level.
- Levels.fyi and Glassdoor
- Free sites where people share their pay by company and level, used to research a fair number.
- Linked list
- A chain of nodes where each node points to the next, like Alex's delivery route of stops. It is walked one node at a time, and a last node linking back to an earlier one forms a cycle.
- Load balancer
- A component that spreads requests across several web servers.
- Loop (onsite)
- The set of 2 to 5 rounds, in person or on video, held back to back at the end of the interview process.
M
- Macro
- Code the compiler pastes in by text substitution before compiling. `assert` is a macro, so a bare comma inside it splits its arguments unless you add extra parentheses.
- main
- The function where a C++ program starts. A program has only one, so a test file with its own `main` is a separate program.
- Memo
- A hash map (or vector) that saves each subproblem's answer so it is never solved twice. It turns slow recursion into top-down dynamic programming.
- Merge intervals
- Joining overlapping time slots by sorting by start and then merging a slot into the last one whenever `start <= last_end`. It costs O(n log n).
- Message queue
- A waiting list of jobs, such as "send this email", that a worker handles later, with retries. A slow email service then never slows the packing station.
- Min-heap
- A heap whose top is the smallest item. In C++ it is a `std::priority_queue` with `std::greater<>`, and for top k it holds the k best so far, so the smallest kept is the one to evict.
- Mock interview
- A full practice interview under real conditions: a timer, talking aloud, and ideally a friend as interviewer.
- Monotonic stack
- A stack kept in increasing (or decreasing) order by removing items that break the order as new ones arrive. It is used to answer "next bigger value" questions in O(n).
O
- Off-by-one error
- A bug where a count or range is wrong by exactly one, such as a window's length written `right - left` instead of `right - left + 1`. Trace tables and edge cases catch it.
- Offer
- A company's proposal for your pay and terms, usually given by phone 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 website that checks your code against hidden tests, useful for practicing 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 when dynamic programming pays off.
P
- Palindrome
- A word or code that reads the same backward, such as the coupon code KC5225CK.
- Path
- The partial answer a backtracking function is building. It is passed by reference, so each call grows and shrinks the same vector.
- Pattern
- A solution shape that fits many problems, such as "remember what you've seen in a set". Signal words in a problem, like "first repeated" or "top k", point to the pattern to try.
- Pay range
- The lowest and highest pay a company plans for a role.
- Pay-transparency law
- A law that requires employers to post a pay range in job postings. Several US states, including Washington, California, Colorado and New York, have one.
- Pointer
- A variable holding the memory address of another object. `nullptr` means it points at nothing, and a plain `Node*` only borrows the node rather than owning it.
- Practice log
- A table with one row per problem or mock: date, problem, pattern, time, whether you needed a hint, and one thing to remember.
- Prefix sum
- A vector of running totals where `prefix[i]` is the sum 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).
- Pruning
- Abandoning a backtracking branch as soon as it cannot lead to a valid answer, such as skipping a gift that pushes the box over the $40 budget.
- Pseudocode
- Plain-language steps written as comments before the code. It shows the interviewer your plan and acts as your checklist.
R
- Read replica
- A copy of a database that answers reads, easing the load on the main one.
- README
- A short file that tells a reviewer what the project does, how to build, run and test it, and what decisions you made. It is the first thing a take-home reviewer reads.
- Recruiter screen
- A short, friendly first call with the company's hiring contact about your background, the role and the process. It involves no code.
- Recursion
- A technique where a function calls itself on a smaller version of the problem until it reaches a base case that it can answer directly. It suits trees, backtracking and dynamic programming, but very deep recursion can overflow the call stack.
- Referral
- An employee recommending you, 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, a key number in a back-of-the-envelope estimate.
- Requirements
- The first step of a design round: what the system must do (functional) and how well (non-functional).
- RSU (restricted stock unit)
- A promise of company shares that you receive gradually as they vest. Large companies often use them.
- Rubric
- The interviewer's scoring form, which lists the signals they judge and has a score and notes for each.
S
- Scaling up / out
- Scaling up means a bigger machine, and scaling out means more machines behind a load balancer. Scaling out also removes single points of failure.
- Scorecard
- Your own 1-to-4 score for each of the four signals after a mock, used to choose what to practice next.
- Seed
- A fixed starting number for a random engine, as in `std::mt19937 rng(1)`. It makes every run produce the same random inputs, so a failure can be repeated.
- Segmentation fault
- A crash caused by touching memory the program should not, such as dereferencing a null pointer or recursing too deep.
- Shared editor
- An online editor, such as CoderPad, where the interviewer sees your code as you type it. It often cannot autocomplete.
- Sign-on bonus
- A one-time payment for joining. Some companies ask for it back if you leave within a year, and it is often the easiest part to negotiate.
- Signal
- One quality a rubric scores, meaning the evidence an interviewer collects about you. For coding rounds they are problem solving, coding, communication and testing.
- Signal words
- Words in a problem, such as "top k" or "first repeated", that point to a pattern.
- Signposting
- Announcing your next step before you do it, such as "First I'll write a couple of examples".
- Single point of failure
- A part whose failure takes the whole system down, such as one lone database. Adding a second web server or a standby database removes it.
- size_t and unsigned
- `size()` returns an unsigned type, so `size() - 1` on an empty vector wraps to a huge number. Cast to `int` or check `empty()` first; `std::ssize` gives a signed size.
- Sliding window
- A run of neighboring items between `left` and `right` that moves along the list, keeping a running total by adding the item entering and subtracting the one leaving. It is O(n).
- Sort first
- A pattern where sorting puts related items next to each other, so comparing neighbors answers "closest", "duplicates" or "group together" questions. It costs O(n log n).
- Stack
- A last-in, first-out structure, used for "most recent", undo and matching problems. A vector works as one using `push_back`, `pop_back` and `back()`.
- Stale data
- A cached answer that is a little out of date, such as an order showing "packed" for up to a minute after it shipped.
- Standard library
- The collection of tools that ships with C++, such as `std::vector`, `std::unordered_map` and `std::sort`. Using only it means a program needs nothing extra to install.
- STAR
- A four-part shape for a behavioral answer: Situation, Task, Action, Result. About 60% should be Action, said with "I" and ending with a number.
- static_cast
- A C++ conversion from one type to another, such as turning the unsigned `size()` into an `int` so `size() - 1` can be -1 on an empty vector.
- std::accumulate
- A `<numeric>` function that adds up a range, starting from the value you give. `0LL` makes the total a `long long`.
- std::array
- A fixed-size container, used to return a few values together, such as the gap and the two prices.
- std::function
- A `<functional>` type that holds any function with a given signature, so one `compare` routine can accept either the good or the buggy version.
- std::getline
- Tools for reading text in the take-home. `std::ifstream` opens a file, `getline` reads up to a delimiter such as a newline or comma, `std::istringstream` reads from a string, and `std::stod` turns text into a double.
- std::greater
- A comparison object that, passed to `std::priority_queue`, makes it a min-heap whose `top()` is the smallest item.
- std::lower_bound
- Finds the first position in a sorted vector whose value is not less than a given value, in O(log n).
- std::map and std::set
- Sorted containers. `std::map` keeps keys in order, and `std::set` of pairs is used for visited cells because `std::unordered_set` has no hash for a pair.
- std::mt19937
- The Mersenne Twister random number engine from `<random>`. `std::uniform_int_distribution` turns its raw numbers into whole numbers in a range, ends included, and `std::random_device` gives a different seed each run.
- std::optional
- C++'s "maybe a value": it holds a value or is empty (`std::nullopt`). Test it in an `if` and read it with `*` or `->`.
- std::pair
- A bundle of two values with `.first` and `.second`. Pairs compare by the first member, then the second.
- std::partial_sort
- Puts only the first k items in order at the front of a range and leaves the rest unsorted, using a heap inside. It is O(m log k) and gives top k in C++.
- std::priority_queue
- The C++ heap. By default it is a max-heap with the biggest item on top, and with `std::greater<>` it is a min-heap.
- std::queue
- A first-in, first-out container: `push` adds at the back, `front()` reads the oldest item and `pop()` removes it. It drives BFS.
- std::sort and std::stable_sort
- Standard sorting functions taking an optional comparator. `stable_sort` keeps the original order of ties, and `std::sort` does not promise that.
- std::string_view
- A read-only window onto existing text, so nothing is copied.
- std::tuple
- A fixed bundle of values of different types, such as (product, channel, price). A structured binding unpacks it into named variables.
- std::unique_ptr
- A smart pointer that owns the object it points to and frees it automatically. Tree nodes own their children this way, and a function that only looks takes a `const TreeNode*`.
- std::unordered_map and std::unordered_set
- Hash-based containers with O(1) average lookup. A set answers "seen it?" with `contains`, and `counts[key]` on a map starts a missing key at 0.
- std::vector
- C++'s resizable array, used to hold a list of items in order. It copies by value when assigned or passed without a reference.
- Stock option
- The right to buy company shares later at a fixed price. Startups often give them instead of RSUs.
- Story bank
- About six STAR stories you have written out and practiced aloud, chosen to cover different signals so most questions map onto one.
- Structured binding
- Syntax like `auto [product, channel, price] = order;` that unpacks a pair or tuple into named variables.
- Subproblem
- A smaller version of the same question, such as the fewest bags for 28 lb when asked about 30 lb.
- Subset
- A selection of items from a collection, possibly none. Three items give 2 × 2 × 2 = 8 subsets.
- System design interview
- An open-ended, no-code round where you plan a whole system out loud, scored on structure, scale and trade-offs.
T
- Take-home
- A small project you build alone, usually in 2 to 4 hours, then discuss in a follow-up review.
- Technical phone screen
- An early coding round of about 45 minutes with one engineer in a shared editor.
- Test function
- A function named `test_` plus what it tests, whose asserts check one thing, called from `main`. The first failed assert ends the run.
- Thinking aloud
- Saying what you are doing and why as you do it, so the interviewer can score and steer your reasoning.
- Throughput
- How many requests a system handles per second.
- Timeboxing
- Keeping to the stated time for a task, such as a take-home's 2 hours; going over does not impress.
- TODO comment
- A `// TODO` note in your code marking a fiddly part you are skipping for now, such as handling an empty vector. You say so aloud and return to it once the main idea works.
- Top-down
- Dynamic programming written as recursion plus a memo: check the memo first and store each answer before returning. It follows naturally from the brute force.
- Topological sort
- A way of ordering tasks so that each one comes after the tasks it depends on. It applies to dependency graphs that have no cycles.
- Total compensation (TC)
- All yearly pay added up: base, bonus, equity per year and sign-on bonus. Kettle & Crane's first-year TC is $152,000, dropping to $142,000 after the sign-on bonus ends.
- Trace table
- A table with one row per loop pass and one column per variable, used to track a dry run by hand.
- Trade-off
- What you give up for what you gain, such as a cache making reads fast but possibly stale.
- Trading space for time
- Using extra memory, such as a hash set of what you have seen, to make a solution faster. It turns O(n²) into O(n).
- Tree recursion
- Answering a tree question by returning a base answer for an empty tree, asking each child, and combining their answers with the node's value, as `total` does.
- Trie
- A tree in which each step down follows one letter, so words sharing a prefix share a path. It is used for fast prefix search.
- Two pointers
- Keeping two indexes, `left` at the front and `right` at the back of a sorted vector, and moving one inward each step. It finds pairs in O(n) time and O(1) space.
- Type alias (using)
- A `using` line that gives a long type a shorter name, such as `using Order = std::tuple<std::string, std::string, double>;`.
U
- Undefined behavior
- What C++ allows when code breaks a rule, such as reading past a vector's end. The program may crash or seem to work.
- Union-find
- A structure that tracks which items belong to the same group and can quickly merge two groups. It is used for questions about connected or merging groups.
V
- Vector copy
- A new vector holding the same items, such as `auto copy = path;`. In backtracking you save a copy of the changing path rather than the path itself, or every saved box ends up empty.
- Vesting
- Equity becoming yours gradually, commonly over four years.
- Virtual onsite
- A loop of interview rounds held on video instead of in person.
- Visited set
- A set of cells (or items) already processed, checked before visiting so a search never repeats work or loops forever. For grid cells it can be a `std::set` of row-column pairs.
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 takes requests from clients, such as browsers and apps, runs your code and returns a response.