Практикуйте дискретную математику

Browse lessons

Browse the full catalog by topic and subtopic, or search for a lesson by title and summary.

120 lessons · 605 questions

Logic and Quantifiers

Truth-focused reasoning, quantified statements, and negation.

5 lessons · 20 questions

Argument Forms

1 lessons · 3 questions

Least You Need to Know: Argument Forms

A valid argument form guarantees the conclusion whenever the premises are true. Learn the classic valid forms and the common traps.

Открыть урок

Equivalence Laws

1 lessons · 5 questions

Least You Need to Know: Equivalence Laws

Equivalent statements always have the same truth value. Use standard laws like **De Morgan**, **implication**, and **double negation** to rewrite expressions cleanly.

Открыть урок

Nested Quantifiers

1 lessons · 5 questions

Least You Need to Know: Nested Quantifiers

When a statement has **more than one quantifier**, the order matters. Negating the statement flips each quantifier and negates the predicate.

Открыть урок

Quantifiers

1 lessons · 4 questions

Least You Need to Know: Quantifiers

Quantifiers tell you whether a statement is about **all** objects or about **at least one** object.

Открыть урок

Truth Tables

1 lessons · 3 questions

Least You Need to Know: Truth Tables and Equivalence

Truth tables let you compare two statements **row by row**. Two statements are logically equivalent when they match on **every** row.

Открыть урок

Proof Techniques

Recognize proof patterns and avoid invalid proof steps.

6 lessons · 37 questions

Contradiction And Counterexample

1 lessons · 8 questions

Least You Need to Know: Contradiction and Counterexample

Use a **counterexample** to disprove a universal claim quickly. Use **contradiction** when assuming the opposite of a claim leads to something impossible.

Открыть урок

Contradiction Patterns

1 lessons · 5 questions

Least You Need to Know: Contradiction Patterns

In proof by contradiction, assume the target claim is false and drive the assumption to something impossible, often a parity clash or a definition failure.

Открыть урок

Direct And Contrapositive

1 lessons · 8 questions

Least You Need to Know: Direct Proof and Contrapositive

When a statement has the form **if P, then Q**, you need to choose a proof path that preserves logic instead of guessing from examples.

Открыть урок

Induction Basics

1 lessons · 7 questions

Least You Need to Know: Induction Basics

Mathematical induction proves a statement for **every** integer in a sequence by establishing a base case and an induction step.

Открыть урок

Proof By Cases

1 lessons · 4 questions

Least You Need to Know: Proof by Cases

When a statement splits naturally into a small number of possibilities, prove each case cleanly and make sure the cases cover everything.

Открыть урок

Set Equality

1 lessons · 5 questions

Least You Need to Know: Proving Set Equality

To prove two sets are equal, show **both inclusions** or use a membership argument with `x ∈ A` iff `x ∈ B`.

Открыть урок

Mathematical Induction

Set up induction correctly, use the hypothesis, and complete the inductive step.

4 lessons · 21 questions

Basics

1 lessons · 8 questions

Least You Need to Know: Induction Basics

Mathematical induction proves a statement for every integer in a sequence by checking a starting case and then linking one case to the next.

Открыть урок

Inequalities

1 lessons · 5 questions

Least You Need to Know: Induction for Inequalities

Induction proves inequalities by checking a base case and then comparing the `k+1` expression to something already known from the hypothesis.

Открыть урок

Recurrences

1 lessons · 5 questions

Least You Need to Know: Recurrences and Strong Induction

Recurrence claims often need **strong induction** because the next term depends on several earlier terms, not just one.

Открыть урок

Strong Induction

1 lessons · 3 questions

Least You Need to Know: Strong Induction

Strong induction assumes the claim holds for **all earlier cases up to n** and then proves it for `n + 1`.

Открыть урок

Counting Principles

Multiply, add, and avoid overcounting in basic counting problems.

6 lessons · 38 questions

Inclusion Exclusion

1 lessons · 7 questions

Least You Need to Know: Inclusion-Exclusion

When two counted groups overlap, add the group sizes and then subtract the overlap once.

Открыть урок

Permutations And Combinations

1 lessons · 8 questions

Least You Need to Know: Permutations and Combinations

Use a **permutation** when order matters. Use a **combination** when order does not matter.

Открыть урок

Pigeonhole Principle

1 lessons · 3 questions

Least You Need to Know: The Pigeonhole Principle

If you place more objects than boxes into the boxes, at least one box must contain more than one object. Use the ceiling idea for stronger versions.

Открыть урок

Product And Sum Rules

