Glossary
146 terms from Coding Interviews in Rust, in plain words, each with the chapter that teaches it.
#
- #[cfg(test)]
- An attribute meaning "compile this only when testing". It is placed on a test module, where `use super::*;` brings in the functions defined above it.
- #[test]
- An attribute marking a Rust function as a test that `cargo test` runs and reports. Before that, a hand-made function named `test_…` that calls `assert_eq!` does the same job.
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
- A named address that other programs call, written as a method and a path. For example, `GET /orders/{id}/status` reads one order's status at Kettle & Crane.
- as_bytes()
- A `str` method that returns the string's bytes as a slice, so you can read one character by position, which a `str` doesn't allow directly. It suits plain ASCII text, such as grid cells or palindrome checks, where you compare against byte literals like `b'#'`.
- assert_eq!
- A Rust macro that checks two values are equal. If they differ, the program panics and prints both values. `assert!(condition)` does the same for a single true-or-false check.
B
- Back-of-the-envelope estimate
- A quick, rounded calculation of scale, such as requests per second or storage per year. In the order-tracking design it showed that one server and one database are enough.
- Backtracking
- Building every 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 such as Sam's gift boxes.
- Base case
- The simplest input of a recursive function, answered directly without recursing, such as an empty tree or `i == items.len()`. Without it, the 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 Sam's "tell me about a time…" questions, to predict how you will work with others.
- BFS (breadth-first search)
- A search that explores a grid level by level using a queue. It finds the fewest steps between two cells, as in the warehouse floor example.
- Big-O
- A way to describe how a solution's running time or memory use grows with the input size n. It is used to choose a target from the problem's constraints and to state a solution's time and space cost.
- Binary search
- Repeatedly halving a sorted list to find a value or the first position that works, in O(log n). Rust's `binary_search` returns `Ok(index)` or `Err(index)` for where it would go.
- BinaryHeap
- A Rust collection that always gives you its largest item first (a max-heap). Wrapping items in `Reverse` turns it into a min-heap, which is how you keep only the top k items.
- Bonus
- Extra cash, often a target percentage of base salary, paid if you and the company do well. It is not guaranteed.
- Bottleneck
- The part of the brute-force solution that costs the most time. You attack it first in the Better step, for example by replacing a slice `contains` with a `HashSet`.
- Bottom-up
- Dynamic programming with no recursion: you fill a table from the smallest subproblem upward, so each answer uses smaller ones already stored.
- Box
- A Rust pointer type that owns a value on the heap. It lets a tree node own its children, as in `Option<Box<TreeNode>>`.
- Brute force
- The simplest correct solution, which tries every possibility. It is often slow, but stating it first proves you can solve the problem and gives you something to improve.
- Brute-force checker
- A slow, obviously correct function used to test a fast one on many random inputs. It finds bugs in cases you did not think to try.
- BTreeMap
- A Rust map that keeps its keys in sorted order, so a report comes out in name order without a separate sort. Lookups cost O(log n) instead of O(1).
C
- Cache
- Fast memory that keeps recent answers so repeated reads skip the database. The trade-off is that it can serve stale data.
- Cargo
- Rust's build tool, which comes with Rust. `cargo new` creates a project with a `Cargo.toml`, `cargo run` builds and runs it, and `cargo test` runs its tests.
- CDN (Content Delivery Network)
- Servers around the world that keep copies of images and scripts close to users, so pages load faster.
- Checking in
- Pausing at the end of a step to ask the interviewer a short question, such as whether your approach sounds reasonable, before you go on.
- Clarifying question
- A question that pins down what the problem means, such as whether the input can be empty or has duplicates. You ask these before solving.
- Client
- The customer's browser or app, which sends requests to a system.
- Cliff
- A wait, often one year, before any equity vests. After the cliff, a chunk (often a quarter) vests at once.
- Clone
- A method that makes a new `Vec` with the same items. Backtracking saves `path.clone()` because the original `path` keeps changing, and Rust won't let you save the borrow by mistake.
- Closure
- A small unnamed function written inline, such as the `|slot| slot.0` passed to `sort_by_key` or the test passed to `partition_point`.
- CoderPad
- A common shared online editor used in technical phone screens. Some versions can run code and some cannot.
- 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, which is your target Big-O.
- 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.
- Crate
- Rust's name for a library or package of code. A project can use only the standard library, or add crates such as `csv` for file parsing and `rand` for random numbers.
- Cycle
- A linked list whose last node links back to an earlier one, so a plain walk never ends. Fast and slow pointers detect it when they meet.
D
- Daily job
- A small program that runs once a day. In the reminders design it works out each café's next reorder date and queues emails.
- Data model
- The tables a system stores and their main columns, such as `orders` and `order_events` in the tracking design.
- Database
- The building block that stores data permanently, such as orders in tables. A lone database is a single point of failure unless a standby copy exists.
- Debrief
- The meeting after the loop where interviewers share notes and scores and decide whether to hire.
- Deep dive
- The part of a design round where you go into detail on the hardest piece, or the one the interviewer asks about.
- DFS (depth-first search)
- A search that follows one path as deep as it can before backing up, usually written as recursion. It is used for tasks such as flood fill on a grid.
- Dry run
- Running your code by hand on a small example while tracking every variable. A trace table keeps it tidy.
- Dynamic programming (DP)
- Solving each overlapping subproblem once and saving the answer, with a memo or a table. It fixes recursion that repeats work, like the fewest-bags problem.
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 negatives, sorted or reversed, very large.
- entry / or_insert
- A `HashMap` method pair that finds a key's slot, or starts it at a default such as 0. It is the usual way to count items in Rust.
- enumerate
- An iterator method that gives each item together with its index, as in `for (index, number) in ordered.iter().enumerate()`.
- Equity
- Part ownership of a company, given as RSUs or stock options and earned over time through vesting.
- Exploding offer
- An offer that expires very soon, such as "decide by tomorrow". Politely ask for a few more days; most companies agree.
- Exponential time
- Work that doubles with every extra item. It is fine for n up to about 20 (about a million steps) but far too slow for n = 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 in a cycle the fast one laps the slow one.
- Flood fill
- Starting at one cell and spreading, like paint, to every connected cell of the same kind. It is typically done with DFS, for example to count blocks of shelf cells on a warehouse grid.
- Function pointer
- A function's name passed in as a value. The brute-force checker's `compare` takes the fast function this way and calls it on many inputs.
- Functional / non-functional requirements
- Functional requirements say what a system does, like customers seeing an order's status. Non-functional ones say how well, such as speed, uptime, scale and cost.
G
- Greedy
- Taking the best-looking choice at each step. It only works for some problems; for example, always taking the biggest bag fails for 13 lb with bags of 2, 5 and 6.
- Grid
- Rows of cells, read by row then column. Many problems hide a graph in one, such as the warehouse floor where `.` is floor and `#` is a shelf.
H
- Hash map lookup and counting
- Using a `HashSet` to answer "seen it?" or a `HashMap` to count, each in O(1) on average. It has no fixed order, so sort before printing.
- Heap for top k
- Keeping a heap of only k items and dropping the weakest whenever it grows past k. This costs O(n log k), cheaper than sorting everything when k is small.
- Helper function
- A small function that handles one messy part of a solution so the main one reads like the problem, and can be tested alone.
- High-level design
- The main boxes of a system and arrows showing how requests flow between them, such as load balancer, web servers, cache and database.
- Hint
- A nudge from the interviewer. Hints are normal; say how the hint changes your plan, then use it.
- Hiring committee
- A group at some large companies that did not meet you and decides from the interviewers' written feedback.
I
- Idempotency key
- An id, such as the reminder id, passed with a request so that a retry does not repeat the action. It stops an email from being sent twice if a worker crashes and retries.
- In-bounds check
- A test that a grid neighbor lies on the grid before it is read. Using `i32` coordinates lets `row - 1` reach -1 and be caught by the check instead of underflowing as a `usize` would.
- INF (u32::MAX)
- The biggest `u32`, used as a stand-in for "worse than any real answer". It is also the DP result when no mix of bags works.
- Interval
- A range stored as a `(start, end)` tuple, such as Alex's delivery slots in minutes after midnight. Two overlap when the second starts before the first ends.
- Island
- A group of connected cells of one kind in a grid. Flood fill counts them.
L
- Latency
- How long one request takes, measured in milliseconds.
- Leveling
- Which job level (junior, mid-level or senior) your interviews show. The same problem is scored with different expectations at each level.
- Lifetime annotation
- A Rust label like `'a` stating that a returned value borrows from a particular input. For example, it says a function's result borrows from the `online` slice or the `items` slice.
- Linear congruential generator
- A tiny random-number generator that multiplies its state by a large number and adds another constant each step. It is handy because Rust's standard library has no random numbers, and `wrapping_mul` and `wrapping_add` let the values wrap around instead of panicking.
- Linked list
- A chain of nodes where each node links to the next. In Rust it can be built as a `Vec` of nodes linked by index, which also allows loops, since a chain of `Box`es can never loop back on itself.
- Load balancer
- A block that spreads requests across several web servers, which also helps remove single points of failure.
- Loop (onsite)
- The set of 2 to 5 final rounds back to back, in person or on video (virtual onsite). It mixes coding, system design and behavioral rounds.
M
- Memo
- A `HashMap` that saves each subproblem's answer so it is solved only once. Top-down DP checks it first and stores every answer before returning.
- Message queue
- A waiting list of jobs, such as "send this email", that a worker does later. If a service is down, messages wait and the worker retries.
- Mock interview
- A full practice interview under real conditions, with a timer and ideally a friend playing the interviewer.
- Monotonic stack
- A stack kept in sorted (for example increasing) order, used to answer "next bigger value" questions efficiently.
- Mutable borrow (&mut)
- A Rust reference that lets a function change a value it does not own, such as the shared `path` or `memo` passed through recursive calls. You cannot push a `&mut Vec` into a list of `Vec`s without a `clone()`.
O
- 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 site that checks your code against hidden tests, useful for practicing the Code and Test steps.
- Option / None
- Rust's way to say a value may be missing: `Some(value)` when there is an answer and `None` when there is not. Functions return `None` to mean "no answer".
- Overlapping subproblems
- The same smaller question coming up many times, like 28 lb being reached by several routes in the bag problem. It is the signal that DP will help.
P
- Palindrome
- A word or code that reads the same backward, such as the coupon code KC5225CK.
- Panic
- A Rust program stopping at once and printing a message, as a failed `assert_eq!` or a subtract overflow does.
- partition_point
- A slice method that takes a closure true for the left part of a sorted slice and returns the index where it first turns false. It is the library version of "first day that reaches the goal".
- Path
- The partial answer that a backtracking function is building, such as the items currently in a gift box.
- Pattern
- A shape of solution that fits many problems, like "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 the job posting.
- Pay-transparency law
- A law that requires a pay range in job postings.
- 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 running-total list, starting with 0, so any range total is one subtraction: `prefix[end] - prefix[start]`. Setup is O(n) and each question is O(1).
- Pruning
- Abandoning a backtracking branch as soon as it can't lead to a valid answer, such as skipping an item that pushes 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.
R
- Read replica
- A copy of the database that answers reads, taking load off the main database.
- README
- The file a reviewer reads first. It says what a project does, how to run and test it, and what decisions you made.
- Recruiter
- The person who manages hiring for the company: they schedule your rounds, answer process questions and later discuss the offer. The recruiter screen is a short first call with no code.
- Referral
- An employee recommending you for a job, which often gets your application read sooner.
- Refresher
- A new equity grant in a later year, offered at some companies.
- Requests per second
- How many requests a system receives each second. It comes out of a back-of-the-envelope estimate.
- Reverse
- A Rust wrapper that flips the order of a value. It turns the max-heap `BinaryHeap` into a min-heap and lets a tuple sort counts biggest first.
- RSU (restricted stock unit)
- Shares you receive over time as they vest. Large companies often give these as equity.
- Rubric
- The form an interviewer fills in, listing the qualities the company looks for with a score and notes for each. Those qualities are the signals.
- rustc
- The Rust compiler. `rustc -O file.rs` compiles one file with optimizations, `rustc --test` builds its tests, and rustup installs Rust.
S
- saturating_add / saturating_sub
- Rust arithmetic that stops at the type's limit instead of overflowing. The DP code uses `saturating_add(1)` so "infinity plus one" stays infinity.
- 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 score for each of the four signals after a mock interview.
- Seed
- The fixed starting point of a random generator. It makes every run use the same inputs, so a failure can be repeated.
- Shared editor
- An online editor, such as CoderPad, where you and the interviewer both see the code as you type. Some can run code and some can't.
- Sign-on bonus
- A one-time payment for joining. It is often the easiest part to negotiate, and some companies ask for it back if you leave within a year.
- Signal
- One thing a rubric scores. 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
- One part whose failure takes the whole system down, such as a lone database. Scaling out and standby copies remove it.
- Sliding window
- A run of neighboring items from `left` to `right` that moves along a list. You keep a running total, adding what enters and subtracting what leaves, and a variable window grows with `right` and shrinks with `left`.
- sort_by_key
- Rust's way to sort by a chosen field, with a closure picking the key. It is a stable sort (equal items keep their order) and costs O(n log n).
- Stack
- A last-in, first-out list, here a plain `Vec` using `push`, `pop` and `last`. It fits "most recent", "undo" and "matching" problems like Alex's cancelling scans.
- 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 ships.
- STAR
- The four-part shape of a behavioral answer: Situation, Task, Action, Result. Most of the time goes on the Action, and you say "I" and give a number in the Result.
- Stock option
- The right to buy 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 between them answer most behavioral questions.
- Subproblem
- A smaller version of the same question, such as the fewest bags for 28 lb when the order is 30 lb.
- Subset
- A selection of items from a list, possibly none. Three items give 2 × 2 × 2 = 8 subsets.
- System design interview
- An open, no-code round where you plan a whole system out loud, 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, then discuss in a follow-up review. It is judged on running, correctness, clarity, tests and the README.
- Technical phone screen
- An early coding round of about 45 minutes with one engineer, solved in a shared editor.
- Thinking aloud
- Saying what you are doing and why as you work, so the interviewer can follow and score your reasoning and steer you early.
- Throughput
- How many requests the system handles per second.
- Timeboxing
- Keeping to the stated time for a task. Going far over a take-home's limit doesn't impress.
- Top-down
- Dynamic programming written as the original recursion plus a memo, which is checked first and filled before returning.
- Topological sort, union-find, trie, bit tricks
- Four less common algorithm techniques: ordering tasks that depend on each other, tracking groups that merge, a tree of letters for prefix search, and bit-level manipulation tricks.
- Total compensation (TC)
- All yearly pay added up: base, bonus, equity and sign-on. It lets you compare offers, and it can differ between year 1 and later years.
- Trace table
- A table with one row per loop pass and one column per variable, used in a dry run to track your code by hand.
- Trade-off
- What you give up for what you gain with a design choice, such as a cache that makes reads fast but may show data a minute old.
- Trading space for time
- Using extra memory, such as a `HashSet`, to make a solution faster. The missing-ticket set version uses O(n) extra space to get O(n) time.
- 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.
- Tuple
- A fixed group of values in one item, such as `(start, end)` or `(row, col, steps)`. You can unpack it into names or read parts with `.0` and `.1`.
- Two pointers
- Keeping two indexes, `left` and `right`, into one sorted list and moving one inward each step until they meet. It is one O(n) pass with O(1) extra space.
U
- usize / i32 / i64 / u32 / isize
- Rust's whole-number types. `usize` is for indexes and can't go below 0, so a subtraction like `len() - 1` on an empty slice fails with "attempt to subtract with overflow". `i64` is used when sums can pass `i32`'s limit.
V
W
- Walk-away number
- The lowest total compensation you would accept, decided before any call so you know when to say no.
- Web server
- A program that runs your code: it takes a request from a client and returns a response.