1 lessons · 8 questions

Least You Need to Know: Product Rule and Sum Rule

Many counting errors come from not noticing whether choices happen **in sequence** or belong to **separate non-overlapping cases**.

Открыть урок

Restricted Arrangements

1 lessons · 8 questions

Least You Need to Know: Restricted Arrangements

Harder counting problems often become easier once you decide whether order matters, whether items repeat, and whether a restriction should be handled first or by subtraction.

Открыть урок

Stars And Bars

1 lessons · 4 questions

Least You Need to Know: Stars and Bars

Stars and bars counts ways to distribute identical objects into distinct boxes by turning the problem into positions for separators.

Открыть урок

Relations and Functions

Relation properties, function rules, and inverse-style reasoning.

12 lessons · 56 questions

Databases And State

1 lessons · 5 questions

Least You Need to Know: Relations in Databases and State Machines

Relations are not only abstract sets of ordered pairs. They appear in foreign-key links, join tables, dependency graphs, and state-transition systems used all over software engineering.

Открыть урок

Equivalence Relations

1 lessons · 3 questions

Least You Need to Know: Equivalence Relations

An equivalence relation groups objects into classes using three properties: reflexive, symmetric, and transitive.

Открыть урок

Function Composition Inverse

1 lessons · 5 questions

Least You Need to Know: Composition and Inverses

Function composition means applying one function and then another. A function has an inverse only when each output comes from exactly one input.

Открыть урок

Function Types

1 lessons · 4 questions

Least You Need to Know: Injective, Surjective, and Bijective Functions

A function can fail by hitting two inputs with the same output, by missing outputs in the codomain, or by doing both.

Открыть урок

Functions

1 lessons · 5 questions

Least You Need to Know: Functions

A function gives **exactly one output** for each input in its domain. The key is checking repeated inputs carefully.

Открыть урок

Partial Orders

1 lessons · 4 questions

Least You Need to Know: Partial Orders

A partial order is reflexive, antisymmetric, and transitive. Unlike equivalence relations, not every pair must be comparable.

Открыть урок

Poset Extrema

1 lessons · 5 questions

Least You Need to Know: Minimal, Maximal, Least, and Greatest

In a poset, **least** and **greatest** are stronger than **minimal** and **maximal**. Least means below everything; minimal only means nothing is strictly below it.

Открыть урок

Relation Properties

1 lessons · 5 questions

Least You Need to Know: Relation Properties

A relation can be **reflexive**, **symmetric**, **antisymmetric**, or **transitive**. The skill is recognizing what each word really asks you to check.

Открыть урок

Sql Aggregation Nulls

1 lessons · 5 questions

Least You Need to Know: GROUP BY, Aggregation, and NULL Semantics

Aggregation questions are about partitioning rows into groups, then summarizing each group carefully. The common traps are filtering at the wrong stage, forgetting how `NULL` behaves, and accidentally duplicating rows before aggregating.

Открыть урок

Sql Indexing Cardinality

1 lessons · 5 questions

Least You Need to Know: Indexes, Selectivity, and Cardinality Intuition

Index and query-plan interview questions are mostly about search-space pruning. Good indexes cut down candidate rows quickly; bad selectivity, tiny tables, or the wrong leading columns can erase that advantage.

Открыть урок

Sql Join Reasoning

1 lessons · 5 questions

Least You Need to Know: SQL Joins as Relation Operations

SQL joins are concrete relation operations. Interview questions about joins usually reduce to three ideas: which rows survive, when rows duplicate, and when missing matches turn into `NULL` values.

Открыть урок

Sql Keys Constraints

1 lessons · 5 questions

Least You Need to Know: Keys, Functional Dependencies, and Constraints

Database design questions are relation questions wearing engineering clothes. Keys identify tuples, foreign keys connect relations, and functional dependencies explain when one set of attributes determines another.

Открыть урок

Graphs and Trees

Read graph structure, degree facts, paths, and tree basics.

5 lessons · 23 questions

Basic Graphs

1 lessons · 5 questions

Least You Need to Know: Basic Graphs

Graphs model objects as **vertices** and connections as **edges**. Most beginner mistakes come from miscounting degree or confusing paths with edges.

Открыть урок

Bipartite Graphs

1 lessons · 5 questions

Least You Need to Know: Bipartite Graphs

A graph is bipartite when its vertices can be split into two groups so every edge goes across the split. Odd cycles are the main obstruction.

Открыть урок

Euler Trails

1 lessons · 3 questions

Least You Need to Know: Euler Trails and Cycles

Euler questions ask whether you can use every edge exactly once. The degree pattern tells you the answer quickly.

Открыть урок

Rooted Trees

1 lessons · 5 questions

Least You Need to Know: Rooted Trees

A rooted tree picks one vertex as the root, which gives every other vertex a parent-child relationship and a level.

Открыть урок

Trees

1 lessons · 5 questions

Least You Need to Know: Trees

A tree is a connected graph with **no cycles**. In a tree with n vertices, the number of edges is always n-1.

Открыть урок

Algorithmic Thinking and Complexity

Big-O, loop analysis, graph algorithms, invariants, and developer-focused discrete math.

82 lessons · 410 questions

Answer Space Binary Search

1 lessons · 5 questions

Least You Need to Know: Binary Search on Answers and Monotone Predicates

Sometimes you do not binary-search an array index at all. Instead you binary-search an **answer space** such as a capacity, time limit, or threshold, using a feasibility check that flips from false to true exactly once.

Открыть урок

Asymptotic Analysis

1 lessons · 5 questions

Least You Need to Know: Big-O, Theta, and Omega

Asymptotic notation compares growth rates. **Big-O** gives an eventual upper bound, **Omega** gives a lower bound, and **Theta** means the growth is tightly sandwiched between both.

Открыть урок

Asymptotic Scenarios

1 lessons · 5 questions

Least You Need to Know: Mixed Big-O Scenarios

Mixed runtime questions combine scans, sorts, hash-table operations, and nested loops. Write each phase separately, then simplify to the dominant term.

Открыть урок

Backtracking State Space

1 lessons · 5 questions

Least You Need to Know: Backtracking as Search Over Partial Choices

Backtracking explores a **state space of partial decisions**. The key idea is to build a candidate step by step, detect impossible or completed states early, and undo choices cleanly when a branch cannot lead to a valid answer.

Открыть урок

Bfs Shortest Path

1 lessons · 5 questions

Least You Need to Know: BFS Layers, Unweighted Shortest Paths, and Multi-Source Search

Breadth-first search works on **unweighted** graphs because it explores states in layers of equal edge distance. That layer structure is the interview reason BFS gives shortest-path lengths when every move costs the same.

Открыть урок

Binary Lifting

1 lessons · 5 questions

Least You Need to Know: Binary Lifting, Power-of-Two Jumps, and Ancestor Queries

Binary lifting preprocesses jump pointers so ancestor movement can be decomposed into **powers of two**. The main trick is the same as binary representation: any jump length can be written as a sum of power-of-two jumps.

Открыть урок

Binary Search Invariants

1 lessons · 5 questions

Least You Need to Know: Binary Search Invariants and Boundary Updates

Binary search works because the search interval maintains an **invariant**: the desired answer is still inside the remaining range. Each comparison must eliminate only the half that is provably impossible, and the boundary update must match the exact question being asked.

Открыть урок

Bipartite Matching Depth

1 lessons · 5 questions

Least You Need to Know: Bipartite Matching, Augmenting Paths, and Assignment Structure

Bipartite matching pairs vertices from two sides without reuse. The central progress idea is an **augmenting path**: alternating matched and unmatched edges that increases the matching size by one.

Открыть урок

Bit Count Power

1 lessons · 5 questions

Least You Need to Know: Set Bits, Powers of Two, and Lowest-Bit Tricks

Many classic bit problems rely on what happens to the **lowest set bit**. That viewpoint explains power-of-two checks, efficient bit counting, and several constant-time transformations that show up repeatedly in interviews.

Открыть урок

Bit Mixed Interview

1 lessons · 5 questions

Least You Need to Know: Bit Reasoning Depth and Mixed Interview Drills

This tranche pushes bit reasoning one step further, then mixes it with asymptotics, graphs, and invariants the way interview questions often do.

Открыть урок

Bitmask Set

1 lessons · 5 questions

Least You Need to Know: Bitmasks as Sets, Flags, and Small-State Compression

A bitmask can represent membership in a small universe using one integer. This lets interviews compress sets, feature flags, visited states, and eligibility rules into fast bitwise operations.

Открыть урок

Bitwise Logic

1 lessons · 5 questions

Least You Need to Know: AND, OR, XOR, and Single-Bit Updates

Bitwise operators treat integers as compact boolean vectors. Interview problems use this to test parity, flip flags, cancel duplicates with XOR, and update one bit at a time in constant space.

Открыть урок

Boolean And Bits

1 lessons · 5 questions

Least You Need to Know: Boolean Algebra and Bit Reasoning

Developers constantly reason about boolean conditions, feature flags, masks, and low-level binary properties. Discrete math logic becomes practical when you simplify conditions and interpret bitwise operations correctly.

Открыть урок

Bridges Articulation

1 lessons · 5 questions

Least You Need to Know: Bridges, Articulation Points, and Fragile Connectivity

Bridges and articulation points identify where an undirected graph is **fragile**. A bridge is an edge whose removal disconnects the graph; an articulation point is a vertex whose removal does the same.

Открыть урок

Bst Invariants

1 lessons · 5 questions

Least You Need to Know: BST Invariants, Search Ranges, and Inorder Structure

Binary-search-tree reasoning is about **global range constraints**, not just comparing a node to its direct children. Inorder traversal is sorted precisely because every left subtree stays below the node and every right subtree stays above it.

Открыть урок

Condensation Dag

1 lessons · 5 questions

Least You Need to Know: Condensation DAGs and Component-Level Ordering

If each SCC is contracted to one node, the resulting graph is a **DAG**. This condensation DAG captures the one-way flow between strongly connected regions and is often the right object for topological reasoning after SCC decomposition.

Открыть урок

Coordinate Compression

1 lessons · 5 questions

Least You Need to Know: Coordinate Compression, Order Preservation, and Dense Indexing

Coordinate compression replaces sparse or huge values with a dense rank order while preserving **relative order comparisons**. It is a preprocessing bridge between messy input values and array-based data structures.

Открыть урок

Dags And Paths

1 lessons · 5 questions

Least You Need to Know: Topological Order, DAGs, and Path Intuition

A **topological order** lists the vertices of a directed acyclic graph so every edge points forward in the list. DAG thinking shows up in build systems, prerequisite planning, dependency graphs, and many workflow pipelines.

Открыть урок

Deque Design Tradeoffs

1 lessons · 5 questions

Least You Need to Know: Deques, Front/Back Operations, and Design Tradeoffs

A deque supports insertion and removal at both ends, so it can imitate either a stack or a queue and can also handle patterns that need both. Interview questions use deques when a single-end structure would be too restrictive.

Открыть урок

Difference Arrays

1 lessons · 5 questions

Least You Need to Know: Difference Arrays, Boundary Marking, and Range Updates

Difference arrays invert the prefix-sum idea: instead of storing cumulative totals directly, they store **where changes begin and end**. After marking update boundaries, one prefix sweep reconstructs the final values.

Открыть урок

Dp Memo Vs Tabulation

1 lessons · 5 questions

Least You Need to Know: Memoization vs Tabulation

Memoization and tabulation solve the same recurrence in different directions. Interview questions often ask when one is simpler, when one avoids wasted work, and how iteration order reflects dependencies.

Открыть урок

Dp Mixed Interview

1 lessons · 5 questions

Least You Need to Know: Dynamic Programming Mixed Interview Drills

Interview DP questions rarely ask only for a recurrence. They mix state design, dependency order, asymptotics, and correctness traps like double counting or forgetting part of the state.

Открыть урок

Dp State Design

1 lessons · 5 questions

Least You Need to Know: Dynamic Programming State Design

Dynamic programming starts by choosing a state that remembers exactly the information a smaller subproblem needs. Good state design is usually the difference between a clean recurrence and a confused one.

Открыть урок

Dp Subproblem Graph

1 lessons · 5 questions

Least You Need to Know: DP as a Subproblem Graph

A recurrence defines a directed graph of dependencies between states. Thinking of DP as a DAG clarifies overlapping subproblems, iteration order, and why cycles are a warning sign.

Открыть урок

Euler Tour Subtree Ranges

1 lessons · 5 questions

Least You Need to Know: Euler Tours, Subtree Intervals, and Flattened Trees

An Euler-tour-style entry order can flatten a rooted tree so each subtree becomes a **contiguous interval** in an array. That converts many subtree problems into familiar range-query problems.

Открыть урок

Fast Slow Pointers

1 lessons · 5 questions

Least You Need to Know: Fast/Slow Pointers, Middle Nodes, and Cycle Entry

Fast and slow pointers turn repeated traversal into relative-motion reasoning. The same idea explains finding middle nodes, detecting linked-list cycles, and locating the entry point after a cycle is found.

Открыть урок

Fenwick Tree Point Update

1 lessons · 5 questions

Least You Need to Know: Fenwick Point Updates, Frequencies, and Order Statistics

Point updates in a Fenwick tree climb upward through the indices whose stored partial sums include the changed position. This makes the structure especially useful for dynamic frequency tables and coordinate-compressed counting problems.

Открыть урок

Fenwick Tree Prefix Sum

1 lessons · 5 questions

Least You Need to Know: Fenwick Trees, Prefix Sums, and Low-Bit Jumps

Fenwick trees support prefix-sum queries and point updates in `O(log n)` by storing carefully chosen partial sums. The key bit trick is the low bit, which tells how large a range each index is responsible for.

Открыть урок

Graph Cycle Detection

1 lessons · 5 questions

Least You Need to Know: Cycle Detection in Directed and Undirected Graphs

Cycle detection depends on graph type. In undirected graphs, you must ignore the edge back to the parent. In directed graphs, the key signal is whether DFS re-enters a node that is still on the current recursion path.

Открыть урок

Graph Modeling State Space

1 lessons · 5 questions

Least You Need to Know: Modeling Interview Problems as Graph Search

Many interview problems become easier once you name the **state** and the **moves**. When states become vertices and legal moves become edges, familiar tools like BFS and DFS suddenly apply.

Открыть урок

Graph Traversal

1 lessons · 5 questions

Least You Need to Know: BFS, DFS, and Connected Components

**Breadth-first search** explores layer by layer, while **depth-first search** follows one path deeply before backtracking. Both are core graph tools, and both can be used to discover reachability and connected components.

Открыть урок

Greedy Exchange Arguments

1 lessons · 5 questions

Least You Need to Know: Greedy Choice, Exchange Arguments, and Local Decisions

Greedy algorithms succeed when a **locally optimal step** can be justified as part of some globally optimal solution. Exchange arguments and staying-ahead arguments explain why taking a certain next move never makes the final answer worse.

Открыть урок

Grid Graph Traversal

1 lessons · 5 questions

Least You Need to Know: Grid Traversal, Flood Fill, and Boundary Checks

Many interview grid problems are just implicit graph traversal: each cell is a node, legal moves define edges, and BFS or DFS visits connected components or shortest paths. The main implementation risk is careful neighbor and boundary handling.

Открыть урок

Heap Frontier Top K

1 lessons · 5 questions

Least You Need to Know: K-Way Merge, Top-K, and Heap Frontier Ideas

Heaps are useful when many sorted or partially ordered sources expose only a few promising next candidates. The heap stores the current **frontier** so you can pop the next best item without materializing every unseen option.

Открыть урок

Heap Invariants

1 lessons · 5 questions

Least You Need to Know: Heaps, Heap Invariants, and Fast Extremes

A heap stores items so the **root is always the minimum or maximum** according to a priority rule. It does not fully sort everything, but it lets you update the frontier quickly when you repeatedly need the next best element.

Открыть урок

Interval Overlap Meeting Rooms

1 lessons · 5 questions

Least You Need to Know: Interval Overlap, Meeting Rooms, and End-Time Heaps

Some interval problems are not about choosing one compatible subset. Instead they ask for the **maximum number of overlapping intervals** at any moment, or equivalently the minimum number of rooms needed to host them all. A min-heap of end times tracks how many intervals are active right now.

Открыть урок

Interval Scheduling Greedy

1 lessons · 5 questions

Least You Need to Know: Interval Scheduling and Earliest-Finish Greedy

For maximizing how many non-overlapping intervals you can keep, the standard greedy rule is to sort by **earliest finishing time** and repeatedly accept the next compatible interval. The reason is that earlier finishes preserve more room for future choices.

Открыть урок

Invariants And Structures

1 lessons · 5 questions

Least You Need to Know: Invariants and Structural Induction

Loop invariants explain why iterative algorithms stay correct after every update. Structural induction is the matching proof idea for recursive data structures such as lists and trees.

Открыть урок

Lca

1 lessons · 5 questions

Least You Need to Know: Lowest Common Ancestors and Path Intersections

The lowest common ancestor of two nodes is the **deepest node lying on both root-to-node paths**. LCA problems become easy once you think in terms of path overlap rather than arbitrary tree geometry.

Открыть урок

Linked List Dummy Nodes

1 lessons · 5 questions

Least You Need to Know: Dummy Nodes, Head Cases, and Stable Stitching

A dummy node is a fake node placed before the real head so that insertion and deletion at the front look like ordinary middle-of-list operations. Interviews love dummy nodes because they remove special-case branching and make stitched-together outputs easier to reason about.

Открыть урок

Linked List Pointer Updates

1 lessons · 5 questions

Least You Need to Know: Linked-List Pointer Updates and Local Rewiring

Linked-list problems are about **preserving access while changing arrows**. Because each node only knows its next pointer, interviews reward students who save the next node before rewiring and who reason locally about what each pointer update does to the rest of the list.

Открыть урок

Linked List Reversal

1 lessons · 5 questions

Least You Need to Know: Reversing a Linked List with Prev, Current, and Next

Linked-list reversal is the interview archetype for pointer discipline: keep track of what was before, what you are on, and what comes next. The core invariant is that one prefix has already been reversed while the remaining suffix is still untouched.

Открыть урок

Linked List Sorted Merge

1 lessons · 5 questions

Least You Need to Know: Merging Sorted Lists and Splicing Runs

Sorted linked-list merge is a classic interview pattern because the lists are already ordered, so you can advance exactly one front pointer at a time. The algorithm is linear in the total number of nodes and is often implemented cleanly with a dummy head.

Открыть урок

Loop Analysis

1 lessons · 5 questions

Least You Need to Know: Analyzing Loops and Nested Loops

For loop analysis, count how many times the body executes and multiply by the work per execution. Nested loops often multiply counts, while doubling or halving patterns often lead to logarithms.

Открыть урок

Modular Arithmetic

1 lessons · 5 questions

Least You Need to Know: Modular Arithmetic, Divisibility, and Hashing Intuition

Modular arithmetic tracks remainders. That matters in parity, clock arithmetic, hashing buckets, wrap-around indexing, and many programming tasks involving periodic behavior.

Открыть урок

Modular Hashing Depth

1 lessons · 5 questions

Least You Need to Know: Modular Arithmetic and Hashing Depth

Deeper modular reasoning shows up when you compare residue classes, predict collisions, combine congruences, and reason about how bucket counts interact with patterned inputs.

Открыть урок

Monotonic Deque Prefix Sum

1 lessons · 5 questions

Least You Need to Know: Monotonic Deques, Prefix Sums, and Shortest Valid Windows

Some subarray problems use prefix sums plus a monotonic deque over prefix indices. The deque keeps promising earlier prefixes in increasing order so the current prefix can quickly detect the shortest earlier start that already makes the sum large enough.

Открыть урок

Monotonic Queue Sliding Window

1 lessons · 5 questions

Least You Need to Know: Monotonic Queues and Sliding-Window Extremes

A monotonic deque keeps the current window's best candidates in order, so the front always holds the maximum or minimum. It is the standard pattern for sliding-window extrema because it supports both expiration from the left and dominance cleanup from the right.

Открыть урок

Monotonic Stack Boundaries

1 lessons · 5 questions

Least You Need to Know: Monotonic Stacks for Range Boundaries and Histogram Areas

Monotonic stacks do more than next-greater queries: they also expose the nearest smaller or larger boundary on each side. That boundary view powers classic problems like largest rectangle in a histogram and contribution counting.

Открыть урок

Monotonic Stack Next Greater

1 lessons · 5 questions

Least You Need to Know: Monotonic Stacks and Next-Greater Patterns

A monotonic stack keeps elements in sorted stack order so that a new value can resolve many waiting positions at once. This turns repeated scanning into a single left-to-right pass for next-greater and waiting-time style problems.

Открыть урок

Offline Sorting Sweep

1 lessons · 5 questions

Least You Need to Know: Offline Sorting, Event Sweeps, and Ordered Processing

Offline processing sorts updates, queries, or events by a key so work can be done in one monotone sweep. The key insight is to answer many questions by **maintaining a moving frontier** rather than restarting from scratch for each query.

Открыть урок

Palindrome Manacher Lite

1 lessons · 5 questions

Least You Need to Know: Palindrome Centers, Symmetry, and Manacher-Lite Intuition

Palindrome reasoning starts from centers and symmetry. Manacher's algorithm pushes that idea further by reusing information from the current rightmost palindrome to compute all palindrome radii in linear time.

Открыть урок

Partitioning Dutch Flag

1 lessons · 5 questions

Least You Need to Know: Partitioning Invariants and Dutch-Flag Regions

Partition algorithms maintain region invariants while scanning an unknown middle segment. This is the interview core behind quickselect-style partitioning, Dutch-flag sorting, and in-place grouping by a pivot or category.

Открыть урок

Permutations Constraints Search

1 lessons · 5 questions

Least You Need to Know: Permutations, Used Sets, and Constraint Propagation

Permutation search cares about **order**, so each recursive level chooses the next position from items not yet used. Constraint checks can often be applied to the growing prefix to reject bad permutations early.

Открыть урок

Prefix Function Kmp

1 lessons · 5 questions

Least You Need to Know: Prefix Function, Borders, and KMP Intuition

The **prefix function** tracks how much of a pattern already matches itself. That self-overlap information is what lets KMP avoid restarting from scratch after mismatches in pattern matching problems.

Открыть урок

Prefix Sums

1 lessons · 5 questions

Least You Need to Know: Prefix Sums, Range Aggregates, and Subtracting History

Prefix sums precompute cumulative totals so a range sum becomes **one subtraction of two histories**. This is one of the highest-leverage preprocessing tricks in algorithmic problem solving.

Открыть урок

Priority Queue Patterns

1 lessons · 5 questions

Least You Need to Know: Priority Queues, Scheduling, and Lazy Updates

A priority queue turns a heap into an algorithmic tool: keep many candidates, then repeatedly extract the **currently best** one. This pattern appears in scheduling, event simulation, shortest-path style relaxations, and systems that reinsert improved priorities over time.

Открыть урок

Queue Fifo Bfs Simulation

1 lessons · 5 questions

Least You Need to Know: Queues, FIFO Order, and Level-by-Level Simulation

Queues model situations where the earliest discovered or earliest arrived item should be processed first. That makes queues the natural frontier structure for breadth-first search and many step-by-step simulations.

Открыть урок

Recurrence Analysis

1 lessons · 5 questions

Least You Need to Know: Recursion Trees and Recurrence Intuition

Recurrences describe recursive runtime by combining the cost of smaller subproblems with the non-recursive work done at each step. Recursion trees help you see branching, depth, and total work level by level.

Открыть урок

Recurrence Patterns

1 lessons · 5 questions

Least You Need to Know: Recurrence Patterns for Interviews

Interview-style recurrence questions usually reduce to a few recognizable patterns. Ask whether the size shrinks by division or subtraction, how many branches appear, and what each level costs.

Открыть урок

Recursion Tree Pruning

1 lessons · 5 questions

Least You Need to Know: Recursion Trees, Feasibility Checks, and Pruning

A recursion tree shows the search branches a backtracking algorithm may explore. **Pruning** means cutting off branches as soon as a partial state can no longer lead to a valid or useful solution.

Открыть урок

Rolling Hash Substrings

1 lessons · 5 questions

Least You Need to Know: Rolling Hashes and Substring Fingerprints

A **rolling hash** gives a compact fingerprint for a substring so adjacent windows can be compared or updated quickly. Interview prompts use it for repeated-substring checks, duplicate-window detection, and fast candidate comparison.

Открыть урок

Scc

1 lessons · 5 questions

Least You Need to Know: Strongly Connected Components and Mutual Reachability

A strongly connected component in a directed graph is a maximal set of vertices that can all reach one another. SCCs reveal the graph's cyclic cores and compress repeated mutual-reachability structure into components.

Открыть урок

Segment Tree Lazy Propagation

1 lessons · 5 questions

Least You Need to Know: Lazy Propagation for Range Updates and Range Queries

Lazy propagation lets a segment tree postpone pushing range updates into children until that detail is actually needed. The main idea is to keep a pending tag that says, in effect, 'this whole interval has already been updated even if the children are not individually refreshed yet.'

Открыть урок

Segment Tree Range Query

1 lessons · 5 questions

Least You Need to Know: Segment Trees, Range Queries, and Overlap Cases

Segment trees recursively partition an array into intervals so that range aggregates can be answered in `O(log n)` by combining a small number of stored interval results. The key interview idea is to reason about **no overlap**, **partial overlap**, and **complete overlap**.

Открыть урок

Sliding Window Strings

1 lessons · 5 questions

Least You Need to Know: Two Pointers, Sliding Windows, and String Scans

Many interview string problems are not about deep string theory. They are about keeping a **contiguous window** consistent while scanning left to right. The key question is what summary of the current window lets you expand, shrink, and answer the prompt in overall linear time.

Открыть урок

Sparse Table Rmq

1 lessons · 5 questions

Least You Need to Know: Sparse Tables, RMQ, and Static Idempotent Queries

Sparse tables preprocess answers for intervals of length power of two. They shine on **static arrays** and especially on idempotent operations like minimum, where overlapping power-of-two blocks can answer a query in `O(1)`.

Открыть урок

Stack Balanced Delimiters

1 lessons · 5 questions

Least You Need to Know: Stacks, Balanced Delimiters, and Most-Recent Openings

Balanced-parentheses problems are stack problems because each closing bracket must match the **most recent unmatched opening**. That last-opened, first-closed behavior is exactly LIFO order.

Открыть урок

Stack Expression Evaluation

1 lessons · 5 questions

Least You Need to Know: Stacks, Postfix Evaluation, and Expression State

Stacks evaluate postfix expressions because operands arrive before the operator that combines them. When the operator appears, the most recent operands are popped, combined, and the result is pushed back for later use.

Открыть урок

Subset Enumeration Bitmask

1 lessons · 5 questions

Least You Need to Know: Bitmask Subset Enumeration and Used-Set State

Enumerating masks from `0` to `2^n - 1` gives every subset of an `n`-element set. Interviews use this for subset generation, used-element state, and small-state dynamic programming where each bit records a chosen item.

Открыть урок

Subsets Combinations Search

1 lessons · 5 questions

Least You Need to Know: Subsets, Combinations, and Choose/Skip Search

Subset and combination search usually depends on a **choose/skip** structure. The important distinction is that order does not matter, so the recursion should move forward through candidates instead of revisiting earlier positions.

Открыть урок

Suffix Ordering

1 lessons · 5 questions

Least You Need to Know: Suffix Ordering, Lexicographic Structure, and LCP Intuition

Suffix-based reasoning sorts all suffixes of a string lexicographically. Even without implementing a full suffix array from scratch, it helps to know how lexicographic suffix order exposes repeated-substring structure and longest-common-prefix reasoning.

Открыть урок

Topological Sort Dag

1 lessons · 5 questions

Least You Need to Know: Topological Sort, DAG Dependencies, and Prerequisite Order

Topological sorting gives an order that respects directed dependencies: every edge points from something that must come earlier to something that may come later. It only works when the graph is a **DAG**.

Открыть урок

Tree Dp Rerooting

1 lessons · 5 questions

Least You Need to Know: Tree DP, Child-State Combination, and Rerooting Intuition

Tree dynamic programming works because each node can summarize its subtree from its children. Rerooting extends that idea by reusing previously computed information when the root perspective shifts from one node to another.

Открыть урок

Tree Height Balance

1 lessons · 5 questions

Least You Need to Know: Tree Height, Balance, and Diameter Intuition

Bottom-up tree questions ask each subtree to return a small summary such as its height, whether it is balanced, or the best path seen so far. The key interview move is to decide what summary the parent needs from each child.

Открыть урок

Tree Traversal Recursion

1 lessons · 5 questions

Least You Need to Know: Tree Traversals and Recursive Calls

Tree interview questions often hinge on **when** work happens relative to the recursive calls. Preorder acts before the children, inorder acts between them, and postorder acts after the children return.

Открыть урок

Trie Hash Kmp Tradeoffs

1 lessons · 5 questions

Least You Need to Know: Trie vs Hash vs KMP Tradeoffs for String Tasks

String problems often hinge on the right representation. Tries help with many shared prefixes, hashing helps with fast average-case lookup or substring fingerprints, and KMP helps with exact pattern matching without backtracking in the text.

Открыть урок

Tries Prefix Search

1 lessons · 5 questions

Least You Need to Know: Tries, Prefix Search, and Shared Prefix Structure

A **trie** stores strings by characters along root-to-node paths. It is useful when many words share prefixes and the interview task asks about prefix lookup, autocomplete, or word-search branching.

Открыть урок

Two Pointers Compaction

1 lessons · 5 questions

Least You Need to Know: Read/Write Pointers, Compaction, and Deduping

A read pointer examines every element while a write pointer marks where the next kept element belongs. This is the core interview pattern for in-place filtering, removing duplicates, and compacting arrays without extra output storage.

Открыть урок

Two Pointers Sorted Pairs

1 lessons · 5 questions

Least You Need to Know: Opposite-End Two Pointers and Sorted Pair Search

When data order lets you predict how a sum or comparison changes, **two pointers** can eliminate large parts of the search space without backtracking. This is the interview reason sorted-pair, palindrome, and container-style problems collapse from quadratic scanning to linear passes.

Открыть урок

Union Find Connectivity

1 lessons · 5 questions

Least You Need to Know: Union-Find for Connectivity and Cycles

Union-find, also called **disjoint set union (DSU)**, tracks which items currently belong to the same connected component. It is especially useful when edges are added over time and you need fast connectivity or redundant-edge reasoning.

Открыть урок

Z Function

1 lessons · 5 questions

Least You Need to Know: Z-Function, Prefix Matches, and Pattern Search by Concatenation

The Z-function at position `i` stores the length of the longest substring starting at `i` that matches the whole string prefix. This lets you reason about repeated prefix structure and perform pattern search via concatenation.

Открыть урок