[{"data":1,"prerenderedAt":11103},["ShallowReactive",2],{"nav:algorithms":3,"lesson:\u002Falgorithms\u002Fdynamic-programming\u002Fsequence-dp":374,"course-wordcounts":10971,"ref-card-index":11027},[4,28,50,71,120,152,205,230,286,306,331,352],{"module":5,"moduleNumber":6,"slug":7,"lessons":8},"Foundations",1,"foundations",[9,15,21],{"title":10,"path":11,"lessonNumber":6,"topics":12,"summary":14},"What Is an Algorithm?","\u002Falgorithms\u002Ffoundations\u002Fwhat-is-an-algorithm",[5,13],"Correctness & Induction","An algorithm is a finite, mechanical recipe that transforms inputs into outputs. We pin down what counts as an algorithm, how we write one down, and the three things we always ask of it: is it correct, is it fast, and can we prove it.\n",{"title":16,"path":17,"lessonNumber":18,"topics":19,"summary":20},"Asymptotic Analysis","\u002Falgorithms\u002Ffoundations\u002Fasymptotic-analysis",2,[16],"We measure an algorithm's running time as a function of its input size, then strip away machine-specific constants and lower-order terms to compare algorithms cleanly. This lesson defines the RAM model and the $O$, $\\Omega$, $\\Theta$, $o$, and $\\omega$ notations, and shows how to read the cost of loops off the page.\n",{"title":22,"path":23,"lessonNumber":24,"topics":25,"summary":27},"Recurrences and the Master Theorem","\u002Falgorithms\u002Ffoundations\u002Frecurrences",3,[26],"Recurrences","Recursive and divide-and-conquer algorithms describe their own running time with a recurrence: $T(n)$ in terms of $T$ on smaller inputs. We solve recurrences three ways — drawing the recursion tree, guessing-and-verifying by induction, and applying the Master Theorem — using merge sort as the running example.\n",{"module":29,"moduleNumber":18,"slug":30,"lessons":31},"Divide & Conquer","divide-and-conquer",[32,38,44],{"title":33,"path":34,"lessonNumber":6,"topics":35,"summary":37},"Divide and Conquer & Mergesort","\u002Falgorithms\u002Fdivide-and-conquer\u002Fmergesort",[29,36],"Comparison Sorting","Divide and conquer breaks a problem into smaller copies of itself, solves them recursively, and stitches the answers together. We meet the paradigm through mergesort — its merge step, its loop-invariant proof, and the recursion tree that pins its cost at $\\Theta(n\\log n)$ — then glimpse Karatsuba multiplication as a second example of the same idea.",{"title":39,"path":40,"lessonNumber":18,"topics":41,"summary":43},"Quicksort","\u002Falgorithms\u002Fdivide-and-conquer\u002Fquicksort",[36,42],"Probabilistic Analysis","Quicksort sorts in place by partitioning around a pivot and recursing on each side. We give Lomuto and Hoare partitioning with a correctness invariant, see why a bad pivot costs $\\Theta(n^2)$ while a balanced one gives $\\Theta(n\\log n)$, and prove that randomizing the pivot makes the expected cost $\\Theta(n\\log n)$ on every input.",{"title":45,"path":46,"lessonNumber":24,"topics":47,"summary":49},"Linear-Time Selection","\u002Falgorithms\u002Fdivide-and-conquer\u002Fselection",[48,29],"Order Statistics","Finding the $k$-th smallest element looks like it should require sorting, but it does not. Quickselect adapts quicksort's partition to recurse on just one side, achieving expected $O(n)$. The median-of-medians algorithm guarantees a good pivot with the groups-of-five trick, pushing the worst case down to a provable $O(n)$.",{"module":51,"moduleNumber":24,"slug":52,"lessons":53},"Sorting & Order Statistics","sorting",[54,60,65],{"title":55,"path":56,"lessonNumber":6,"topics":57,"summary":59},"Heaps and Heapsort","\u002Falgorithms\u002Fsorting\u002Fheaps-and-heapsort",[58,36],"Heaps","A binary heap is a tree we store flat in an array, with index arithmetic standing in for pointers. We build the max-heap property bottom-up in $O(n)$ time, sort in place in $\\Theta(n\\log n)$ by repeatedly extracting the maximum, and reuse the same structure to implement a priority queue.",{"title":61,"path":62,"lessonNumber":18,"topics":63,"summary":64},"Lower Bounds for Comparison Sorting","\u002Falgorithms\u002Fsorting\u002Fsorting-lower-bounds",[36],"Every sort we have seen runs in $\\Omega(n\\log n)$, and that is no accident. Modeling a sort as a decision tree of comparisons, we show any such tree must have $n!$ leaves, forcing height $\\ge \\log_2(n!) = \\Omega(n\\log n)$ — a worst-case bound no comparison sort can ever beat.",{"title":66,"path":67,"lessonNumber":24,"topics":68,"summary":70},"Sorting in Linear Time","\u002Falgorithms\u002Fsorting\u002Flinear-time-sorting",[69],"Linear-Time Sorting","The $\\Omega(n\\log n)$ barrier only binds algorithms that compare. By instead using keys as array indices we slip past it: counting sort runs in $\\Theta(n+k)$ and is stable, radix sort layers it digit by digit, and bucket sort averages $\\Theta(n)$ on uniform data. We see exactly when each applies.",{"module":72,"moduleNumber":73,"slug":74,"lessons":75},"Data Structures",4,"data-structures",[76,82,88,93,99,105,113],{"title":77,"path":78,"lessonNumber":6,"topics":79,"summary":81},"Elementary Data Structures","\u002Falgorithms\u002Fdata-structures\u002Felementary-structures",[80],"Linear Structures","Every container is built one of two ways: **contiguous** in an array, or **linked** through pointers. We trade cache-friendly random access against $O(1)$ splicing, derive the **amortized $O(1)$** append of a doubling dynamic array, and assemble the two ordered access disciplines — the LIFO **stack** and the FIFO **queue** (with its generalization, the **deque**) — on top of both.",{"title":83,"path":84,"lessonNumber":18,"topics":85,"summary":87},"Hash Tables","\u002Falgorithms\u002Fdata-structures\u002Fhash-tables",[86],"Hashing","A hash table implements the dictionary — insert, search, delete — in expected $O(1)$ time by scattering keys across an array with a hash function. We build up from direct addressing, handle collisions by chaining and by open addressing, analyze the load factor $\\alpha$, and see how universal hashing earns its expected-time guarantee against every input.",{"title":89,"path":90,"lessonNumber":24,"topics":91,"summary":92},"Binary Search Trees","\u002Falgorithms\u002Fdata-structures\u002Fbinary-search-trees",[89],"A binary search tree keeps keys ordered so that every operation follows a single root-to-leaf path. We state the BST property, give search and insert, find minimum, maximum, and successor, see that an inorder walk emits the keys in sorted order, and confront the catch — every operation costs $O(h)$, and a carelessly built tree degrades to height $h = \\Theta(n)$, motivating balance.",{"title":94,"path":95,"lessonNumber":73,"topics":96,"summary":98},"AVL Trees","\u002Falgorithms\u002Fdata-structures\u002Favl-trees",[97],"Balanced Trees","An AVL tree is the first balanced BST: at every node the two subtrees' heights differ by at most $1$. A Fibonacci-style minimal-node argument forces height $h \\le 1.44\\log_2 n = O(\\log n)$, so search, insert, and delete are all $O(\\log n)$. Insertion rebalances with at most one of four rotation cases (LL, RR, LR, RL); deletion may rotate all the way to the root.",{"title":100,"path":101,"lessonNumber":102,"topics":103,"summary":104},"Balanced Search Trees","\u002Falgorithms\u002Fdata-structures\u002Fbalanced-trees",5,[97],"An ordinary BST can degrade to height $\\Theta(n)$; balanced search trees guarantee $h = O(\\log n)$ by maintaining invariants and repairing them after every update. We meet rotations, the local restructuring primitive, then red-black trees, whose color invariants force logarithmic height, and finally B-trees, which trade tall-and-thin for short-and-wide to win on disk.",{"title":106,"path":107,"lessonNumber":108,"topics":109,"summary":112},"Disjoint Sets (Union-Find)","\u002Falgorithms\u002Fdata-structures\u002Funion-find",6,[110,111],"Disjoint Sets","Amortized Analysis","The disjoint-set data structure tracks a partition of elements into groups, answering \"are these two in the same group?\" and merging groups on demand. A forest of parent pointers, sped up by union by rank and path compression, drives every operation to near-constant $O(\\alpha(n))$ amortized time — the engine behind connectivity queries and Kruskal's minimum spanning tree.",{"title":114,"path":115,"lessonNumber":116,"topics":117,"summary":119},"Fenwick & Segment Trees","\u002Falgorithms\u002Fdata-structures\u002Ffenwick-and-segment-trees",7,[118],"Range Queries","A prefix-sum array answers a range sum in $O(1)$ but pays $O(n)$ per update; a plain array updates in $O(1)$ but pays $O(n)$ per range sum. Fenwick and segment trees give us _both_ in $O(\\log n)$. The Fenwick (binary indexed) tree is a tiny array keyed by the low bit; the segment tree is a general balanced tree over canonical ranges that handles any associative aggregate and, with lazy propagation, range updates too.",{"module":121,"moduleNumber":102,"slug":122,"lessons":123},"Sequences & Strings","sequences",[124,130,135,141,147],{"title":125,"path":126,"lessonNumber":6,"topics":127,"summary":129},"Two Pointers, Sliding Windows & Prefix Sums","\u002Falgorithms\u002Fsequences\u002Ftwo-pointers-and-windows",[128],"Array Techniques","A family of array idioms that collapse an obvious $O(n^2)$ scan into a single $O(n)$ pass by maintaining an invariant as indices move. We meet two pointers (converging on a sorted array, and a fast\u002Fslow pair for in-place rewriting), the sliding window (fixed and variable size, amortized $O(n)$), and prefix sums, which answer any range-sum in $O(1)$ and count subarrays summing to $k$.",{"title":131,"path":132,"lessonNumber":18,"topics":133,"summary":134},"Monotonic Stacks & Queues","\u002Falgorithms\u002Fsequences\u002Fmonotonic-stacks",[128],"A **monotonic stack** keeps its contents sorted by popping every element that would break the order before each push — turning a family of \"previous\u002Fnext greater (or smaller) element\" questions into a single $O(n)$ scan. We derive the next-greater-element routine and its amortized analysis, fuse two such scans to measure the **largest rectangle in a histogram** in linear time, and extend the idea to a **monotonic deque** that streams the **sliding-window maximum** in $O(n)$.",{"title":136,"path":137,"lessonNumber":24,"topics":138,"summary":140},"Binary Search on the Answer","\u002Falgorithms\u002Fsequences\u002Fbinary-search-on-the-answer",[139],"Searching","Binary search is not really about arrays — it is about locating the boundary of a **monotone predicate** $p(x)$ in $O(\\log(\\text{range}))$ probes. We first pin down the half-open `while (lo \u003C hi)` template for $\\textsc{lower\\_bound}$ and $\\textsc{upper\\_bound}$, then generalize to \"binary search on the answer\": whenever feasibility is monotone in a numeric parameter, we binary search the parameter itself, calling a feasibility check at each step.",{"title":142,"path":143,"lessonNumber":73,"topics":144,"summary":146},"String Matching: Rabin–Karp, KMP & Z","\u002Falgorithms\u002Fsequences\u002Fstring-matching",[145],"Strings","Given a text $T$ of length $n$ and a pattern $P$ of length $m$, find every occurrence of $P$ in $T$. The naive scan costs $O(nm)$; we beat it three ways. Rabin–Karp uses a **rolling hash** to test alignments in $O(1)$ amortised each, with expected $O(n+m)$. KMP precomputes a **failure function** so the scan never re-reads a text character, for worst-case $O(n+m)$. The **Z-function** gives the same bound from a different angle and converts freely to KMP's table.",{"title":148,"path":149,"lessonNumber":102,"topics":150,"summary":151},"Tries & Prefix Trees","\u002Falgorithms\u002Fsequences\u002Ftries",[145],"A **trie** stores a set of strings in a tree keyed by _characters_, so that insert, search, and prefix-test all run in $O(L)$ time — the length of the key, _independent of how many keys are stored_. Shared prefixes are stored once, which makes tries the natural structure for autocomplete, wildcard dictionaries, board word-search, and — over the alphabet $\\{0,1\\}$ — the maximum-XOR-pair problem.",{"module":153,"moduleNumber":108,"slug":154,"lessons":155},"Graphs","graphs",[156,163,168,173,178,183,188,193,199],{"title":157,"path":158,"lessonNumber":6,"topics":159,"summary":162},"Graph Representations and Traversal","\u002Falgorithms\u002Fgraphs\u002Frepresentations-and-traversal",[160,161],"Graph Representations","Graph Traversal","A graph captures _relationships_ — who connects to whom. We fix the vocabulary, weigh the two standard representations (adjacency list versus matrix), then meet the two explorations you'll use constantly: breadth-first search, which finds shortest paths by number of edges, and depth-first search, whose discovery and finish times reveal a graph's hidden structure. Both run in $O(V + E)$.",{"title":164,"path":165,"lessonNumber":18,"topics":166,"summary":167},"Topological Sort and Strong Connectivity","\u002Falgorithms\u002Fgraphs\u002Ftopological-sort-and-scc",[161],"Directed acyclic graphs model dependencies: tasks that must precede other tasks. A _topological order_ lays such a graph out in a line so every edge points forward, and depth-first finish times hand it to us almost for free. We then ask the harder question for graphs _with_ cycles: which vertices can reach each other? The answer is the strongly connected components, found by a two-pass DFS.",{"title":169,"path":170,"lessonNumber":24,"topics":171,"summary":172},"Minimum Spanning Trees","\u002Falgorithms\u002Fgraphs\u002Fminimum-spanning-trees",[169],"Given a weighted network, how do we connect everything as cheaply as possible? The answer is a minimum spanning tree. One lemma, the cut property, justifies _every_ correct MST algorithm, and from it two famous greedy methods fall out: Kruskal's, which grows a forest edge by edge with a union-find structure, and Prim's, which grows a single tree using a priority queue.",{"title":174,"path":175,"lessonNumber":73,"topics":176,"summary":177},"Shortest Paths","\u002Falgorithms\u002Fgraphs\u002Fshortest-paths",[174],"Finding the cheapest route through a weighted network is one of the most-used algorithms in computing. A single operation — _relaxation_ — underlies them all. Dijkstra's algorithm solves the non-negative case greedily; Bellman-Ford handles negative edges and detects negative cycles; and Floyd-Warshall finds the shortest path between _every_ pair of vertices.",{"title":179,"path":180,"lessonNumber":102,"topics":181,"summary":182},"Network Flow","\u002Falgorithms\u002Fgraphs\u002Fnetwork-flow",[179],"How much can flow through a network from source to sink? Max-flow is a surprisingly general model — once you see a problem as flow, a whole toolbox opens up. We build flow networks, find maximum flows by repeatedly pushing along augmenting paths in the residual graph, prove the max-flow min-cut theorem, and watch bipartite matching fall out as a special case.",{"title":184,"path":185,"lessonNumber":108,"topics":186,"summary":187},"Bridges & Articulation Points","\u002Falgorithms\u002Fgraphs\u002Fbridges-and-articulation-points",[153],"A **bridge** is an edge whose removal disconnects the graph; an **articulation point** is a vertex whose removal does. Both are single points of failure in a network. A single depth-first search computes discovery times and **low-links**, and two local criteria — $low[v] > disc[u]$ for bridges, $low[v] \\ge disc[u]$ for cut vertices — find them all in $O(V+E)$.",{"title":189,"path":190,"lessonNumber":116,"topics":191,"summary":192},"Lowest Common Ancestor & Binary Lifting","\u002Falgorithms\u002Fgraphs\u002Flowest-common-ancestor",[153],"Given a rooted tree, the lowest common ancestor of $u$ and $v$ is the deepest node that is an ancestor of both. A naive walk answers one query in $O(h)$; **binary lifting** precomputes the $2^k$-th ancestor of every node in $O(n\\log n)$, then answers $k$-th-ancestor and LCA queries in $O(\\log n)$ each. We derive both jumps, apply them to tree distance, and compare against the Euler-tour + RMQ and Tarjan offline alternatives.",{"title":194,"path":195,"lessonNumber":196,"topics":197,"summary":198},"2-SAT via Implication Graphs","\u002Falgorithms\u002Fgraphs\u002Ftwo-sat",8,[153],"A boolean formula whose every clause has exactly two literals can be solved in _linear_ time — even though its three-literal cousin is NP-complete. The trick is to read each clause as a pair of implications, build a directed graph on the $2n$ literals, and ask a question we already know how to answer: which literals share a strongly connected component? The formula is satisfiable iff no variable lands in the same SCC as its own negation, and the SCCs' topological order hands us a satisfying assignment for free.",{"title":200,"path":201,"lessonNumber":202,"topics":203,"summary":204},"Eulerian Tours","\u002Falgorithms\u002Fgraphs\u002Feulerian-tours",9,[153],"An **Eulerian tour** uses every _edge_ of a graph exactly once. We give the exact parity and balance conditions under which one exists (even degree for undirected graphs, in-degree equal to out-degree for directed) and Hierholzer's $O(E)$ algorithm that constructs one by splicing closed sub-tours. We contrast this sharply with the **Hamiltonian** problem (visit every _vertex_ once), which is NP-complete: visiting edges is easy, visiting vertices is hard.",{"module":206,"moduleNumber":116,"slug":207,"lessons":208},"Greedy Algorithms","greedy",[209,214,220,225],{"title":210,"path":211,"lessonNumber":6,"topics":212,"summary":213},"The Greedy Method","\u002Falgorithms\u002Fgreedy\u002Fthe-greedy-method",[206],"A greedy algorithm builds a solution one locally-best choice at a time and never looks back. We pin down the two properties that make this work — the greedy-choice property and optimal substructure — prove the canonical activity-selection algorithm correct with an exchange argument, watch greedy fail spectacularly on the 0\u002F1 knapsack, and glimpse matroids as the theory that says exactly when greed is good.",{"title":215,"path":216,"lessonNumber":18,"topics":217,"summary":219},"Scheduling & Interval Partitioning","\u002Falgorithms\u002Fgreedy\u002Fscheduling-and-intervals",[218],"Greedy","Three classic scheduling problems all yield to greedy algorithms — and all three turn on a single design decision: which key to sort by. Interval scheduling sorts by **finish** time to pack the most compatible jobs; interval partitioning sorts by **start** time and proves the rooms needed equal the maximum overlap **depth**; minimizing maximum lateness sorts by **deadline** and is justified by an adjacent-swap exchange argument.",{"title":221,"path":222,"lessonNumber":24,"topics":223,"summary":224},"Huffman Codes","\u002Falgorithms\u002Fgreedy\u002Fhuffman-codes",[206],"Huffman coding is the greedy method's most beautiful application: it builds a provably optimal prefix-free binary code by repeatedly merging the two least frequent symbols. We develop prefix-free codes as binary trees, give the algorithm with a priority queue, build a Huffman tree from example frequencies, prove optimality with the same greedy-choice-plus-substructure argument, and pin the running time at $O(n\\log n)$.",{"title":226,"path":227,"lessonNumber":73,"topics":228,"summary":229},"Matroids & Exchange Arguments","\u002Falgorithms\u002Fgreedy\u002Fmatroids",[218],"The capstone of the greedy module: _why_ and _when_ a greedy algorithm is provably optimal. We recap the two correctness templates — **greedy-stays-ahead** and the **exchange argument** — then meet the **matroid** $M=(S,\\mathcal{I})$, an abstraction whose **exchange property** is exactly the structure greedy needs. The matroid–greedy theorem says sorting by weight and taking what stays independent yields a maximum-weight basis _if and only if_ the structure is a matroid. Kruskal's MST is the canonical instance; 0\u002F1 knapsack and TSP are the canonical failures.",{"module":231,"moduleNumber":196,"slug":232,"lessons":233},"Dynamic Programming","dynamic-programming",[234,239,245,250,255,260,265,270,275,280],{"title":235,"path":236,"lessonNumber":6,"topics":237,"summary":238},"Principles of Dynamic Programming","\u002Falgorithms\u002Fdynamic-programming\u002Fprinciples",[231,26],"Dynamic programming is recursion with memory: when a recursive solution re-solves the same subproblems again and again, we solve each one once and store the answer. We pin down the two structural conditions that make this work — overlapping subproblems and optimal substructure — contrast top-down memoization with bottom-up tabulation, and distil the whole method into a five-step recipe.",{"title":240,"path":241,"lessonNumber":18,"topics":242,"summary":244},"Sequence Alignment & LCS","\u002Falgorithms\u002Fdynamic-programming\u002Fsequence-dp",[231,243],"String Structures","Two strings can be compared by asking how much of one survives inside the other. The longest common subsequence (LCS) and edit distance are the two classic answers, and they are the _same_ dynamic program wearing different costs. We derive the LCS recurrence by examining the last characters, fill a worked DP table, reconstruct the subsequence, and then show edit distance as the identical $\\Theta(mn)$ pattern.",{"title":246,"path":247,"lessonNumber":24,"topics":248,"summary":249},"Longest Increasing Subsequence","\u002Falgorithms\u002Fdynamic-programming\u002Flongest-increasing-subsequence",[231],"Given a sequence of numbers, how long is its longest strictly increasing subsequence? A first dynamic program indexes subproblems by the element each subsequence _ends at_, giving an $O(n^2)$ solution with parent-pointer reconstruction. A sharper idea, the patience-sorting _tails_ array searched by binary search, drops the time to $O(n\\log n)$. We then fold in the variants: non-decreasing, counting, Russian-doll envelopes, and bitonic.",{"title":251,"path":252,"lessonNumber":73,"topics":253,"summary":254},"Knapsack & Subset Problems","\u002Falgorithms\u002Fdynamic-programming\u002Fknapsack",[231],"We start from $\\textsc{Subset-sum}$ — does some sublist hit a target $t$? — and its include\u002Fexclude recurrence over a boolean table $A(i, u)$, then bolt on values to get 0\u002F1 knapsack as the same machine with $\\lor$ promoted to $\\max$. We fill both tables, recover the chosen items, and confront the surprise that the $\\Theta(nt)$ running time is only _pseudo-polynomial_ — exponential in the bit length $b$, and unimprovable unless $\\mathrm{P}=\\mathrm{NP}$ since subset-sum is $\\textsc{NP-complete}$. The fractional variant reveals the sharp line between greedy and dynamic programming.",{"title":256,"path":257,"lessonNumber":102,"topics":258,"summary":259},"Coin Change & Unbounded Knapsack","\u002Falgorithms\u002Fdynamic-programming\u002Fcoin-change-and-unbounded",[231],"The previous lesson let each item be taken at most once. Drop that cap — items may be reused _any number of times_ — and the 0\u002F1 knapsack collapses from a two-dimensional table to a one-dimensional one, because there is no longer a prefix of \"already-used\" items to track. We meet **unbounded knapsack**, then its most famous instance, **coin change**: the minimum-coins recurrence $C[a] = 1 + \\min_c C[a-c]$, and the counting variant where the _order of the loops_ decides whether you count unordered combinations or ordered sequences — the classic bug. Greed fails in general but works for canonical coin systems.",{"title":261,"path":262,"lessonNumber":108,"topics":263,"summary":264},"Interval DP","\u002Falgorithms\u002Fdynamic-programming\u002Finterval-dp",[231],"Many problems ask for the best way to combine a contiguous range of items, and the answer is a dynamic program over subintervals $[i,j]$ that chooses a split point $k$. We derive the pattern from matrix-chain multiplication — parenthesising a product to minimize scalar multiplications in $O(n^3)$ — distil it into a reusable template filled by increasing interval length, and then meet its sharpest variant: the \"last operation\" trick behind Burst Balloons and cutting a stick, where fixing the _last_ move (not the first) makes the two sides independent.",{"title":266,"path":267,"lessonNumber":116,"topics":268,"summary":269},"Dynamic Programming on Trees","\u002Falgorithms\u002Fdynamic-programming\u002Ftree-dp",[231],"When the subproblems of a dynamic program are _rooted subtrees_, a single post-order DFS solves the whole thing in $O(n)$: each node combines the already-computed answers of its children. We meet the archetype — maximum-weight independent set on a tree — then the \"path through a node\" pattern behind tree diameter and maximum path sum, and finally **rerooting**, which computes a per-node answer for _every_ node as root in $O(n)$ with two passes.",{"title":271,"path":272,"lessonNumber":196,"topics":273,"summary":274},"Bitmask DP","\u002Falgorithms\u002Fdynamic-programming\u002Fbitmask-dp",[231],"When a subproblem depends not on an index or a prefix but on _which subset_ of a small ground set has been used, we can encode that subset as the bits of an integer and index a DP table by it. With $n \\le \\sim 20$ the $2^n$ subsets fit in a table, turning $\\Theta(n!)$ brute force into $O(2^n \\cdot \\text{poly}(n))$. We meet the bit tricks, the Held–Karp TSP archetype, assignment by mask, subset-sum partitioning, and submask enumeration with its $3^n$ bound.",{"title":276,"path":277,"lessonNumber":202,"topics":278,"summary":279},"DP Optimizations","\u002Falgorithms\u002Fdynamic-programming\u002Fdp-optimizations",[231],"A correct DP recurrence is only half the battle; its naive evaluation is often a factor of $n$ slower than necessary. This capstone surveys five techniques, monotonic-queue, the convex hull trick, divide-and-conquer optimization, Knuth's optimization, and SOS DP, that each exploit _structure in the transition_ (a sliding window, linear costs, monotone optimal splits, the quadrangle inequality, or subset lattices) to shave an $O(n)$, $O(\\log n)$, or worse factor off the running time.",{"title":281,"path":282,"lessonNumber":283,"topics":284,"summary":285},"Dynamic Programming on Graphs","\u002Falgorithms\u002Fdynamic-programming\u002Fdp-on-graphs",10,[231],"Many graph algorithms are dynamic programs in disguise: the subproblem is the _best value reachable under a restricted resource_ — intermediate vertices allowed, edges allowed, or a topological prefix — and edge _relaxation_ is the DP transition. We frame Floyd–Warshall as the archetype ($O(V^3)$ all-pairs shortest paths), Bellman–Ford as a DP over path length (the at-most-$K$-stops variant), DAG-DP in topological order ($O(V+E)$), and Warshall's transitive closure as the boolean analog.",{"module":287,"moduleNumber":202,"slug":288,"lessons":289},"Backtracking & Search","backtracking",[290,296,301],{"title":291,"path":292,"lessonNumber":6,"topics":293,"summary":295},"Backtracking: Subsets, Permutations & Combinations","\u002Falgorithms\u002Fbacktracking\u002Fbacktracking-fundamentals",[294],"Backtracking","Backtracking builds a solution one choice at a time and abandons a partial solution the moment it cannot be completed, exploring a state-space tree by depth-first search. We meet the universal choose\u002Fexplore\u002Fun-choose template, derive the canonical enumerations — subsets ($2^n$), permutations ($n!$), and combinations ($\\binom{n}{k}$) — handle duplicate elements by skipping equal siblings, and see how pruning turns an exponential search into a tractable one.",{"title":297,"path":298,"lessonNumber":18,"topics":299,"summary":300},"Constraint Search: N-Queens & Sudoku","\u002Falgorithms\u002Fbacktracking\u002Fconstraint-search",[294],"Many hard puzzles are **constraint satisfaction problems**: assign each variable a value from its domain so that every constraint holds. Backtracking solves them by assigning variables one at a time and rejecting a partial assignment the instant a constraint breaks. We make the rejection cheap — $O(1)$ conflict checks for N-Queens via column and diagonal sets — and prune harder with **forward checking**, **MRV** ordering, and **constraint propagation**, which is what lets an exponential search actually finish.",{"title":302,"path":303,"lessonNumber":24,"topics":304,"summary":305},"Branch & Bound and Meet in the Middle","\u002Falgorithms\u002Fbacktracking\u002Fbranch-and-bound",[294],"Plain backtracking prunes a search tree by _feasibility_; for _optimization_ problems we can prune far more aggressively by _value_. **Branch and bound** keeps the best complete solution found so far and discards any partial solution whose optimistic bound cannot beat it. **Meet in the middle** splits the instance in two, enumerates each half, and recombines by binary search — turning $2^n$ into $O(2^{n\u002F2}\\,n)$ and pushing exact search out to $n \\approx 40$.",{"module":307,"moduleNumber":283,"slug":308,"lessons":309},"Mathematical Algorithms","mathematical-algorithms",[310,316,321,326],{"title":311,"path":312,"lessonNumber":6,"topics":313,"summary":315},"Number Theory: GCD & Modular Arithmetic","\u002Falgorithms\u002Fmathematical-algorithms\u002Fnumber-theory-basics",[314],"Number Theory","This lesson opens the mathematical-algorithms module with the bedrock of computational number theory. We prove Euclid's recurrence $\\gcd(a,b)=\\gcd(b,\\,a\\bmod b)$ and its $O(\\log\\min(a,b))$ running time, extend it to recover Bézout coefficients $x,y$ with $ax+by=\\gcd(a,b)$, and build modular arithmetic on residue classes — including when a modular inverse $a^{-1}\\bmod m$ exists and how to compute it.",{"title":317,"path":318,"lessonNumber":18,"topics":319,"summary":320},"Modular Exponentiation & Primality","\u002Falgorithms\u002Fmathematical-algorithms\u002Fmodular-exponentiation-and-primality",[314],"Computing $a^n \\bmod m$ naively costs $n$ multiplications; **repeated squaring** does it in $O(\\log n)$ by reading the bits of the exponent. We use this routine to state **Fermat's little theorem** (and the modular inverse it gives), then to test primality — trial division, the probabilistic **Fermat** and **Miller–Rabin** tests, and the deterministic witness set that settles primality for every 64-bit number.",{"title":322,"path":323,"lessonNumber":24,"topics":324,"summary":325},"Sieves & Factorization","\u002Falgorithms\u002Fmathematical-algorithms\u002Fsieve-and-factorization",[314],"The previous lesson tested one number for primality; here we ask for _all_ primes up to $n$ at once. The **sieve of Eratosthenes** cross-cuts composites in $O(n\\log\\log n)$, and a **linear sieve** does it in $O(n)$ while recording each number's **smallest prime factor**, which then factors any $x \\le n$ in $O(\\log x)$. From a factorization $x = \\prod p_i^{e_i}$ the multiplicative functions $\\tau$, $\\sigma$, and Euler's totient $\\varphi$ fall out immediately.",{"title":327,"path":328,"lessonNumber":73,"topics":329,"summary":330},"Combinatorics & Counting","\u002Falgorithms\u002Fmathematical-algorithms\u002Fcombinatorics",[314],"Counting is the arithmetic of finite sets. We build up from permutations $n!$ and combinations $\\binom{n}{k}$, prove Pascal's rule by a bijection, and count multisets with stars and bars. The practical core is computing $\\binom{n}{k}\\bmod p$ in $O(1)$ from precomputed factorials and inverse factorials. We close with inclusion–exclusion and the Chinese Remainder Theorem, both of which lean on the modular inverse from the previous lesson.",{"module":332,"moduleNumber":333,"slug":334,"lessons":335},"Computational Geometry",11,"computational-geometry",[336,342,347],{"title":337,"path":338,"lessonNumber":6,"topics":339,"summary":341},"Geometric Primitives & Orientation","\u002Falgorithms\u002Fcomputational-geometry\u002Fgeometric-primitives",[340],"Geometry","Computational geometry is built on a single reliable primitive — the **orientation test**, a sign of a cross product that tells whether three points turn left, right, or lie collinear. From points-as-vectors and the dot and cross products we derive orientation, segment intersection, the shoelace area formula, and point-in-polygon tests, keeping all arithmetic **exact and integer** so that no floating-point rounding can corrupt a sign.",{"title":343,"path":344,"lessonNumber":18,"topics":345,"summary":346},"Convex Hull","\u002Falgorithms\u002Fcomputational-geometry\u002Fconvex-hull",[340],"The convex hull is the smallest convex polygon enclosing a point set — the rubber band snapped around the nails. We build it with Andrew's monotone chain, sorting by $(x,y)$ and sweeping a lower and upper hull while popping any non-left turn via the orientation primitive, in $O(n\\log n)$. A reduction from sorting shows that bound is optimal, and the hull unlocks diameter, smallest enclosing rectangle, and more through rotating calipers.",{"title":348,"path":349,"lessonNumber":24,"topics":350,"summary":351},"Sweep-Line Algorithms","\u002Falgorithms\u002Fcomputational-geometry\u002Fsweep-line",[340],"The plane-sweep paradigm turns a static $2$-D geometry problem into a dynamic $1$-D ordered-set problem: a vertical line sweeps left to right, stopping at an $x$-sorted **event queue** while a balanced-BST **status structure** tracks the objects it currently crosses, ordered by $y$. We derive Bentley–Ottmann segment intersection in $O((n+k)\\log n)$, recover closest-pair in $O(n\\log n)$, and reduce skyline, rectangle-area, and overlap problems to $\\pm1$ event sweeps.",{"module":353,"moduleNumber":354,"slug":355,"lessons":356},"Intractability",12,"intractability",[357,363,367],{"title":358,"path":359,"lessonNumber":6,"topics":360,"summary":362},"P, NP, and Reductions","\u002Falgorithms\u002Fintractability\u002Fp-np-reductions",[361],"NP-Completeness","Most problems we have met so far have fast algorithms. A vast and important family seemingly does not. This lesson builds the vocabulary for that divide: decision problems, the class $\\mathsf{P}$ of problems we can solve quickly, the class $\\mathsf{NP}$ of problems whose solutions we can _check_ quickly, and polynomial-time reductions, the tool that lets us compare the difficulty of two problems without solving either.",{"title":361,"path":364,"lessonNumber":18,"topics":365,"summary":366},"\u002Falgorithms\u002Fintractability\u002Fnp-completeness",[361],"Some problems in $\\mathsf{NP}$ are universally hardest: every other problem in $\\mathsf{NP}$ reduces to them. This lesson defines $\\mathsf{NP}$-hard and $\\mathsf{NP}$-complete, states the Cook–Levin theorem that anchors the whole edifice on **SAT**, walks the web of reductions that grows from it, and gives the four-step recipe for proving a brand-new problem $\\mathsf{NP}$-complete.",{"title":368,"path":369,"lessonNumber":24,"topics":370,"summary":373},"Coping with NP-Hardness","\u002Falgorithms\u002Fintractability\u002Fcoping-with-hardness",[371,372],"Approximation","Heuristics","Proving a problem $\\mathsf{NP}$-hard is the beginning, not the end. The world still needs answers. This lesson surveys the four honest responses to hardness: approximation algorithms with a provable ratio (worked through a 2-approximation for vertex cover), heuristics and local search, exact exponential methods like branch and bound, and exploiting special structure in the instances you actually face.",{"id":375,"title":240,"blurb":376,"body":377,"description":10931,"extension":10932,"meta":10933,"module":231,"navigation":10935,"path":241,"practice":10936,"rawbody":10953,"readingTime":10954,"seo":10959,"sources":10960,"status":10967,"stem":10968,"summary":244,"topics":10969,"__hash__":10970},"course\u002F01.algorithms\u002F08.dynamic-programming\u002F02.sequence-dp.md","",{"type":378,"value":379,"toc":10917},"minimark",[380,434,439,836,839,1188,1294,1461,1465,1555,1739,1956,1960,2043,2808,2811,3453,3848,3859,4221,4259,4474,4617,4881,4903,5533,5652,6442,6613,6617,6664,6732,6785,6789,7021,7488,7586,7590,7810,7865,7912,7916,8030,8057,8158,8162,8231,8326,8500,9355,9422,9504,9999,10119,10256,10260,10824,10913],[381,382,383,384,388,389,392,393,396,397,396,400,396,403,396,406,409,410,414,415,418,419,429,430,433],"p",{},"How similar are two strings? ",[385,386,387],"code",{},"algorithm"," and ",[385,390,391],{},"altruistic"," share the letters\n",[385,394,395],{},"a",", ",[385,398,399],{},"l",[385,401,402],{},"t",[385,404,405],{},"i",[385,407,408],{},"c"," in order, and that shared spine, the ",[411,412,413],"strong",{},"longest common\nsubsequence",", is one of the most useful measures of similarity in computing. It\nunderlies the ",[385,416,417],{},"diff"," utility, version-control merges, and (with a change of cost\nfunction) the alignment of DNA and protein sequences in computational biology.",[420,421,422],"sup",{},[395,423,428],{"href":424,"ariaDescribedBy":425,"dataFootnoteRef":376,"id":427},"#user-content-fn-skiena-lcs",[426],"footnote-label","user-content-fnref-skiena-lcs","1","\nThis lesson develops the LCS dynamic program in full, then shows that ",[411,431,432],{},"edit\ndistance"," is the very same machine with the costs rearranged.",[435,436,438],"h2",{"id":437},"the-problem","The problem",[381,440,441,442,445,446,450,451,454,455,458,459,462,463,388,661,827,828,831,832,835],{},"A ",[411,443,444],{},"subsequence"," of a string is what remains after deleting zero or more\ncharacters, ",[447,448,449],"em",{},"keeping the rest in their original order",". It need not be\ncontiguous: ",[385,452,453],{},"ace"," is a subsequence of ",[385,456,457],{},"abcde",", but ",[385,460,461],{},"aec"," is not. Given two\nstrings ",[464,465,468],"span",{"className":466},[467],"katex",[464,469,473,502],{"className":470,"ariaHidden":472},[471],"katex-html","true",[464,474,477,482,489,494,499],{"className":475},[476],"base",[464,478],{"className":479,"style":481},[480],"strut","height:0.6833em;",[464,483,488],{"className":484,"style":487},[485,486],"mord","mathnormal","margin-right:0.0785em;","X",[464,490],{"className":491,"style":493},[492],"mspace","margin-right:0.2778em;",[464,495,498],{"className":496},[497],"mrel","=",[464,500],{"className":501,"style":493},[492],[464,503,505,509,566,607,611,616,619],{"className":504},[476],[464,506],{"className":507,"style":508},[480],"height:0.5806em;vertical-align:-0.15em;",[464,510,512,516],{"className":511},[485],[464,513,515],{"className":514},[485,486],"x",[464,517,520],{"className":518},[519],"msupsub",[464,521,525,557],{"className":522},[523,524],"vlist-t","vlist-t2",[464,526,529,552],{"className":527},[528],"vlist-r",[464,530,534],{"className":531,"style":533},[532],"vlist","height:0.3011em;",[464,535,537,542],{"style":536},"top:-2.55em;margin-left:0em;margin-right:0.05em;",[464,538],{"className":539,"style":541},[540],"pstrut","height:2.7em;",[464,543,549],{"className":544},[545,546,547,548],"sizing","reset-size6","size3","mtight",[464,550,428],{"className":551},[485,548],[464,553,556],{"className":554},[555],"vlist-s","​",[464,558,560],{"className":559},[528],[464,561,564],{"className":562,"style":563},[532],"height:0.15em;",[464,565],{},[464,567,569,572],{"className":568},[485],[464,570,515],{"className":571},[485,486],[464,573,575],{"className":574},[519],[464,576,578,599],{"className":577},[523,524],[464,579,581,596],{"className":580},[528],[464,582,584],{"className":583,"style":533},[532],[464,585,586,589],{"style":536},[464,587],{"className":588,"style":541},[540],[464,590,592],{"className":591},[545,546,547,548],[464,593,595],{"className":594},[485,548],"2",[464,597,556],{"className":598},[555],[464,600,602],{"className":601},[528],[464,603,605],{"className":604,"style":563},[532],[464,606],{},[464,608],{"className":609,"style":610},[492],"margin-right:0.1667em;",[464,612,615],{"className":613},[614],"minner","⋯",[464,617],{"className":618,"style":610},[492],[464,620,622,625],{"className":621},[485],[464,623,515],{"className":624},[485,486],[464,626,628],{"className":627},[519],[464,629,631,653],{"className":630},[523,524],[464,632,634,650],{"className":633},[528],[464,635,638],{"className":636,"style":637},[532],"height:0.1514em;",[464,639,640,643],{"style":536},[464,641],{"className":642,"style":541},[540],[464,644,646],{"className":645},[545,546,547,548],[464,647,649],{"className":648},[485,486,548],"m",[464,651,556],{"className":652},[555],[464,654,656],{"className":655},[528],[464,657,659],{"className":658,"style":563},[532],[464,660],{},[464,662,664],{"className":663},[467],[464,665,667,687],{"className":666,"ariaHidden":472},[471],[464,668,670,673,678,681,684],{"className":669},[476],[464,671],{"className":672,"style":481},[480],[464,674,677],{"className":675,"style":676},[485,486],"margin-right:0.2222em;","Y",[464,679],{"className":680,"style":493},[492],[464,682,498],{"className":683},[497],[464,685],{"className":686,"style":493},[492],[464,688,690,694,737,777,780,783,786],{"className":689},[476],[464,691],{"className":692,"style":693},[480],"height:0.625em;vertical-align:-0.1944em;",[464,695,697,702],{"className":696},[485],[464,698,701],{"className":699,"style":700},[485,486],"margin-right:0.0359em;","y",[464,703,705],{"className":704},[519],[464,706,708,729],{"className":707},[523,524],[464,709,711,726],{"className":710},[528],[464,712,714],{"className":713,"style":533},[532],[464,715,717,720],{"style":716},"top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;",[464,718],{"className":719,"style":541},[540],[464,721,723],{"className":722},[545,546,547,548],[464,724,428],{"className":725},[485,548],[464,727,556],{"className":728},[555],[464,730,732],{"className":731},[528],[464,733,735],{"className":734,"style":563},[532],[464,736],{},[464,738,740,743],{"className":739},[485],[464,741,701],{"className":742,"style":700},[485,486],[464,744,746],{"className":745},[519],[464,747,749,769],{"className":748},[523,524],[464,750,752,766],{"className":751},[528],[464,753,755],{"className":754,"style":533},[532],[464,756,757,760],{"style":716},[464,758],{"className":759,"style":541},[540],[464,761,763],{"className":762},[545,546,547,548],[464,764,595],{"className":765},[485,548],[464,767,556],{"className":768},[555],[464,770,772],{"className":771},[528],[464,773,775],{"className":774,"style":563},[532],[464,776],{},[464,778],{"className":779,"style":610},[492],[464,781,615],{"className":782},[614],[464,784],{"className":785,"style":610},[492],[464,787,789,792],{"className":788},[485],[464,790,701],{"className":791,"style":700},[485,486],[464,793,795],{"className":794},[519],[464,796,798,819],{"className":797},[523,524],[464,799,801,816],{"className":800},[528],[464,802,804],{"className":803,"style":637},[532],[464,805,806,809],{"style":716},[464,807],{"className":808,"style":541},[540],[464,810,812],{"className":811},[545,546,547,548],[464,813,815],{"className":814},[485,486,548],"n",[464,817,556],{"className":818},[555],[464,820,822],{"className":821},[528],[464,823,825],{"className":824,"style":563},[532],[464,826],{},", a ",[411,829,830],{},"common\nsubsequence"," is a string that is a subsequence of both, and we want a ",[411,833,834],{},"longest","\none.",[381,837,838],{},"A common subsequence is a set of order-preserving matches threading the two\nstrings: the matched letters appear in both, left to right, though the gaps\nbetween them differ.",[840,841,845,1057],"figure",{"className":842},[843,844],"tikz-figure","tikz-diagram-rendered",[846,847,852],"svg",{"xmlns":848,"width":849,"height":850,"viewBox":851},"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg","322.045","95.255","-75 -75 241.534 71.441",[853,854,857,870,879,889,898,907,916,925,934,943,951,959,967,975,984,992,1001,1009,1017,1026,1031],"g",{"stroke":855,"style":856},"currentColor","stroke-miterlimit:10;stroke-width:.4",[853,858,860],{"fill":859,"stroke":859},"var(--tk-accent)",[853,861,863],{"transform":862},"translate(-3.468 -22.532)",[864,865],"path",{"d":866,"fill":859,"stroke":859,"className":867,"style":869},"M-56.214-39.550L-58.182-39.550L-58.182-39.866Q-57.958-39.866-57.763-39.917Q-57.567-39.967-57.416-40.088Q-57.264-40.209-57.194-40.416L-55.234-45.887Q-55.181-45.992-55.071-45.992L-54.979-45.992Q-54.869-45.992-54.816-45.887L-52.764-40.161Q-52.685-39.972-52.452-39.919Q-52.219-39.866-51.867-39.866L-51.867-39.550L-54.368-39.550L-54.368-39.866Q-53.630-39.866-53.630-40.117Q-53.630-40.143-53.638-40.161L-54.144-41.576L-56.438-41.576L-56.851-40.416Q-56.877-40.359-56.877-40.306Q-56.877-40.082-56.671-39.974Q-56.464-39.866-56.214-39.866L-56.214-39.550M-55.295-44.779L-56.328-41.888L-54.258-41.888",[868],"tikz-text","stroke-width:0.270",[853,871,872],{"fill":859,"stroke":859},[853,873,875],{"transform":874},"translate(14.182 -22.532)",[864,876],{"d":877,"fill":859,"stroke":859,"className":878,"style":869},"M-53.362-39.550L-58.165-39.550L-58.165-39.866Q-57.246-39.866-57.246-40.161L-57.246-45.087Q-57.246-45.382-58.165-45.382L-58.165-45.698L-55.260-45.698L-55.260-45.382Q-56.403-45.382-56.403-45.087L-56.403-40.161Q-56.403-39.967-56.297-39.917Q-56.192-39.866-55.941-39.866L-55.225-39.866Q-54.548-39.866-54.168-40.110Q-53.788-40.354-53.630-40.783Q-53.471-41.211-53.397-41.910L-53.107-41.910",[868],[853,880,882],{"fill":881,"stroke":881},"var(--tk-line)",[853,883,885],{"transform":884},"translate(30.515 -22.532)",[864,886],{"d":887,"fill":881,"stroke":881,"className":888,"style":869},"M-56.403-40.512Q-56.064-40.112-55.587-39.891Q-55.111-39.669-54.583-39.669Q-54.262-39.669-53.937-39.774Q-53.612-39.880-53.397-40.102Q-53.181-40.323-53.181-40.657L-53.181-41.404Q-53.181-41.699-54.333-41.699L-54.333-42.015L-51.696-42.015L-51.696-41.699Q-51.990-41.699-52.162-41.646Q-52.333-41.593-52.333-41.404L-52.333-39.629Q-52.333-39.603-52.368-39.576Q-52.404-39.550-52.434-39.550Q-52.491-39.550-52.601-39.647Q-52.711-39.743-52.834-39.880Q-52.957-40.016-53.010-40.099Q-53.181-39.827-53.463-39.662Q-53.744-39.497-54.087-39.425Q-54.429-39.352-54.746-39.352Q-55.625-39.352-56.367-39.796Q-57.110-40.240-57.543-40.996Q-57.976-41.752-57.976-42.626Q-57.976-43.272-57.728-43.872Q-57.479-44.472-57.031-44.929Q-56.583-45.386-55.994-45.641Q-55.405-45.896-54.746-45.896Q-54.271-45.896-53.830-45.689Q-53.388-45.483-53.063-45.122L-52.540-45.861Q-52.522-45.896-52.478-45.896L-52.426-45.896Q-52.390-45.896-52.362-45.867Q-52.333-45.839-52.333-45.812L-52.333-43.382Q-52.333-43.360-52.366-43.331Q-52.399-43.303-52.426-43.303L-52.557-43.303Q-52.584-43.303-52.617-43.331Q-52.650-43.360-52.650-43.382Q-52.650-43.668-52.790-44.061Q-52.931-44.454-53.098-44.696Q-53.375-45.100-53.772-45.340Q-54.170-45.579-54.636-45.579Q-54.974-45.579-55.304-45.478Q-55.634-45.377-55.917-45.184Q-56.200-44.990-56.411-44.736Q-57.022-43.984-57.022-42.626Q-57.022-42.007-56.882-41.464Q-56.741-40.921-56.403-40.512",[868],[853,890,891],{"fill":881,"stroke":881},[853,892,894],{"transform":893},"translate(47.618 -22.532)",[864,895],{"d":896,"fill":881,"stroke":881,"className":897,"style":869},"M-54.900-39.352Q-55.546-39.352-56.106-39.612Q-56.666-39.871-57.088-40.328Q-57.510-40.785-57.743-41.376Q-57.976-41.967-57.976-42.591Q-57.976-43.224-57.745-43.830Q-57.514-44.437-57.097-44.898Q-56.679-45.360-56.115-45.628Q-55.550-45.896-54.900-45.896Q-54.245-45.896-53.676-45.628Q-53.107-45.360-52.691-44.894Q-52.276-44.428-52.048-43.832Q-51.819-43.237-51.819-42.591Q-51.819-41.967-52.048-41.376Q-52.276-40.785-52.700-40.328Q-53.124-39.871-53.687-39.612Q-54.249-39.352-54.900-39.352M-56.455-40.539Q-56.275-40.275-56.033-40.080Q-55.792-39.884-55.502-39.772Q-55.212-39.660-54.900-39.660Q-54.588-39.660-54.295-39.772Q-54.003-39.884-53.759-40.082Q-53.515-40.279-53.344-40.539Q-53.137-40.829-53.010-41.191Q-52.883-41.554-52.830-41.941Q-52.777-42.327-52.777-42.745Q-52.777-44.028-53.344-44.779Q-53.520-45.030-53.766-45.217Q-54.012-45.404-54.302-45.505Q-54.592-45.606-54.900-45.606Q-55.352-45.606-55.765-45.386Q-56.178-45.166-56.455-44.779Q-56.754-44.380-56.888-43.857Q-57.022-43.334-57.022-42.745Q-57.022-42.327-56.969-41.941Q-56.917-41.554-56.789-41.191Q-56.662-40.829-56.455-40.539",[868],[853,899,900],{"fill":859,"stroke":859},[853,901,903],{"transform":902},"translate(64.883 -22.532)",[864,904],{"d":905,"fill":859,"stroke":859,"className":906,"style":869},"M-55.493-39.550L-58.147-39.550L-58.147-39.866Q-57.229-39.866-57.229-40.161L-57.229-45.087Q-57.229-45.382-58.147-45.382L-58.147-45.698L-55.286-45.698Q-54.913-45.698-54.489-45.599Q-54.065-45.500-53.691-45.300Q-53.318-45.100-53.083-44.790Q-52.847-44.481-52.847-44.068Q-52.847-43.698-53.074-43.397Q-53.300-43.096-53.652-42.899Q-54.003-42.701-54.368-42.609Q-53.449-42.283-53.296-41.448L-53.190-40.657Q-53.146-40.323-53.102-40.130Q-53.058-39.937-52.929-39.774Q-52.799-39.612-52.566-39.612Q-52.294-39.612-52.151-39.862Q-52.008-40.112-52.008-40.416Q-52.008-40.455-51.975-40.484Q-51.942-40.512-51.903-40.512L-51.819-40.512Q-51.771-40.512-51.747-40.479Q-51.722-40.446-51.722-40.398Q-51.722-40.161-51.823-39.913Q-51.925-39.664-52.120-39.508Q-52.316-39.352-52.566-39.352Q-53.225-39.352-53.685-39.677Q-54.144-40.003-54.144-40.640L-54.144-41.431Q-54.144-41.730-54.306-41.976Q-54.469-42.222-54.733-42.358Q-54.996-42.494-55.295-42.494L-56.411-42.494L-56.411-40.161Q-56.411-39.866-55.493-39.866L-55.493-39.550M-56.411-45.087L-56.411-42.754L-55.405-42.754Q-54.654-42.754-54.227-43.052Q-53.801-43.351-53.801-44.068Q-53.801-44.801-54.221-45.092Q-54.640-45.382-55.405-45.382L-55.950-45.382Q-56.200-45.382-56.306-45.333Q-56.411-45.285-56.411-45.087",[868],[853,908,909],{"fill":859,"stroke":859},[853,910,912],{"transform":911},"translate(83.69 -22.532)",[864,913],{"d":914,"fill":859,"stroke":859,"className":915,"style":869},"M-55.440-39.550L-58.213-39.550L-58.213-39.866Q-57.246-39.866-57.246-40.161L-57.246-45.087Q-57.246-45.382-58.213-45.382L-58.213-45.698L-55.440-45.698L-55.440-45.382Q-56.403-45.382-56.403-45.087L-56.403-40.161Q-56.403-39.866-55.440-39.866",[868],[853,917,918],{"fill":859,"stroke":859},[853,919,921],{"transform":920},"translate(99.09 -22.532)",[864,922],{"d":923,"fill":859,"stroke":859,"className":924,"style":869},"M-53.432-39.550L-56.868-39.550L-56.868-39.866Q-56.007-39.866-55.792-39.919Q-55.704-39.932-55.638-40.003Q-55.572-40.073-55.572-40.161L-55.572-45.087Q-55.572-45.280-55.678-45.331Q-55.783-45.382-56.033-45.382L-56.438-45.382Q-56.794-45.382-57.053-45.318Q-57.312-45.254-57.510-45.056Q-57.677-44.894-57.741-44.584Q-57.804-44.274-57.870-43.637L-58.156-43.637L-57.976-45.698L-52.333-45.698L-52.153-43.637L-52.443-43.637Q-52.465-43.918-52.502-44.204Q-52.540-44.489-52.610-44.714Q-52.680-44.938-52.803-45.056Q-53.115-45.382-53.871-45.382L-54.267-45.382Q-54.517-45.382-54.623-45.333Q-54.728-45.285-54.728-45.087L-54.728-40.161Q-54.728-40.073-54.662-40.003Q-54.596-39.932-54.513-39.919Q-54.298-39.866-53.432-39.866",[868],[853,926,927],{"fill":881,"stroke":881},[853,928,930],{"transform":929},"translate(116.035 -22.532)",[864,931],{"d":932,"fill":881,"stroke":881,"className":933,"style":869},"M-55.484-39.550L-58.165-39.550L-58.165-39.866Q-57.246-39.866-57.246-40.161L-57.246-45.087Q-57.246-45.382-58.165-45.382L-58.165-45.698L-55.484-45.698L-55.484-45.382Q-56.403-45.382-56.403-45.087L-56.403-42.907L-53.647-42.907L-53.647-45.087Q-53.647-45.382-54.566-45.382L-54.566-45.698L-51.885-45.698L-51.885-45.382Q-52.803-45.382-52.803-45.087L-52.803-40.161Q-52.803-39.866-51.885-39.866L-51.885-39.550L-54.566-39.550L-54.566-39.866Q-53.647-39.866-53.647-40.161L-53.647-42.591L-56.403-42.591L-56.403-40.161Q-56.403-39.866-55.484-39.866",[868],[853,935,936],{"fill":881,"stroke":881},[853,937,939],{"transform":938},"translate(132.336 -22.532)",[864,940],{"d":941,"fill":881,"stroke":881,"className":942,"style":869},"M-55.972-39.550L-58.121-39.550L-58.121-39.866Q-57.202-39.866-57.202-40.416L-57.202-45.087Q-57.202-45.382-58.121-45.382L-58.121-45.698L-56.429-45.698Q-56.310-45.698-56.266-45.588L-54.249-40.486L-52.245-45.588Q-52.201-45.698-52.083-45.698L-50.391-45.698L-50.391-45.382Q-51.309-45.382-51.309-45.087L-51.309-40.161Q-51.309-39.866-50.391-39.866L-50.391-39.550L-52.992-39.550L-52.992-39.866Q-52.074-39.866-52.074-40.161L-52.074-45.364L-54.324-39.669Q-54.364-39.550-54.495-39.550Q-54.623-39.550-54.667-39.669L-56.886-45.302L-56.886-40.416Q-56.886-39.866-55.972-39.866",[868],[853,944,945],{"fill":859,"stroke":859},[853,946,948],{"transform":947},"translate(-3.468 28.682)",[864,949],{"d":866,"fill":859,"stroke":859,"className":950,"style":869},[868],[853,952,953],{"fill":859,"stroke":859},[853,954,956],{"transform":955},"translate(14.182 28.682)",[864,957],{"d":877,"fill":859,"stroke":859,"className":958,"style":869},[868],[853,960,961],{"fill":881,"stroke":881},[853,962,964],{"transform":963},"translate(30.803 28.682)",[864,965],{"d":923,"fill":881,"stroke":881,"className":966,"style":869},[868],[853,968,969],{"fill":859,"stroke":859},[853,970,972],{"transform":971},"translate(47.811 28.682)",[864,973],{"d":905,"fill":859,"stroke":859,"className":974,"style":869},[868],[853,976,977],{"fill":881,"stroke":881},[853,978,980],{"transform":979},"translate(64.82 28.682)",[864,981],{"d":982,"fill":881,"stroke":881,"className":983,"style":869},"M-57.246-41.593L-57.246-45.087Q-57.246-45.382-58.165-45.382L-58.165-45.698L-55.484-45.698L-55.484-45.382Q-56.403-45.382-56.403-45.087L-56.403-41.611Q-56.403-41.097-56.251-40.653Q-56.099-40.209-55.761-39.939Q-55.423-39.669-54.891-39.669Q-54.368-39.669-53.966-39.937Q-53.564-40.205-53.340-40.657Q-53.115-41.110-53.115-41.611L-53.115-44.832Q-53.115-45.382-54.034-45.382L-54.034-45.698L-51.885-45.698L-51.885-45.382Q-52.803-45.382-52.803-44.832L-52.803-41.593Q-52.803-41.154-52.955-40.758Q-53.107-40.363-53.392-40.040Q-53.678-39.717-54.067-39.535Q-54.456-39.352-54.891-39.352Q-55.506-39.352-56.047-39.644Q-56.587-39.937-56.917-40.455Q-57.246-40.974-57.246-41.593",[868],[853,985,986],{"fill":859,"stroke":859},[853,987,989],{"transform":988},"translate(83.69 28.682)",[864,990],{"d":914,"fill":859,"stroke":859,"className":991,"style":869},[868],[853,993,994],{"fill":881,"stroke":881},[853,995,997],{"transform":996},"translate(99.861 28.682)",[864,998],{"d":999,"fill":881,"stroke":881,"className":1000,"style":869},"M-57.976-39.431L-57.976-41.510Q-57.976-41.536-57.947-41.565Q-57.919-41.593-57.888-41.593L-57.778-41.593Q-57.747-41.593-57.719-41.565Q-57.690-41.536-57.690-41.510Q-57.690-40.908-57.433-40.497Q-57.176-40.086-56.715-39.877Q-56.253-39.669-55.673-39.669Q-55.339-39.669-55.067-39.844Q-54.794-40.020-54.640-40.312Q-54.487-40.605-54.487-40.925Q-54.487-41.141-54.555-41.343Q-54.623-41.545-54.741-41.710Q-54.860-41.875-55.040-41.996Q-55.220-42.116-55.423-42.160L-56.618-42.446Q-57-42.538-57.310-42.787Q-57.620-43.035-57.798-43.397Q-57.976-43.760-57.976-44.151Q-57.976-44.621-57.732-45.026Q-57.488-45.430-57.075-45.663Q-56.662-45.896-56.187-45.896Q-55.748-45.896-55.368-45.740Q-54.988-45.584-54.711-45.276L-54.342-45.861Q-54.324-45.896-54.280-45.896L-54.223-45.896Q-54.192-45.896-54.164-45.867Q-54.135-45.839-54.135-45.812L-54.135-43.734Q-54.135-43.712-54.168-43.683Q-54.201-43.654-54.223-43.654L-54.333-43.654Q-54.355-43.654-54.388-43.683Q-54.421-43.712-54.421-43.734Q-54.421-43.918-54.462-44.107Q-54.504-44.296-54.588-44.496Q-54.671-44.696-54.774-44.870Q-54.878-45.043-54.996-45.157Q-55.238-45.395-55.535-45.500Q-55.831-45.606-56.178-45.606Q-56.482-45.606-56.759-45.454Q-57.035-45.302-57.200-45.039Q-57.365-44.775-57.365-44.454Q-57.365-44.199-57.246-43.962Q-57.128-43.725-56.926-43.567Q-56.723-43.408-56.455-43.338L-55.260-43.052Q-54.851-42.956-54.535-42.681Q-54.219-42.406-54.045-42.022Q-53.871-41.637-53.871-41.224Q-53.871-40.741-54.109-40.306Q-54.346-39.871-54.759-39.612Q-55.172-39.352-55.664-39.352Q-56.161-39.352-56.620-39.506Q-57.079-39.660-57.391-39.972L-57.769-39.387Q-57.787-39.352-57.831-39.352L-57.888-39.352Q-57.910-39.352-57.943-39.381Q-57.976-39.409-57.976-39.431",[868],[853,1002,1003],{"fill":859,"stroke":859},[853,1004,1006],{"transform":1005},"translate(116.162 28.682)",[864,1007],{"d":923,"fill":859,"stroke":859,"className":1008,"style":869},[868],[853,1010,1011],{"fill":881,"stroke":881},[853,1012,1014],{"transform":1013},"translate(134.905 28.682)",[864,1015],{"d":914,"fill":881,"stroke":881,"className":1016,"style":869},[868],[853,1018,1019],{"fill":881,"stroke":881},[853,1020,1022],{"transform":1021},"translate(150.306 28.682)",[864,1023],{"d":1024,"fill":881,"stroke":881,"className":1025,"style":869},"M-56.411-40.512Q-56.091-40.121-55.616-39.895Q-55.141-39.669-54.627-39.669Q-54.065-39.669-53.608-39.952Q-53.151-40.236-52.887-40.719Q-52.623-41.202-52.623-41.747Q-52.623-41.778-52.593-41.802Q-52.562-41.826-52.531-41.826L-52.426-41.826Q-52.333-41.826-52.333-41.712Q-52.333-41.071-52.663-40.528Q-52.992-39.985-53.551-39.669Q-54.109-39.352-54.746-39.352Q-55.625-39.352-56.367-39.796Q-57.110-40.240-57.543-40.996Q-57.976-41.752-57.976-42.626Q-57.976-43.272-57.728-43.872Q-57.479-44.472-57.031-44.929Q-56.583-45.386-55.994-45.641Q-55.405-45.896-54.746-45.896Q-54.271-45.896-53.830-45.689Q-53.388-45.483-53.063-45.122L-52.540-45.861Q-52.522-45.896-52.478-45.896L-52.426-45.896Q-52.390-45.896-52.362-45.867Q-52.333-45.839-52.333-45.812L-52.333-43.382Q-52.333-43.360-52.366-43.331Q-52.399-43.303-52.426-43.303L-52.557-43.303Q-52.584-43.303-52.617-43.331Q-52.650-43.360-52.650-43.382Q-52.650-43.668-52.790-44.061Q-52.931-44.454-53.098-44.696Q-53.375-45.100-53.772-45.340Q-54.170-45.579-54.636-45.579Q-54.974-45.579-55.304-45.478Q-55.634-45.377-55.917-45.184Q-56.200-44.990-56.411-44.736Q-57.022-43.984-57.022-42.626Q-57.022-42.007-56.886-41.468Q-56.750-40.930-56.411-40.512",[868],[864,1027],{"fill":1028,"stroke":859,"d":1029,"style":1030},"none","M-58.49-57.844v36.589M-41.418-57.844v36.589M7.36-57.844-4.837-21.255M26.869-57.844v36.589M46.377-57.844l12.2 36.589","stroke-width:.8",[853,1032,1033],{"fill":859,"stroke":859},[853,1034,1037,1045,1051],{"fill":859,"stroke":1028,"fontFamily":1035,"fontSize":1036},"cmr8","8",[853,1038,1040],{"transform":1039},"translate(162.845 2.733)",[864,1041],{"d":1042,"fill":859,"stroke":859,"className":1043,"style":1044},"M-53.771-39.550L-58.154-39.550L-58.154-39.847Q-57.834-39.847-57.590-39.894Q-57.345-39.941-57.345-40.109L-57.345-44.452Q-57.345-44.624-57.590-44.671Q-57.834-44.718-58.154-44.718L-58.154-45.015L-55.568-45.015L-55.568-44.718Q-56.580-44.718-56.580-44.452L-56.580-40.109Q-56.580-39.937-56.488-39.892Q-56.396-39.847-56.178-39.847L-55.490-39.847Q-55.017-39.847-54.709-39.972Q-54.400-40.097-54.222-40.327Q-54.045-40.558-53.953-40.884Q-53.861-41.210-53.818-41.663L-53.537-41.663L-53.771-39.550M-52.713-42.284Q-52.713-42.878-52.480-43.409Q-52.248-43.941-51.832-44.341Q-51.416-44.741-50.883-44.962Q-50.349-45.183-49.744-45.183Q-49.306-45.183-48.908-45.001Q-48.510-44.820-48.201-44.487L-47.728-45.152Q-47.697-45.183-47.666-45.183L-47.619-45.183Q-47.592-45.183-47.560-45.152Q-47.529-45.120-47.529-45.093L-47.529-42.956Q-47.529-42.933-47.560-42.902Q-47.592-42.870-47.619-42.870L-47.736-42.870Q-47.763-42.870-47.795-42.902Q-47.826-42.933-47.826-42.956Q-47.826-43.222-47.969-43.575Q-48.111-43.929-48.291-44.167Q-48.545-44.499-48.894-44.693Q-49.244-44.886-49.650-44.886Q-50.154-44.886-50.607-44.667Q-51.060-44.448-51.353-44.054Q-51.849-43.386-51.849-42.284Q-51.849-41.753-51.713-41.286Q-51.576-40.820-51.301-40.454Q-51.025-40.089-50.605-39.884Q-50.185-39.679-49.642-39.679Q-49.154-39.679-48.730-39.923Q-48.306-40.167-48.058-40.587Q-47.810-41.007-47.810-41.503Q-47.810-41.538-47.781-41.564Q-47.752-41.589-47.720-41.589L-47.619-41.589Q-47.576-41.589-47.553-41.560Q-47.529-41.530-47.529-41.487Q-47.529-41.050-47.705-40.661Q-47.881-40.273-48.191-39.989Q-48.502-39.706-48.912-39.544Q-49.322-39.382-49.744-39.382Q-50.334-39.382-50.875-39.603Q-51.416-39.823-51.832-40.228Q-52.248-40.632-52.480-41.161Q-52.713-41.691-52.713-42.284M-46.576-39.472L-46.576-41.277Q-46.576-41.304-46.545-41.335Q-46.513-41.366-46.490-41.366L-46.385-41.366Q-46.353-41.366-46.324-41.337Q-46.295-41.308-46.295-41.277Q-46.295-40.495-45.779-40.087Q-45.263-39.679-44.455-39.679Q-44.158-39.679-43.902-39.829Q-43.646-39.980-43.496-40.236Q-43.345-40.491-43.345-40.788Q-43.345-41.187-43.592-41.491Q-43.838-41.796-44.209-41.878L-45.330-42.136Q-45.670-42.210-45.957-42.431Q-46.244-42.652-46.410-42.970Q-46.576-43.288-46.576-43.640Q-46.576-44.070-46.345-44.425Q-46.115-44.780-45.734-44.982Q-45.353-45.183-44.928-45.183Q-44.678-45.183-44.431-45.124Q-44.185-45.066-43.967-44.943Q-43.748-44.820-43.584-44.640L-43.256-45.136Q-43.224-45.183-43.185-45.183L-43.138-45.183Q-43.111-45.183-43.080-45.152Q-43.049-45.120-43.049-45.093L-43.049-43.284Q-43.049-43.261-43.080-43.230Q-43.111-43.198-43.138-43.198L-43.240-43.198Q-43.271-43.198-43.301-43.228Q-43.330-43.257-43.330-43.284Q-43.330-43.417-43.373-43.603Q-43.416-43.788-43.480-43.943Q-43.545-44.097-43.644-44.255Q-43.744-44.413-43.834-44.503Q-44.263-44.909-44.928-44.909Q-45.205-44.909-45.465-44.777Q-45.724-44.644-45.883-44.409Q-46.041-44.175-46.041-43.894Q-46.041-43.538-45.801-43.267Q-45.560-42.995-45.193-42.909L-44.080-42.655Q-43.803-42.589-43.570-42.435Q-43.338-42.280-43.168-42.062Q-42.998-41.843-42.904-41.585Q-42.810-41.327-42.810-41.038Q-42.810-40.710-42.935-40.407Q-43.060-40.105-43.295-39.868Q-43.529-39.632-43.822-39.507Q-44.115-39.382-44.455-39.382Q-45.470-39.382-46.041-39.925L-46.369-39.429Q-46.400-39.382-46.439-39.382L-46.490-39.382Q-46.513-39.382-46.545-39.413Q-46.576-39.445-46.576-39.472",[868],"stroke-width:0.240",[853,1046,1047],{"transform":1039},[864,1048],{"d":1049,"fill":859,"stroke":859,"className":1050,"style":1044},"M-33.526-40.527L-38.839-40.527Q-38.917-40.534-38.966-40.583Q-39.014-40.632-39.014-40.710Q-39.014-40.780-38.967-40.831Q-38.921-40.882-38.839-40.894L-33.526-40.894Q-33.452-40.882-33.405-40.831Q-33.358-40.780-33.358-40.710Q-33.358-40.632-33.407-40.583Q-33.456-40.534-33.526-40.527M-33.526-42.214L-38.839-42.214Q-38.917-42.222-38.966-42.271Q-39.014-42.320-39.014-42.398Q-39.014-42.468-38.967-42.519Q-38.921-42.570-38.839-42.581L-33.526-42.581Q-33.452-42.570-33.405-42.519Q-33.358-42.468-33.358-42.398Q-33.358-42.320-33.407-42.271Q-33.456-42.222-33.526-42.214",[868],[853,1052,1053],{"transform":1039},[864,1054],{"d":1055,"fill":859,"stroke":859,"className":1056,"style":1044},"M-28.004-39.550L-29.754-39.550L-29.754-39.847Q-29.055-39.847-28.867-40.327L-27.066-45.152Q-27.012-45.261-26.898-45.261L-26.828-45.261Q-26.715-45.261-26.660-45.152L-24.770-40.109Q-24.691-39.941-24.488-39.894Q-24.285-39.847-23.973-39.847L-23.973-39.550L-26.195-39.550L-26.195-39.847Q-25.555-39.847-25.555-40.062Q-25.555-40.081-25.557-40.091Q-25.559-40.101-25.563-40.109L-26.027-41.343L-28.172-41.343L-28.555-40.327Q-28.559-40.312-28.564-40.282Q-28.570-40.253-28.570-40.230Q-28.570-40.089-28.480-40.005Q-28.391-39.921-28.258-39.884Q-28.125-39.847-28.004-39.847L-28.004-39.550M-27.098-44.206L-28.066-41.640L-26.141-41.640L-27.098-44.206M-18.965-39.550L-23.348-39.550L-23.348-39.847Q-23.027-39.847-22.783-39.894Q-22.539-39.941-22.539-40.109L-22.539-44.452Q-22.539-44.624-22.783-44.671Q-23.027-44.718-23.348-44.718L-23.348-45.015L-20.762-45.015L-20.762-44.718Q-21.773-44.718-21.773-44.452L-21.773-40.109Q-21.773-39.937-21.682-39.892Q-21.590-39.847-21.371-39.847L-20.684-39.847Q-20.211-39.847-19.902-39.972Q-19.594-40.097-19.416-40.327Q-19.238-40.558-19.147-40.884Q-19.055-41.210-19.012-41.663L-18.730-41.663L-18.965-39.550M-15.668-39.550L-18.027-39.550L-18.027-39.847Q-17.703-39.847-17.461-39.894Q-17.219-39.941-17.219-40.109L-17.219-44.452Q-17.219-44.624-17.461-44.671Q-17.703-44.718-18.027-44.718L-18.027-45.015L-15.434-45.015Q-15.102-45.015-14.715-44.929Q-14.328-44.843-13.980-44.669Q-13.633-44.495-13.414-44.214Q-13.195-43.933-13.195-43.566Q-13.195-43.241-13.397-42.976Q-13.598-42.710-13.904-42.534Q-14.211-42.359-14.539-42.269Q-14.172-42.148-13.912-41.878Q-13.652-41.609-13.602-41.245L-13.508-40.550Q-13.438-40.101-13.340-39.870Q-13.242-39.640-12.945-39.640Q-12.699-39.640-12.566-39.857Q-12.434-40.073-12.434-40.335Q-12.414-40.409-12.332-40.429L-12.250-40.429Q-12.156-40.405-12.156-40.312Q-12.156-40.081-12.254-39.866Q-12.352-39.652-12.529-39.517Q-12.707-39.382-12.938-39.382Q-13.535-39.382-13.953-39.669Q-14.371-39.956-14.371-40.527L-14.371-41.222Q-14.371-41.503-14.523-41.718Q-14.676-41.933-14.926-42.046Q-15.176-42.159-15.449-42.159L-16.477-42.159L-16.477-40.109Q-16.477-39.945-16.232-39.896Q-15.988-39.847-15.668-39.847L-15.668-39.550M-16.477-44.452L-16.477-42.413L-15.547-42.413Q-15.227-42.413-14.959-42.466Q-14.691-42.519-14.492-42.646Q-14.293-42.773-14.176-43.005Q-14.059-43.237-14.059-43.566Q-14.059-44.218-14.455-44.468Q-14.852-44.718-15.547-44.718L-16.074-44.718Q-16.293-44.718-16.385-44.675Q-16.477-44.632-16.477-44.452M-9.371-39.550L-11.836-39.550L-11.836-39.847Q-11.504-39.847-11.246-39.894Q-10.988-39.941-10.988-40.109L-10.988-44.452Q-10.988-44.718-11.836-44.718L-11.836-45.015L-9.371-45.015L-9.371-44.718Q-10.223-44.718-10.223-44.452L-10.223-40.109Q-10.223-39.847-9.371-39.847L-9.371-39.550M-4.492-39.550L-7.535-39.550L-7.535-39.847Q-6.773-39.847-6.590-39.886Q-6.547-39.898-6.498-39.931Q-6.449-39.964-6.424-40.007Q-6.398-40.050-6.398-40.109L-6.398-44.452Q-6.398-44.628-6.490-44.673Q-6.582-44.718-6.797-44.718L-7.191-44.718Q-7.887-44.718-8.176-44.429Q-8.324-44.280-8.387-43.960Q-8.449-43.640-8.492-43.167L-8.773-43.167L-8.613-45.015L-3.414-45.015L-3.254-43.167L-3.535-43.167Q-3.578-43.675-3.641-43.978Q-3.703-44.280-3.855-44.429Q-4.141-44.718-4.840-44.718L-5.230-44.718Q-5.445-44.718-5.537-44.675Q-5.629-44.632-5.629-44.452L-5.629-40.109Q-5.629-40.034-5.574-39.970Q-5.520-39.905-5.438-39.886Q-5.254-39.847-4.492-39.847",[868],[1058,1059,1062,1063,1097,1098,388,1140,1187],"figcaption",{"className":1060},[1061],"tikz-cap","A common subsequence threads order-preserving matches through both strings. Here ",[464,1064,1066],{"className":1065},[467],[464,1067,1069],{"className":1068,"ariaHidden":472},[471],[464,1070,1072,1075,1079,1083,1088,1092],{"className":1071},[476],[464,1073],{"className":1074,"style":481},[480],[464,1076,1078],{"className":1077},[485,486],"A",[464,1080,1082],{"className":1081},[485,486],"L",[464,1084,1087],{"className":1085,"style":1086},[485,486],"margin-right:0.0077em;","R",[464,1089,1091],{"className":1090,"style":487},[485,486],"I",[464,1093,1096],{"className":1094,"style":1095},[485,486],"margin-right:0.1389em;","T"," is the longest common subsequence of ",[464,1099,1101],{"className":1100},[467],[464,1102,1104],{"className":1103,"ariaHidden":472},[471],[464,1105,1107,1110,1113,1116,1121,1124,1127,1130,1135],{"className":1106},[476],[464,1108],{"className":1109,"style":481},[480],[464,1111,1078],{"className":1112},[485,486],[464,1114,1082],{"className":1115},[485,486],[464,1117,1120],{"className":1118,"style":1119},[485,486],"margin-right:0.0278em;","GO",[464,1122,1087],{"className":1123,"style":1086},[485,486],[464,1125,1091],{"className":1126,"style":487},[485,486],[464,1128,1096],{"className":1129,"style":1095},[485,486],[464,1131,1134],{"className":1132,"style":1133},[485,486],"margin-right:0.0813em;","H",[464,1136,1139],{"className":1137,"style":1138},[485,486],"margin-right:0.109em;","M",[464,1141,1143],{"className":1142},[467],[464,1144,1146],{"className":1145,"ariaHidden":472},[471],[464,1147,1149,1152,1155,1158,1161,1164,1168,1171,1176,1179,1182],{"className":1148},[476],[464,1150],{"className":1151,"style":481},[480],[464,1153,1078],{"className":1154},[485,486],[464,1156,1082],{"className":1157},[485,486],[464,1159,1096],{"className":1160,"style":1095},[485,486],[464,1162,1087],{"className":1163,"style":1086},[485,486],[464,1165,1167],{"className":1166,"style":1138},[485,486],"U",[464,1169,1091],{"className":1170,"style":487},[485,486],[464,1172,1175],{"className":1173,"style":1174},[485,486],"margin-right:0.0576em;","S",[464,1177,1096],{"className":1178,"style":1095},[485,486],[464,1180,1091],{"className":1181,"style":487},[485,486],[464,1183,1186],{"className":1184,"style":1185},[485,486],"margin-right:0.0715em;","C","; matched letters connect, the rest are skipped.",[1189,1190,1192],"callout",{"type":1191},"problem",[381,1193,1194,1197,1198,388,1231,1258,1259,1262,1263,388,1278,1293],{},[411,1195,1196],{},"Input:"," strings ",[464,1199,1201],{"className":1200},[467],[464,1202,1204],{"className":1203,"ariaHidden":472},[471],[464,1205,1207,1211,1214,1219,1223,1226],{"className":1206},[476],[464,1208],{"className":1209,"style":1210},[480],"height:1em;vertical-align:-0.25em;",[464,1212,488],{"className":1213,"style":487},[485,486],[464,1215,1218],{"className":1216},[1217],"mopen","[",[464,1220,1222],{"className":1221},[485],"1..",[464,1224,649],{"className":1225},[485,486],[464,1227,1230],{"className":1228},[1229],"mclose","]",[464,1232,1234],{"className":1233},[467],[464,1235,1237],{"className":1236,"ariaHidden":472},[471],[464,1238,1240,1243,1246,1249,1252,1255],{"className":1239},[476],[464,1241],{"className":1242,"style":1210},[480],[464,1244,677],{"className":1245,"style":676},[485,486],[464,1247,1218],{"className":1248},[1217],[464,1250,1222],{"className":1251},[485],[464,1253,815],{"className":1254},[485,486],[464,1256,1230],{"className":1257},[1229],".\n",[411,1260,1261],{},"Output:"," a longest string that is a subsequence of both ",[464,1264,1266],{"className":1265},[467],[464,1267,1269],{"className":1268,"ariaHidden":472},[471],[464,1270,1272,1275],{"className":1271},[476],[464,1273],{"className":1274,"style":481},[480],[464,1276,488],{"className":1277,"style":487},[485,486],[464,1279,1281],{"className":1280},[467],[464,1282,1284],{"className":1283,"ariaHidden":472},[471],[464,1285,1287,1290],{"className":1286},[476],[464,1288],{"className":1289,"style":481},[480],[464,1291,677],{"className":1292,"style":676},[485,486],".",[381,1295,1296,1297,1312,1313,1356,1357,1372,1373,1432,1433,1436,1437,1440,1441,1444,1445,1448,1449,1452,1453,1456,1457,1460],{},"A brute-force search is hopeless: ",[464,1298,1300],{"className":1299},[467],[464,1301,1303],{"className":1302,"ariaHidden":472},[471],[464,1304,1306,1309],{"className":1305},[476],[464,1307],{"className":1308,"style":481},[480],[464,1310,488],{"className":1311,"style":487},[485,486]," has ",[464,1314,1316],{"className":1315},[467],[464,1317,1319],{"className":1318,"ariaHidden":472},[471],[464,1320,1322,1326],{"className":1321},[476],[464,1323],{"className":1324,"style":1325},[480],"height:0.6644em;",[464,1327,1329,1332],{"className":1328},[485],[464,1330,595],{"className":1331},[485],[464,1333,1335],{"className":1334},[519],[464,1336,1338],{"className":1337},[523],[464,1339,1341],{"className":1340},[528],[464,1342,1344],{"className":1343,"style":1325},[532],[464,1345,1347,1350],{"style":1346},"top:-3.063em;margin-right:0.05em;",[464,1348],{"className":1349,"style":541},[540],[464,1351,1353],{"className":1352},[545,546,547,548],[464,1354,649],{"className":1355},[485,486,548]," subsequences, and checking each\nagainst ",[464,1358,1360],{"className":1359},[467],[464,1361,1363],{"className":1362,"ariaHidden":472},[471],[464,1364,1366,1369],{"className":1365},[476],[464,1367],{"className":1368,"style":481},[480],[464,1370,677],{"className":1371,"style":676},[485,486]," gives ",[464,1374,1376],{"className":1375},[467],[464,1377,1379],{"className":1378,"ariaHidden":472},[471],[464,1380,1382,1385,1389,1393,1396,1399,1428],{"className":1381},[476],[464,1383],{"className":1384,"style":1210},[480],[464,1386,1388],{"className":1387},[485],"Θ",[464,1390,1392],{"className":1391},[1217],"(",[464,1394,815],{"className":1395},[485,486],[464,1397],{"className":1398,"style":610},[492],[464,1400,1402,1405],{"className":1401},[485],[464,1403,595],{"className":1404},[485],[464,1406,1408],{"className":1407},[519],[464,1409,1411],{"className":1410},[523],[464,1412,1414],{"className":1413},[528],[464,1415,1417],{"className":1416,"style":1325},[532],[464,1418,1419,1422],{"style":1346},[464,1420],{"className":1421,"style":541},[540],[464,1423,1425],{"className":1424},[545,546,547,548],[464,1426,649],{"className":1427},[485,486,548],[464,1429,1431],{"className":1430},[1229],")",". We need the ",[395,1434,1435],{"href":236},"recipe",",\nand it pays to follow it literally. The DP recipe runs through fixed steps: ",[411,1438,1439],{},"(0)"," simplify the\ngoal, ",[411,1442,1443],{},"(1)"," define the subproblems and notation, ",[411,1446,1447],{},"(2)"," write the DP equations,\n",[411,1450,1451],{},"(3)"," prove them correct by induction, ",[411,1454,1455],{},"(4)"," turn them into iterative\npseudocode, ",[411,1458,1459],{},"(5)"," return to the original goal, then analyze. We walk LCS through\nthose steps verbatim.",[435,1462,1464],{"id":1463},"step-01-simplify-the-goal-define-the-subproblem","Step 0–1: Simplify the goal, define the subproblem",[381,1466,1467,1470,1471,1474,1475,1478,1479,1481,1482,1485,1486,388,1519,1554],{},[411,1468,1469],{},"Simplify first."," Computing the ",[447,1472,1473],{},"string"," drags around bookkeeping; computing its\n",[411,1476,1477],{},"length"," is cleaner. So we first solve for the LCS ",[447,1480,1477],{},", then recover an\nactual subsequence in a cheap second pass (Step 5). With that simplification, the\ndecisive move, the one worth internalizing because it recurs across all\nsequence DPs, is to index subproblems by ",[411,1483,1484],{},"prefixes"," of the two strings. Write\n",[464,1487,1489],{"className":1488},[467],[464,1490,1492,1510],{"className":1491,"ariaHidden":472},[471],[464,1493,1495,1498,1501,1504,1507],{"className":1494},[476],[464,1496],{"className":1497,"style":481},[480],[464,1499,1078],{"className":1500},[485,486],[464,1502],{"className":1503,"style":493},[492],[464,1505,498],{"className":1506},[497],[464,1508],{"className":1509,"style":493},[492],[464,1511,1513,1516],{"className":1512},[476],[464,1514],{"className":1515,"style":481},[480],[464,1517,488],{"className":1518,"style":487},[485,486],[464,1520,1522],{"className":1521},[467],[464,1523,1525,1545],{"className":1524,"ariaHidden":472},[471],[464,1526,1528,1531,1536,1539,1542],{"className":1527},[476],[464,1529],{"className":1530,"style":481},[480],[464,1532,1535],{"className":1533,"style":1534},[485,486],"margin-right:0.0502em;","B",[464,1537],{"className":1538,"style":493},[492],[464,1540,498],{"className":1541},[497],[464,1543],{"className":1544,"style":493},[492],[464,1546,1548,1551],{"className":1547},[476],[464,1549],{"className":1550,"style":481},[480],[464,1552,677],{"className":1553,"style":676},[485,486]," for the two inputs.",[1189,1556,1558],{"type":1557},"definition",[381,1559,1560,1563,1564,1683,1684,1711,1712,1293],{},[411,1561,1562],{},"Definition (LCS subproblem)."," Let ",[464,1565,1567],{"className":1566},[467],[464,1568,1570,1616],{"className":1569,"ariaHidden":472},[471],[464,1571,1573,1576,1585,1588,1591,1596,1599,1604,1607,1610,1613],{"className":1572},[476],[464,1574],{"className":1575,"style":1210},[480],[464,1577,1580],{"className":1578},[1579],"mop",[464,1581,1584],{"className":1582},[485,1583],"mathrm","OPT",[464,1586,1392],{"className":1587},[1217],[464,1589,405],{"className":1590},[485,486],[464,1592,1595],{"className":1593},[1594],"mpunct",",",[464,1597],{"className":1598,"style":610},[492],[464,1600,1603],{"className":1601,"style":1602},[485,486],"margin-right:0.0572em;","j",[464,1605,1431],{"className":1606},[1229],[464,1608],{"className":1609,"style":493},[492],[464,1611,498],{"className":1612},[497],[464,1614],{"className":1615,"style":493},[492],[464,1617,1619,1623,1630,1638,1641,1644,1647,1650,1653,1656,1659,1662,1665,1668,1671,1674,1677],{"className":1618},[476],[464,1620],{"className":1621,"style":1622},[480],"height:1.2em;vertical-align:-0.35em;",[464,1624,1626],{"className":1625},[1579],[464,1627,1629],{"className":1628},[485,1583],"LCS-length",[464,1631,1633],{"className":1632},[1217],[464,1634,1392],{"className":1635},[1636,1637],"delimsizing","size1",[464,1639,1078],{"className":1640},[485,486],[464,1642,1218],{"className":1643},[1217],[464,1645,1222],{"className":1646},[485],[464,1648,405],{"className":1649},[485,486],[464,1651,1230],{"className":1652},[1229],[464,1654,1595],{"className":1655},[1594],[464,1657],{"className":1658,"style":610},[492],[464,1660],{"className":1661,"style":610},[492],[464,1663,1535],{"className":1664,"style":1534},[485,486],[464,1666,1218],{"className":1667},[1217],[464,1669,1222],{"className":1670},[485],[464,1672,1603],{"className":1673,"style":1602},[485,486],[464,1675,1230],{"className":1676},[1229],[464,1678,1680],{"className":1679},[1229],[464,1681,1431],{"className":1682},[1636,1637],",\nthe length of a longest common subsequence of the prefixes ",[464,1685,1687],{"className":1686},[467],[464,1688,1690],{"className":1689,"ariaHidden":472},[471],[464,1691,1693,1696,1699,1702,1705,1708],{"className":1692},[476],[464,1694],{"className":1695,"style":1210},[480],[464,1697,1078],{"className":1698},[485,486],[464,1700,1218],{"className":1701},[1217],[464,1703,1222],{"className":1704},[485],[464,1706,405],{"className":1707},[485,486],[464,1709,1230],{"className":1710},[1229]," and\n",[464,1713,1715],{"className":1714},[467],[464,1716,1718],{"className":1717,"ariaHidden":472},[471],[464,1719,1721,1724,1727,1730,1733,1736],{"className":1720},[476],[464,1722],{"className":1723,"style":1210},[480],[464,1725,1535],{"className":1726,"style":1534},[485,486],[464,1728,1218],{"className":1729},[1217],[464,1731,1222],{"className":1732},[485],[464,1734,1603],{"className":1735,"style":1602},[485,486],[464,1737,1230],{"className":1738},[1229],[381,1740,1741,1742,1778,1779,1847,1848,388,1904,1293],{},"The answer we want is ",[464,1743,1745],{"className":1744},[467],[464,1746,1748],{"className":1747,"ariaHidden":472},[471],[464,1749,1751,1754,1760,1763,1766,1769,1772,1775],{"className":1750},[476],[464,1752],{"className":1753,"style":1210},[480],[464,1755,1757],{"className":1756},[1579],[464,1758,1584],{"className":1759},[485,1583],[464,1761,1392],{"className":1762},[1217],[464,1764,649],{"className":1765},[485,486],[464,1767,1595],{"className":1768},[1594],[464,1770],{"className":1771,"style":610},[492],[464,1773,815],{"className":1774},[485,486],[464,1776,1431],{"className":1777},[1229],". There are ",[464,1780,1782],{"className":1781},[467],[464,1783,1785,1808,1835],{"className":1784,"ariaHidden":472},[471],[464,1786,1788,1791,1794,1797,1800,1805],{"className":1787},[476],[464,1789],{"className":1790,"style":1210},[480],[464,1792,1392],{"className":1793},[1217],[464,1795,649],{"className":1796},[485,486],[464,1798],{"className":1799,"style":676},[492],[464,1801,1804],{"className":1802},[1803],"mbin","+",[464,1806],{"className":1807,"style":676},[492],[464,1809,1811,1814,1817,1820,1823,1826,1829,1832],{"className":1810},[476],[464,1812],{"className":1813,"style":1210},[480],[464,1815,428],{"className":1816},[485],[464,1818,1431],{"className":1819},[1229],[464,1821,1392],{"className":1822},[1217],[464,1824,815],{"className":1825},[485,486],[464,1827],{"className":1828,"style":676},[492],[464,1830,1804],{"className":1831},[1803],[464,1833],{"className":1834,"style":676},[492],[464,1836,1838,1841,1844],{"className":1837},[476],[464,1839],{"className":1840,"style":1210},[480],[464,1842,428],{"className":1843},[485],[464,1845,1431],{"className":1846},[1229],"\nsubproblems, one per pair of prefix lengths ",[464,1849,1851],{"className":1850},[467],[464,1852,1854,1875,1894],{"className":1853,"ariaHidden":472},[471],[464,1855,1857,1861,1865,1868,1872],{"className":1856},[476],[464,1858],{"className":1859,"style":1860},[480],"height:0.7804em;vertical-align:-0.136em;",[464,1862,1864],{"className":1863},[485],"0",[464,1866],{"className":1867,"style":493},[492],[464,1869,1871],{"className":1870},[497],"≤",[464,1873],{"className":1874,"style":493},[492],[464,1876,1878,1882,1885,1888,1891],{"className":1877},[476],[464,1879],{"className":1880,"style":1881},[480],"height:0.7955em;vertical-align:-0.136em;",[464,1883,405],{"className":1884},[485,486],[464,1886],{"className":1887,"style":493},[492],[464,1889,1871],{"className":1890},[497],[464,1892],{"className":1893,"style":493},[492],[464,1895,1897,1901],{"className":1896},[476],[464,1898],{"className":1899,"style":1900},[480],"height:0.4306em;",[464,1902,649],{"className":1903},[485,486],[464,1905,1907],{"className":1906},[467],[464,1908,1910,1928,1947],{"className":1909,"ariaHidden":472},[471],[464,1911,1913,1916,1919,1922,1925],{"className":1912},[476],[464,1914],{"className":1915,"style":1860},[480],[464,1917,1864],{"className":1918},[485],[464,1920],{"className":1921,"style":493},[492],[464,1923,1871],{"className":1924},[497],[464,1926],{"className":1927,"style":493},[492],[464,1929,1931,1935,1938,1941,1944],{"className":1930},[476],[464,1932],{"className":1933,"style":1934},[480],"height:0.854em;vertical-align:-0.1944em;",[464,1936,1603],{"className":1937,"style":1602},[485,486],[464,1939],{"className":1940,"style":493},[492],[464,1942,1871],{"className":1943},[497],[464,1945],{"className":1946,"style":493},[492],[464,1948,1950,1953],{"className":1949},[476],[464,1951],{"className":1952,"style":1900},[480],[464,1954,815],{"className":1955},[485,486],[435,1957,1959],{"id":1958},"step-2-the-dp-equations","Step 2: The DP equations",[381,1961,1962,1963,1966,1967,1711,1991,1293,2015,2022,2023,2042],{},"Now apply optimal substructure by looking at the ",[411,1964,1965],{},"last"," characters, ",[464,1968,1970],{"className":1969},[467],[464,1971,1973],{"className":1972,"ariaHidden":472},[471],[464,1974,1976,1979,1982,1985,1988],{"className":1975},[476],[464,1977],{"className":1978,"style":1210},[480],[464,1980,1078],{"className":1981},[485,486],[464,1983,1218],{"className":1984},[1217],[464,1986,405],{"className":1987},[485,486],[464,1989,1230],{"className":1990},[1229],[464,1992,1994],{"className":1993},[467],[464,1995,1997],{"className":1996,"ariaHidden":472},[471],[464,1998,2000,2003,2006,2009,2012],{"className":1999},[476],[464,2001],{"className":2002,"style":1210},[480],[464,2004,1535],{"className":2005,"style":1534},[485,486],[464,2007,1218],{"className":2008},[1217],[464,2010,1603],{"className":2011,"style":1602},[485,486],[464,2013,1230],{"className":2014},[1229],[420,2016,2017],{},[395,2018,595],{"href":2019,"ariaDescribedBy":2020,"dataFootnoteRef":376,"id":2021},"#user-content-fn-clrs-lcs",[426],"user-content-fnref-clrs-lcs"," Write the recurrence as a single ",[464,2024,2026],{"className":2025},[467],[464,2027,2029],{"className":2028,"ariaHidden":472},[471],[464,2030,2032,2035],{"className":2031},[476],[464,2033],{"className":2034,"style":1900},[480],[464,2036,2038],{"className":2037},[1579],[464,2039,2041],{"className":2040},[485,1583],"max"," over three cases,\nplus a base case:",[464,2044,2047],{"className":2045},[2046],"katex-display",[464,2048,2050],{"className":2049},[467],[464,2051,2053,2092],{"className":2052,"ariaHidden":472},[471],[464,2054,2056,2059,2065,2068,2071,2074,2077,2080,2083,2086,2089],{"className":2055},[476],[464,2057],{"className":2058,"style":1210},[480],[464,2060,2062],{"className":2061},[1579],[464,2063,1584],{"className":2064},[485,1583],[464,2066,1392],{"className":2067},[1217],[464,2069,405],{"className":2070},[485,486],[464,2072,1595],{"className":2073},[1594],[464,2075],{"className":2076,"style":610},[492],[464,2078,1603],{"className":2079,"style":1602},[485,486],[464,2081,1431],{"className":2082},[1229],[464,2084],{"className":2085,"style":493},[492],[464,2087,498],{"className":2088},[497],[464,2090],{"className":2091,"style":493},[492],[464,2093,2095,2099],{"className":2094},[476],[464,2096],{"className":2097,"style":2098},[480],"height:6.36em;vertical-align:-2.93em;",[464,2100,2102,2201,2805],{"className":2101},[614],[464,2103,2105],{"className":2104},[1217],[464,2106,2109],{"className":2107},[1636,2108],"mult",[464,2110,2112,2192],{"className":2111},[523,524],[464,2113,2115,2189],{"className":2114},[528],[464,2116,2119,2134,2153,2165,2177],{"className":2117,"style":2118},[532],"height:3.25em;",[464,2120,2122,2126],{"style":2121},"top:-1.366em;",[464,2123],{"className":2124,"style":2125},[540],"height:3.216em;",[464,2127,2131],{"className":2128},[2129,2130],"delimsizinginner","delim-size4",[464,2132,2133],{},"⎩",[464,2135,2137,2140],{"style":2136},"top:-1.358em;",[464,2138],{"className":2139,"style":2125},[540],[464,2141,2143],{"style":2142},"height:1.216em;width:0.8889em;",[846,2144,2150],{"xmlns":848,"width":2145,"height":2146,"style":2147,"viewBox":2148,"preserveAspectRatio":2149},"0.8889em","1.216em","width:0.8889em","0 0 888.89 1216","xMinYMin",[864,2151],{"d":2152},"M384 0 H504 V1216 H384z M384 0 H504 V1216 H384z",[464,2154,2156,2159],{"style":2155},"top:-3.216em;",[464,2157],{"className":2158,"style":2125},[540],[464,2160,2162],{"className":2161},[2129,2130],[464,2163,2164],{},"⎨",[464,2166,2168,2171],{"style":2167},"top:-4.358em;",[464,2169],{"className":2170,"style":2125},[540],[464,2172,2173],{"style":2142},[846,2174,2175],{"xmlns":848,"width":2145,"height":2146,"style":2147,"viewBox":2148,"preserveAspectRatio":2149},[864,2176],{"d":2152},[464,2178,2180,2183],{"style":2179},"top:-5.566em;",[464,2181],{"className":2182,"style":2125},[540],[464,2184,2186],{"className":2185},[2129,2130],[464,2187,2188],{},"⎧",[464,2190,556],{"className":2191},[555],[464,2193,2195],{"className":2194},[528],[464,2196,2199],{"className":2197,"style":2198},[532],"height:2.75em;",[464,2200],{},[464,2202,2204],{"className":2203},[485],[464,2205,2208,2672,2675],{"className":2206},[2207],"mtable",[464,2209,2212],{"className":2210},[2211],"col-align-l",[464,2213,2215,2663],{"className":2214},[523,524],[464,2216,2218,2660],{"className":2217},[528],[464,2219,2222,2235],{"className":2220,"style":2221},[532],"height:3.43em;",[464,2223,2225,2229],{"style":2224},"top:-6.832em;",[464,2226],{"className":2227,"style":2228},[540],"height:4.41em;",[464,2230,2232],{"className":2231},[485],[464,2233,1864],{"className":2234},[485],[464,2236,2238,2241],{"style":2237},"top:-3.39em;",[464,2239],{"className":2240,"style":2228},[540],[464,2242,2244,2250,2253],{"className":2243},[485],[464,2245,2247],{"className":2246},[1579],[464,2248,2041],{"className":2249},[485,1583],[464,2251],{"className":2252,"style":610},[492],[464,2254,2256,2346,2656],{"className":2255},[614],[464,2257,2259],{"className":2258},[1217],[464,2260,2262],{"className":2261},[1636,2108],[464,2263,2265,2337],{"className":2264},[523,524],[464,2266,2268,2334],{"className":2267},[528],[464,2269,2272,2284,2300,2311,2323],{"className":2270,"style":2271},[532],"height:2.35em;",[464,2273,2275,2279],{"style":2274},"top:-2.2em;",[464,2276],{"className":2277,"style":2278},[540],"height:3.15em;",[464,2280,2282],{"className":2281},[2129,2130],[464,2283,2133],{},[464,2285,2287,2290],{"style":2286},"top:-2.192em;",[464,2288],{"className":2289,"style":2278},[540],[464,2291,2293],{"style":2292},"height:0.316em;width:0.8889em;",[846,2294,2297],{"xmlns":848,"width":2145,"height":2295,"style":2147,"viewBox":2296,"preserveAspectRatio":2149},"0.316em","0 0 888.89 316",[864,2298],{"d":2299},"M384 0 H504 V316 H384z M384 0 H504 V316 H384z",[464,2301,2303,2306],{"style":2302},"top:-3.15em;",[464,2304],{"className":2305,"style":2278},[540],[464,2307,2309],{"className":2308},[2129,2130],[464,2310,2164],{},[464,2312,2314,2317],{"style":2313},"top:-4.292em;",[464,2315],{"className":2316,"style":2278},[540],[464,2318,2319],{"style":2292},[846,2320,2321],{"xmlns":848,"width":2145,"height":2295,"style":2147,"viewBox":2296,"preserveAspectRatio":2149},[864,2322],{"d":2299},[464,2324,2326,2329],{"style":2325},"top:-4.6em;",[464,2327],{"className":2328,"style":2278},[540],[464,2330,2332],{"className":2331},[2129,2130],[464,2333,2188],{},[464,2335,556],{"className":2336},[555],[464,2338,2340],{"className":2339},[528],[464,2341,2344],{"className":2342,"style":2343},[532],"height:1.85em;",[464,2345],{},[464,2347,2349],{"className":2348},[485],[464,2350,2352,2538,2543],{"className":2351},[2207],[464,2353,2355],{"className":2354},[2211],[464,2356,2358,2529],{"className":2357},[523,524],[464,2359,2361,2526],{"className":2360},[528],[464,2362,2365,2412,2457],{"className":2363,"style":2364},[532],"height:2.41em;",[464,2366,2368,2372],{"style":2367},"top:-4.41em;",[464,2369],{"className":2370,"style":2371},[540],"height:3.008em;",[464,2373,2375,2381,2384,2387,2390,2394,2397,2400,2403,2406,2409],{"className":2374},[485],[464,2376,2378],{"className":2377},[1579],[464,2379,1584],{"className":2380},[485,1583],[464,2382,1392],{"className":2383},[1217],[464,2385,405],{"className":2386},[485,486],[464,2388],{"className":2389,"style":676},[492],[464,2391,2393],{"className":2392},[1803],"−",[464,2395],{"className":2396,"style":676},[492],[464,2398,428],{"className":2399},[485],[464,2401,1595],{"className":2402},[1594],[464,2404],{"className":2405,"style":610},[492],[464,2407,1603],{"className":2408,"style":1602},[485,486],[464,2410,1431],{"className":2411},[1229],[464,2413,2415,2418],{"style":2414},"top:-2.97em;",[464,2416],{"className":2417,"style":2371},[540],[464,2419,2421,2427,2430,2433,2436,2439,2442,2445,2448,2451,2454],{"className":2420},[485],[464,2422,2424],{"className":2423},[1579],[464,2425,1584],{"className":2426},[485,1583],[464,2428,1392],{"className":2429},[1217],[464,2431,405],{"className":2432},[485,486],[464,2434,1595],{"className":2435},[1594],[464,2437],{"className":2438,"style":610},[492],[464,2440,1603],{"className":2441,"style":1602},[485,486],[464,2443],{"className":2444,"style":676},[492],[464,2446,2393],{"className":2447},[1803],[464,2449],{"className":2450,"style":676},[492],[464,2452,428],{"className":2453},[485],[464,2455,1431],{"className":2456},[1229],[464,2458,2460,2463],{"style":2459},"top:-1.53em;",[464,2461],{"className":2462,"style":2371},[540],[464,2464,2466,2472,2475,2478,2481,2484,2487,2490,2493,2496,2499,2502,2505,2508,2511,2514,2517,2520,2523],{"className":2465},[485],[464,2467,2469],{"className":2468},[1579],[464,2470,1584],{"className":2471},[485,1583],[464,2473,1392],{"className":2474},[1217],[464,2476,405],{"className":2477},[485,486],[464,2479],{"className":2480,"style":676},[492],[464,2482,2393],{"className":2483},[1803],[464,2485],{"className":2486,"style":676},[492],[464,2488,428],{"className":2489},[485],[464,2491,1595],{"className":2492},[1594],[464,2494],{"className":2495,"style":610},[492],[464,2497,1603],{"className":2498,"style":1602},[485,486],[464,2500],{"className":2501,"style":676},[492],[464,2503,2393],{"className":2504},[1803],[464,2506],{"className":2507,"style":676},[492],[464,2509,428],{"className":2510},[485],[464,2512,1431],{"className":2513},[1229],[464,2515],{"className":2516,"style":676},[492],[464,2518,1804],{"className":2519},[1803],[464,2521],{"className":2522,"style":676},[492],[464,2524,428],{"className":2525},[485],[464,2527,556],{"className":2528},[555],[464,2530,2532],{"className":2531},[528],[464,2533,2536],{"className":2534,"style":2535},[532],"height:1.91em;",[464,2537],{},[464,2539],{"className":2540,"style":2542},[2541],"arraycolsep","width:1em;",[464,2544,2546],{"className":2545},[2211],[464,2547,2549,2648],{"className":2548},[523,524],[464,2550,2552,2645],{"className":2551},[528],[464,2553,2555,2571,2586],{"className":2554,"style":2364},[532],[464,2556,2557,2560],{"style":2367},[464,2558],{"className":2559,"style":2371},[540],[464,2561,2563],{"className":2562},[485],[464,2564,2567],{"className":2565},[485,2566],"text",[464,2568,2570],{"className":2569},[485],"(case 1)",[464,2572,2573,2576],{"style":2414},[464,2574],{"className":2575,"style":2371},[540],[464,2577,2579],{"className":2578},[485],[464,2580,2582],{"className":2581},[485,2566],[464,2583,2585],{"className":2584},[485],"(case 2)",[464,2587,2588,2591],{"style":2459},[464,2589],{"className":2590,"style":2371},[540],[464,2592,2594,2601,2604,2607,2610,2613,2616,2619,2622,2625,2628,2631,2634,2638],{"className":2593},[485],[464,2595,2597],{"className":2596},[485,2566],[464,2598,2600],{"className":2599},[485],"if ",[464,2602,1078],{"className":2603},[485,486],[464,2605,1218],{"className":2606},[1217],[464,2608,405],{"className":2609},[485,486],[464,2611,1230],{"className":2612},[1229],[464,2614],{"className":2615,"style":493},[492],[464,2617,498],{"className":2618},[497],[464,2620],{"className":2621,"style":493},[492],[464,2623,1535],{"className":2624,"style":1534},[485,486],[464,2626,1218],{"className":2627},[1217],[464,2629,1603],{"className":2630,"style":1602},[485,486],[464,2632,1230],{"className":2633},[1229],[464,2635],{"className":2636,"style":2637},[492],"margin-right:1em;",[464,2639,2641],{"className":2640},[485,2566],[464,2642,2644],{"className":2643},[485],"(case 3)",[464,2646,556],{"className":2647},[555],[464,2649,2651],{"className":2650},[528],[464,2652,2654],{"className":2653,"style":2535},[532],[464,2655],{},[464,2657],{"className":2658},[1229,2659],"nulldelimiter",[464,2661,556],{"className":2662},[555],[464,2664,2666],{"className":2665},[528],[464,2667,2670],{"className":2668,"style":2669},[532],"height:2.93em;",[464,2671],{},[464,2673],{"className":2674,"style":2542},[2541],[464,2676,2678],{"className":2677},[2211],[464,2679,2681,2797],{"className":2680},[523,524],[464,2682,2684,2794],{"className":2683},[528],[464,2685,2687,2754],{"className":2686,"style":2221},[532],[464,2688,2689,2692],{"style":2224},[464,2690],{"className":2691,"style":2228},[540],[464,2693,2695,2701,2704,2707,2710,2713,2716,2723,2726,2729,2732,2735,2738,2741,2744,2747],{"className":2694},[485],[464,2696,2698],{"className":2697},[485,2566],[464,2699,2600],{"className":2700},[485],[464,2702,405],{"className":2703},[485,486],[464,2705],{"className":2706,"style":493},[492],[464,2708,498],{"className":2709},[497],[464,2711],{"className":2712,"style":493},[492],[464,2714,1864],{"className":2715},[485],[464,2717,2719],{"className":2718},[485,2566],[464,2720,2722],{"className":2721},[485]," or ",[464,2724,1603],{"className":2725,"style":1602},[485,486],[464,2727],{"className":2728,"style":493},[492],[464,2730,498],{"className":2731},[497],[464,2733],{"className":2734,"style":493},[492],[464,2736,1864],{"className":2737},[485],[464,2739,1595],{"className":2740},[1594],[464,2742],{"className":2743,"style":2637},[492],[464,2745],{"className":2746,"style":610},[492],[464,2748,2750],{"className":2749},[485,2566],[464,2751,2753],{"className":2752},[485],"(case 0)",[464,2755,2756,2759],{"style":2237},[464,2757],{"className":2758,"style":2228},[540],[464,2760,2762,2768,2771,2774,2777,2780,2783,2787,2790],{"className":2761},[485],[464,2763,2765],{"className":2764},[485,2566],[464,2766,2600],{"className":2767},[485],[464,2769,405],{"className":2770},[485,486],[464,2772,1595],{"className":2773},[1594],[464,2775],{"className":2776,"style":610},[492],[464,2778,1603],{"className":2779,"style":1602},[485,486],[464,2781],{"className":2782,"style":493},[492],[464,2784,2786],{"className":2785},[497],">",[464,2788],{"className":2789,"style":493},[492],[464,2791,2793],{"className":2792},[485],"0.",[464,2795,556],{"className":2796},[555],[464,2798,2800],{"className":2799},[528],[464,2801,2803],{"className":2802,"style":2669},[532],[464,2804],{},[464,2806],{"className":2807},[1229,2659],[381,2809,2810],{},"Read the three branches as moves on the prefixes:",[2812,2813,2814,3068,3191],"ul",{},[2815,2816,2817,2820,2821,2845,2846,388,2891,2918,2919,388,2946,2973,2974,1293],"li",{},[411,2818,2819],{},"Case 1"," drops ",[464,2822,2824],{"className":2823},[467],[464,2825,2827],{"className":2826,"ariaHidden":472},[471],[464,2828,2830,2833,2836,2839,2842],{"className":2829},[476],[464,2831],{"className":2832,"style":1210},[480],[464,2834,1078],{"className":2835},[485,486],[464,2837,1218],{"className":2838},[1217],[464,2840,405],{"className":2841},[485,486],[464,2843,1230],{"className":2844},[1229],": an LCS of ",[464,2847,2849],{"className":2848},[467],[464,2850,2852,2879],{"className":2851,"ariaHidden":472},[471],[464,2853,2855,2858,2861,2864,2867,2870,2873,2876],{"className":2854},[476],[464,2856],{"className":2857,"style":1210},[480],[464,2859,1078],{"className":2860},[485,486],[464,2862,1218],{"className":2863},[1217],[464,2865,1222],{"className":2866},[485],[464,2868,405],{"className":2869},[485,486],[464,2871],{"className":2872,"style":676},[492],[464,2874,2393],{"className":2875},[1803],[464,2877],{"className":2878,"style":676},[492],[464,2880,2882,2885,2888],{"className":2881},[476],[464,2883],{"className":2884,"style":1210},[480],[464,2886,428],{"className":2887},[485],[464,2889,1230],{"className":2890},[1229],[464,2892,2894],{"className":2893},[467],[464,2895,2897],{"className":2896,"ariaHidden":472},[471],[464,2898,2900,2903,2906,2909,2912,2915],{"className":2899},[476],[464,2901],{"className":2902,"style":1210},[480],[464,2904,1535],{"className":2905,"style":1534},[485,486],[464,2907,1218],{"className":2908},[1217],[464,2910,1222],{"className":2911},[485],[464,2913,1603],{"className":2914,"style":1602},[485,486],[464,2916,1230],{"className":2917},[1229]," is a common\nsubsequence of ",[464,2920,2922],{"className":2921},[467],[464,2923,2925],{"className":2924,"ariaHidden":472},[471],[464,2926,2928,2931,2934,2937,2940,2943],{"className":2927},[476],[464,2929],{"className":2930,"style":1210},[480],[464,2932,1078],{"className":2933},[485,486],[464,2935,1218],{"className":2936},[1217],[464,2938,1222],{"className":2939},[485],[464,2941,405],{"className":2942},[485,486],[464,2944,1230],{"className":2945},[1229],[464,2947,2949],{"className":2948},[467],[464,2950,2952],{"className":2951,"ariaHidden":472},[471],[464,2953,2955,2958,2961,2964,2967,2970],{"className":2954},[476],[464,2956],{"className":2957,"style":1210},[480],[464,2959,1535],{"className":2960,"style":1534},[485,486],[464,2962,1218],{"className":2963},[1217],[464,2965,1222],{"className":2966},[485],[464,2968,1603],{"className":2969,"style":1602},[485,486],[464,2971,1230],{"className":2972},[1229],", so ",[464,2975,2977],{"className":2976},[467],[464,2978,2980,3020,3047],{"className":2979,"ariaHidden":472},[471],[464,2981,2983,2986,2992,2995,2998,3001,3004,3007,3010,3013,3017],{"className":2982},[476],[464,2984],{"className":2985,"style":1210},[480],[464,2987,2989],{"className":2988},[1579],[464,2990,1584],{"className":2991},[485,1583],[464,2993,1392],{"className":2994},[1217],[464,2996,405],{"className":2997},[485,486],[464,2999,1595],{"className":3000},[1594],[464,3002],{"className":3003,"style":610},[492],[464,3005,1603],{"className":3006,"style":1602},[485,486],[464,3008,1431],{"className":3009},[1229],[464,3011],{"className":3012,"style":493},[492],[464,3014,3016],{"className":3015},[497],"≥",[464,3018],{"className":3019,"style":493},[492],[464,3021,3023,3026,3032,3035,3038,3041,3044],{"className":3022},[476],[464,3024],{"className":3025,"style":1210},[480],[464,3027,3029],{"className":3028},[1579],[464,3030,1584],{"className":3031},[485,1583],[464,3033,1392],{"className":3034},[1217],[464,3036,405],{"className":3037},[485,486],[464,3039],{"className":3040,"style":676},[492],[464,3042,2393],{"className":3043},[1803],[464,3045],{"className":3046,"style":676},[492],[464,3048,3050,3053,3056,3059,3062,3065],{"className":3049},[476],[464,3051],{"className":3052,"style":1210},[480],[464,3054,428],{"className":3055},[485],[464,3057,1595],{"className":3058},[1594],[464,3060],{"className":3061,"style":610},[492],[464,3063,1603],{"className":3064,"style":1602},[485,486],[464,3066,1431],{"className":3067},[1229],[2815,3069,3070,2820,3073,3097,3098,1293],{},[411,3071,3072],{},"Case 2",[464,3074,3076],{"className":3075},[467],[464,3077,3079],{"className":3078,"ariaHidden":472},[471],[464,3080,3082,3085,3088,3091,3094],{"className":3081},[476],[464,3083],{"className":3084,"style":1210},[480],[464,3086,1535],{"className":3087,"style":1534},[485,486],[464,3089,1218],{"className":3090},[1217],[464,3092,1603],{"className":3093,"style":1602},[485,486],[464,3095,1230],{"className":3096},[1229]," symmetrically, so ",[464,3099,3101],{"className":3100},[467],[464,3102,3104,3143,3179],{"className":3103,"ariaHidden":472},[471],[464,3105,3107,3110,3116,3119,3122,3125,3128,3131,3134,3137,3140],{"className":3106},[476],[464,3108],{"className":3109,"style":1210},[480],[464,3111,3113],{"className":3112},[1579],[464,3114,1584],{"className":3115},[485,1583],[464,3117,1392],{"className":3118},[1217],[464,3120,405],{"className":3121},[485,486],[464,3123,1595],{"className":3124},[1594],[464,3126],{"className":3127,"style":610},[492],[464,3129,1603],{"className":3130,"style":1602},[485,486],[464,3132,1431],{"className":3133},[1229],[464,3135],{"className":3136,"style":493},[492],[464,3138,3016],{"className":3139},[497],[464,3141],{"className":3142,"style":493},[492],[464,3144,3146,3149,3155,3158,3161,3164,3167,3170,3173,3176],{"className":3145},[476],[464,3147],{"className":3148,"style":1210},[480],[464,3150,3152],{"className":3151},[1579],[464,3153,1584],{"className":3154},[485,1583],[464,3156,1392],{"className":3157},[1217],[464,3159,405],{"className":3160},[485,486],[464,3162,1595],{"className":3163},[1594],[464,3165],{"className":3166,"style":610},[492],[464,3168,1603],{"className":3169,"style":1602},[485,486],[464,3171],{"className":3172,"style":676},[492],[464,3174,2393],{"className":3175},[1803],[464,3177],{"className":3178,"style":676},[492],[464,3180,3182,3185,3188],{"className":3181},[476],[464,3183],{"className":3184,"style":1210},[480],[464,3186,428],{"className":3187},[485],[464,3189,1431],{"className":3190},[1229],[2815,3192,3193,3196,3197,3200,3201,3252,3253,3322,3323,1293],{},[411,3194,3195],{},"Case 3"," fires ",[447,3198,3199],{},"only when"," ",[464,3202,3204],{"className":3203},[467],[464,3205,3207,3234],{"className":3206,"ariaHidden":472},[471],[464,3208,3210,3213,3216,3219,3222,3225,3228,3231],{"className":3209},[476],[464,3211],{"className":3212,"style":1210},[480],[464,3214,1078],{"className":3215},[485,486],[464,3217,1218],{"className":3218},[1217],[464,3220,405],{"className":3221},[485,486],[464,3223,1230],{"className":3224},[1229],[464,3226],{"className":3227,"style":493},[492],[464,3229,498],{"className":3230},[497],[464,3232],{"className":3233,"style":493},[492],[464,3235,3237,3240,3243,3246,3249],{"className":3236},[476],[464,3238],{"className":3239,"style":1210},[480],[464,3241,1535],{"className":3242,"style":1534},[485,486],[464,3244,1218],{"className":3245},[1217],[464,3247,1603],{"className":3248,"style":1602},[485,486],[464,3250,1230],{"className":3251},[1229],": the shared character ",[464,3254,3256],{"className":3255},[467],[464,3257,3259,3277,3304],{"className":3258,"ariaHidden":472},[471],[464,3260,3262,3265,3268,3271,3274],{"className":3261},[476],[464,3263],{"className":3264,"style":1900},[480],[464,3266,408],{"className":3267},[485,486],[464,3269],{"className":3270,"style":493},[492],[464,3272,498],{"className":3273},[497],[464,3275],{"className":3276,"style":493},[492],[464,3278,3280,3283,3286,3289,3292,3295,3298,3301],{"className":3279},[476],[464,3281],{"className":3282,"style":1210},[480],[464,3284,1078],{"className":3285},[485,486],[464,3287,1218],{"className":3288},[1217],[464,3290,405],{"className":3291},[485,486],[464,3293,1230],{"className":3294},[1229],[464,3296],{"className":3297,"style":493},[492],[464,3299,498],{"className":3300},[497],[464,3302],{"className":3303,"style":493},[492],[464,3305,3307,3310,3313,3316,3319],{"className":3306},[476],[464,3308],{"className":3309,"style":1210},[480],[464,3311,1535],{"className":3312,"style":1534},[485,486],[464,3314,1218],{"className":3315},[1217],[464,3317,1603],{"className":3318,"style":1602},[485,486],[464,3320,1230],{"className":3321},[1229],"\ncan end an optimal LCS, so we append it to the best LCS of the strictly shorter\nprefixes, giving ",[464,3324,3326],{"className":3325},[467],[464,3327,3329,3368,3395,3422,3443],{"className":3328,"ariaHidden":472},[471],[464,3330,3332,3335,3341,3344,3347,3350,3353,3356,3359,3362,3365],{"className":3331},[476],[464,3333],{"className":3334,"style":1210},[480],[464,3336,3338],{"className":3337},[1579],[464,3339,1584],{"className":3340},[485,1583],[464,3342,1392],{"className":3343},[1217],[464,3345,405],{"className":3346},[485,486],[464,3348,1595],{"className":3349},[1594],[464,3351],{"className":3352,"style":610},[492],[464,3354,1603],{"className":3355,"style":1602},[485,486],[464,3357,1431],{"className":3358},[1229],[464,3360],{"className":3361,"style":493},[492],[464,3363,3016],{"className":3364},[497],[464,3366],{"className":3367,"style":493},[492],[464,3369,3371,3374,3380,3383,3386,3389,3392],{"className":3370},[476],[464,3372],{"className":3373,"style":1210},[480],[464,3375,3377],{"className":3376},[1579],[464,3378,1584],{"className":3379},[485,1583],[464,3381,1392],{"className":3382},[1217],[464,3384,405],{"className":3385},[485,486],[464,3387],{"className":3388,"style":676},[492],[464,3390,2393],{"className":3391},[1803],[464,3393],{"className":3394,"style":676},[492],[464,3396,3398,3401,3404,3407,3410,3413,3416,3419],{"className":3397},[476],[464,3399],{"className":3400,"style":1934},[480],[464,3402,428],{"className":3403},[485],[464,3405,1595],{"className":3406},[1594],[464,3408],{"className":3409,"style":610},[492],[464,3411,1603],{"className":3412,"style":1602},[485,486],[464,3414],{"className":3415,"style":676},[492],[464,3417,2393],{"className":3418},[1803],[464,3420],{"className":3421,"style":676},[492],[464,3423,3425,3428,3431,3434,3437,3440],{"className":3424},[476],[464,3426],{"className":3427,"style":1210},[480],[464,3429,428],{"className":3430},[485],[464,3432,1431],{"className":3433},[1229],[464,3435],{"className":3436,"style":676},[492],[464,3438,1804],{"className":3439},[1803],[464,3441],{"className":3442,"style":676},[492],[464,3444,3446,3450],{"className":3445},[476],[464,3447],{"className":3448,"style":3449},[480],"height:0.6444em;",[464,3451,428],{"className":3452},[485],[381,3454,3455,3456,1711,3483,3510,3511,3535,3536,3560,3561,3612,3613,3631,3632,3724,3725,1293],{},"Why exactly these three? Because every common subsequence of ",[464,3457,3459],{"className":3458},[467],[464,3460,3462],{"className":3461,"ariaHidden":472},[471],[464,3463,3465,3468,3471,3474,3477,3480],{"className":3464},[476],[464,3466],{"className":3467,"style":1210},[480],[464,3469,1078],{"className":3470},[485,486],[464,3472,1218],{"className":3473},[1217],[464,3475,1222],{"className":3476},[485],[464,3478,405],{"className":3479},[485,486],[464,3481,1230],{"className":3482},[1229],[464,3484,3486],{"className":3485},[467],[464,3487,3489],{"className":3488,"ariaHidden":472},[471],[464,3490,3492,3495,3498,3501,3504,3507],{"className":3491},[476],[464,3493],{"className":3494,"style":1210},[480],[464,3496,1535],{"className":3497,"style":1534},[485,486],[464,3499,1218],{"className":3500},[1217],[464,3502,1222],{"className":3503},[485],[464,3505,1603],{"className":3506,"style":1602},[485,486],[464,3508,1230],{"className":3509},[1229]," falls into one of three shapes: it ignores ",[464,3512,3514],{"className":3513},[467],[464,3515,3517],{"className":3516,"ariaHidden":472},[471],[464,3518,3520,3523,3526,3529,3532],{"className":3519},[476],[464,3521],{"className":3522,"style":1210},[480],[464,3524,1078],{"className":3525},[485,486],[464,3527,1218],{"className":3528},[1217],[464,3530,405],{"className":3531},[485,486],[464,3533,1230],{"className":3534},[1229]," (case 1), ignores\n",[464,3537,3539],{"className":3538},[467],[464,3540,3542],{"className":3541,"ariaHidden":472},[471],[464,3543,3545,3548,3551,3554,3557],{"className":3544},[476],[464,3546],{"className":3547,"style":1210},[480],[464,3549,1535],{"className":3550,"style":1534},[485,486],[464,3552,1218],{"className":3553},[1217],[464,3555,1603],{"className":3556,"style":1602},[485,486],[464,3558,1230],{"className":3559},[1229]," (case 2), or uses both as a final match (case 3, possible only if\n",[464,3562,3564],{"className":3563},[467],[464,3565,3567,3594],{"className":3566,"ariaHidden":472},[471],[464,3568,3570,3573,3576,3579,3582,3585,3588,3591],{"className":3569},[476],[464,3571],{"className":3572,"style":1210},[480],[464,3574,1078],{"className":3575},[485,486],[464,3577,1218],{"className":3578},[1217],[464,3580,405],{"className":3581},[485,486],[464,3583,1230],{"className":3584},[1229],[464,3586],{"className":3587,"style":493},[492],[464,3589,498],{"className":3590},[497],[464,3592],{"className":3593,"style":493},[492],[464,3595,3597,3600,3603,3606,3609],{"className":3596},[476],[464,3598],{"className":3599,"style":1210},[480],[464,3601,1535],{"className":3602,"style":1534},[485,486],[464,3604,1218],{"className":3605},[1217],[464,3607,1603],{"className":3608,"style":1602},[485,486],[464,3610,1230],{"className":3611},[1229],"). The ",[464,3614,3616],{"className":3615},[467],[464,3617,3619],{"className":3618,"ariaHidden":472},[471],[464,3620,3622,3625],{"className":3621},[476],[464,3623],{"className":3624,"style":1900},[480],[464,3626,3628],{"className":3627},[1579],[464,3629,2041],{"className":3630},[485,1583]," over the applicable cases is the longest of them. Note\nthat when ",[464,3633,3635],{"className":3634},[467],[464,3636,3638,3706],{"className":3637,"ariaHidden":472},[471],[464,3639,3641,3644,3647,3650,3653,3656,3659,3703],{"className":3640},[476],[464,3642],{"className":3643,"style":1210},[480],[464,3645,1078],{"className":3646},[485,486],[464,3648,1218],{"className":3649},[1217],[464,3651,405],{"className":3652},[485,486],[464,3654,1230],{"className":3655},[1229],[464,3657],{"className":3658,"style":493},[492],[464,3660,3662,3696,3700],{"className":3661},[497],[464,3663,3665],{"className":3664},[497],[464,3666,3669],{"className":3667},[485,3668],"vbox",[464,3670,3673],{"className":3671},[3672],"thinbox",[464,3674,3677,3681,3692],{"className":3675},[3676],"rlap",[464,3678],{"className":3679,"style":3680},[480],"height:0.8889em;vertical-align:-0.1944em;",[464,3682,3685],{"className":3683},[3684],"inner",[464,3686,3688],{"className":3687},[485],[464,3689,3691],{"className":3690},[497],"",[464,3693],{"className":3694},[3695],"fix",[464,3697],{"className":3698},[492,3699],"nobreak",[464,3701,498],{"className":3702},[497],[464,3704],{"className":3705,"style":493},[492],[464,3707,3709,3712,3715,3718,3721],{"className":3708},[476],[464,3710],{"className":3711,"style":1210},[480],[464,3713,1535],{"className":3714,"style":1534},[485,486],[464,3716,1218],{"className":3717},[1217],[464,3719,1603],{"className":3720,"style":1602},[485,486],[464,3722,1230],{"className":3723},[1229],", only cases 1 and 2 apply, and the recurrence collapses\nto ",[464,3726,3728],{"className":3727},[467],[464,3729,3731,3770,3830],{"className":3730,"ariaHidden":472},[471],[464,3732,3734,3737,3743,3749,3755,3758,3761,3764,3767],{"className":3733},[476],[464,3735],{"className":3736,"style":1622},[480],[464,3738,3740],{"className":3739},[1579],[464,3741,2041],{"className":3742},[485,1583],[464,3744,3746],{"className":3745},[1217],[464,3747,1392],{"className":3748},[1636,1637],[464,3750,3752],{"className":3751},[1579],[464,3753,1584],{"className":3754},[485,1583],[464,3756,1392],{"className":3757},[1217],[464,3759,405],{"className":3760},[485,486],[464,3762],{"className":3763,"style":676},[492],[464,3765,2393],{"className":3766},[1803],[464,3768],{"className":3769,"style":676},[492],[464,3771,3773,3776,3779,3782,3785,3788,3791,3794,3797,3800,3806,3809,3812,3815,3818,3821,3824,3827],{"className":3772},[476],[464,3774],{"className":3775,"style":1210},[480],[464,3777,428],{"className":3778},[485],[464,3780,1595],{"className":3781},[1594],[464,3783],{"className":3784,"style":610},[492],[464,3786,1603],{"className":3787,"style":1602},[485,486],[464,3789,1431],{"className":3790},[1229],[464,3792,1595],{"className":3793},[1594],[464,3795],{"className":3796,"style":610},[492],[464,3798],{"className":3799,"style":610},[492],[464,3801,3803],{"className":3802},[1579],[464,3804,1584],{"className":3805},[485,1583],[464,3807,1392],{"className":3808},[1217],[464,3810,405],{"className":3811},[485,486],[464,3813,1595],{"className":3814},[1594],[464,3816],{"className":3817,"style":610},[492],[464,3819,1603],{"className":3820,"style":1602},[485,486],[464,3822],{"className":3823,"style":676},[492],[464,3825,2393],{"className":3826},[1803],[464,3828],{"className":3829,"style":676},[492],[464,3831,3833,3836,3839,3842],{"className":3832},[476],[464,3834],{"className":3835,"style":1622},[480],[464,3837,428],{"className":3838},[485],[464,3840,1431],{"className":3841},[1229],[464,3843,3845],{"className":3844},[1229],[464,3846,1431],{"className":3847},[1636,1637],[381,3849,3850,3851,3854,3855,3858],{},"Each entry depends only on its left, upper, and upper-left neighbors, so filling\nthe table ",[411,3852,3853],{},"row by row, left to right"," (or column by column) respects every\ndependency. The same three-neighbour stencil drives ",[447,3856,3857],{},"every"," sequence DP below:\nonly the labels on the arrows change.",[840,3860,3862,4134],{"className":3861},[843,844],[846,3863,3867],{"xmlns":848,"width":3864,"height":3865,"viewBox":3866},"186.718","135.649","-75 -75 140.039 101.737",[853,3868,3869,3872,3924,3927,3966,3969,4001,4031,4040,4048,4056,4095,4116],{"stroke":855,"style":856},[864,3870],{"fill":1028,"d":3871},"M-65.403-40.772h44.406V-72.07h-44.406Z",[853,3873,3875,3882,3888,3894,3900,3906,3912,3918],{"stroke":1028,"fontSize":3874},"9",[853,3876,3878],{"transform":3877},"translate(-21.203 2.25)",[864,3879],{"d":3880,"fill":855,"stroke":855,"className":3881,"style":869},"M-40.348-54.180Q-40.853-54.567-41.222-55.072Q-41.592-55.577-41.835-56.177Q-42.079-56.777-42.194-57.394Q-42.308-58.012-42.308-58.671Q-42.308-59.330-42.194-59.945Q-42.079-60.561-41.840-61.154Q-41.600-61.747-41.227-62.257Q-40.853-62.767-40.348-63.153Q-40.313-63.171-40.291-63.171L-40.212-63.171Q-40.124-63.171-40.124-63.070Q-40.124-63.035-40.159-63Q-40.721-62.477-41.066-61.771Q-41.411-61.066-41.559-60.284Q-41.706-59.502-41.706-58.671Q-41.706-58.047-41.627-57.463Q-41.548-56.878-41.370-56.311Q-41.192-55.744-40.893-55.243Q-40.594-54.742-40.159-54.334Q-40.124-54.298-40.124-54.259Q-40.124-54.162-40.212-54.162L-40.291-54.162Q-40.313-54.162-40.348-54.180",[868],[853,3883,3884],{"transform":3877},[864,3885],{"d":3886,"fill":855,"stroke":855,"className":3887,"style":869},"M-38.874-57.080Q-38.874-57.225-38.812-57.410L-38.065-59.348Q-37.955-59.647-37.955-59.866Q-37.955-60.139-38.144-60.139Q-38.496-60.139-38.731-59.778Q-38.966-59.418-39.071-58.987Q-39.089-58.904-39.164-58.904L-39.269-58.904Q-39.317-58.904-39.339-58.943Q-39.361-58.983-39.361-59.023Q-39.273-59.365-39.113-59.671Q-38.953-59.976-38.702-60.187Q-38.452-60.398-38.126-60.398Q-37.797-60.398-37.566-60.192Q-37.335-59.985-37.335-59.642Q-37.335-59.475-37.388-59.308L-38.135-57.375Q-38.241-57.089-38.254-56.852Q-38.254-56.751-38.208-56.667Q-38.162-56.584-38.056-56.584Q-37.705-56.584-37.469-56.942Q-37.234-57.300-37.129-57.735Q-37.120-57.766-37.096-57.790Q-37.072-57.814-37.037-57.814L-36.931-57.814Q-36.883-57.814-36.861-57.781Q-36.839-57.748-36.839-57.700Q-36.966-57.177-37.289-56.748Q-37.612-56.320-38.074-56.320Q-38.403-56.320-38.638-56.533Q-38.874-56.746-38.874-57.080M-37.850-61.866Q-37.850-62.064-37.687-62.217Q-37.524-62.371-37.327-62.371Q-37.177-62.371-37.076-62.275Q-36.975-62.178-36.975-62.028Q-36.975-61.822-37.133-61.672Q-37.291-61.523-37.489-61.523Q-37.639-61.523-37.744-61.620Q-37.850-61.716-37.850-61.866",[868],[853,3889,3890],{"transform":3877},[864,3891],{"d":3892,"fill":855,"stroke":855,"className":3893,"style":869},"M-30.202-58.473L-35.484-58.473Q-35.559-58.486-35.612-58.539Q-35.665-58.592-35.665-58.671Q-35.665-58.737-35.610-58.792Q-35.555-58.847-35.484-58.860L-30.202-58.860Q-30.132-58.847-30.081-58.796Q-30.031-58.746-30.031-58.671Q-30.031-58.504-30.202-58.473",[868],[853,3895,3896],{"transform":3877},[864,3897],{"d":3898,"fill":855,"stroke":855,"className":3899,"style":869},"M-25.336-56.421L-28.368-56.421L-28.368-56.737Q-27.217-56.737-27.217-57.032L-27.217-61.756Q-27.705-61.523-28.426-61.523L-28.426-61.839Q-27.296-61.839-26.734-62.415L-26.589-62.415Q-26.554-62.415-26.521-62.382Q-26.488-62.349-26.488-62.314L-26.488-57.032Q-26.488-56.737-25.336-56.737",[868],[853,3901,3902],{"transform":3877},[864,3903],{"d":3904,"fill":855,"stroke":855,"className":3905,"style":869},"M-23.717-54.817Q-23.717-54.857-23.682-54.892Q-23.357-55.204-23.177-55.610Q-22.996-56.017-22.996-56.465L-22.996-56.548Q-23.137-56.421-23.339-56.421Q-23.484-56.421-23.598-56.487Q-23.713-56.553-23.779-56.665Q-23.845-56.777-23.845-56.926Q-23.845-57.146-23.704-57.287Q-23.563-57.427-23.339-57.427Q-23.018-57.427-22.878-57.129Q-22.737-56.830-22.737-56.465Q-22.737-55.955-22.941-55.500Q-23.146-55.046-23.511-54.694Q-23.546-54.676-23.572-54.676Q-23.629-54.676-23.673-54.720Q-23.717-54.764-23.717-54.817",[868],[853,3907,3908],{"transform":3877},[864,3909],{"d":3910,"fill":855,"stroke":855,"className":3911,"style":869},"M-20.634-55.151Q-20.634-55.371-20.483-55.531Q-20.331-55.692-20.111-55.692Q-19.966-55.692-19.863-55.599Q-19.760-55.507-19.760-55.358Q-19.760-55.208-19.850-55.076Q-19.940-54.944-20.094-54.883Q-19.966-54.839-19.804-54.839Q-19.545-54.839-19.325-55.006Q-19.105-55.173-18.951-55.437Q-18.798-55.700-18.736-55.955L-17.888-59.348Q-17.835-59.546-17.835-59.743Q-17.835-60.139-18.094-60.139Q-18.499-60.139-18.798-59.787Q-19.096-59.436-19.294-58.961Q-19.312-58.904-19.364-58.904L-19.470-58.904Q-19.518-58.904-19.540-58.943Q-19.562-58.983-19.562-59.023Q-19.338-59.581-18.965-59.989Q-18.591-60.398-18.077-60.398Q-17.826-60.398-17.624-60.293Q-17.422-60.187-17.303-59.998Q-17.185-59.809-17.185-59.563Q-17.185-59.436-17.211-59.308L-18.059-55.916Q-18.156-55.546-18.424-55.237Q-18.692-54.927-19.061-54.751Q-19.430-54.575-19.821-54.575Q-20.120-54.575-20.377-54.720Q-20.634-54.865-20.634-55.151M-17.725-61.866Q-17.725-62.064-17.567-62.217Q-17.409-62.371-17.202-62.371Q-17.062-62.371-16.958-62.272Q-16.855-62.173-16.855-62.028Q-16.855-61.822-17.009-61.672Q-17.163-61.523-17.365-61.523Q-17.514-61.523-17.620-61.620Q-17.725-61.716-17.725-61.866",[868],[853,3913,3914],{"transform":3877},[864,3915],{"d":3916,"fill":855,"stroke":855,"className":3917,"style":869},"M-9.974-58.473L-15.256-58.473Q-15.331-58.486-15.384-58.539Q-15.437-58.592-15.437-58.671Q-15.437-58.737-15.382-58.792Q-15.327-58.847-15.256-58.860L-9.974-58.860Q-9.904-58.847-9.853-58.796Q-9.803-58.746-9.803-58.671Q-9.803-58.504-9.974-58.473",[868],[853,3919,3920],{"transform":3877},[864,3921],{"d":3922,"fill":855,"stroke":855,"className":3923,"style":869},"M-5.109-56.421L-8.141-56.421L-8.141-56.737Q-6.990-56.737-6.990-57.032L-6.990-61.756Q-7.478-61.523-8.199-61.523L-8.199-61.839Q-7.069-61.839-6.507-62.415L-6.362-62.415Q-6.327-62.415-6.294-62.382Q-6.261-62.349-6.261-62.314L-6.261-57.032Q-6.261-56.737-5.109-56.737L-5.109-56.421M-3.712-54.162L-3.795-54.162Q-3.883-54.162-3.883-54.259Q-3.883-54.298-3.848-54.334Q-3.013-55.107-2.653-56.241Q-2.292-57.375-2.292-58.671Q-2.292-59.291-2.371-59.882Q-2.451-60.473-2.631-61.031Q-2.811-61.589-3.112-62.097Q-3.413-62.604-3.848-63Q-3.883-63.035-3.883-63.070Q-3.883-63.171-3.795-63.171L-3.712-63.171Q-3.694-63.171-3.659-63.153Q-3.154-62.771-2.780-62.257Q-2.407-61.743-2.169-61.165Q-1.932-60.587-1.816-59.959Q-1.699-59.330-1.699-58.671Q-1.699-58.012-1.816-57.381Q-1.932-56.751-2.172-56.166Q-2.411-55.582-2.782-55.072Q-3.154-54.562-3.659-54.180Q-3.694-54.162-3.712-54.162",[868],[864,3925],{"fill":1028,"d":3926},"M-8.279-40.772H24.31V-72.07H-8.28Z",[853,3928,3929,3935,3940,3945,3950,3955,3960],{"stroke":1028,"fontSize":3874},[853,3930,3932],{"transform":3931},"translate(35.921 2.25)",[864,3933],{"d":3880,"fill":855,"stroke":855,"className":3934,"style":869},[868],[853,3936,3937],{"transform":3931},[864,3938],{"d":3886,"fill":855,"stroke":855,"className":3939,"style":869},[868],[853,3941,3942],{"transform":3931},[864,3943],{"d":3892,"fill":855,"stroke":855,"className":3944,"style":869},[868],[853,3946,3947],{"transform":3931},[864,3948],{"d":3898,"fill":855,"stroke":855,"className":3949,"style":869},[868],[853,3951,3952],{"transform":3931},[864,3953],{"d":3904,"fill":855,"stroke":855,"className":3954,"style":869},[868],[853,3956,3957],{"transform":3931},[864,3958],{"d":3910,"fill":855,"stroke":855,"className":3959,"style":869},[868],[853,3961,3962],{"transform":3931},[864,3963],{"d":3964,"fill":855,"stroke":855,"className":3965,"style":869},"M-15.524-54.162L-15.608-54.162Q-15.696-54.162-15.696-54.259Q-15.696-54.298-15.661-54.334Q-14.826-55.107-14.465-56.241Q-14.105-57.375-14.105-58.671Q-14.105-59.291-14.184-59.882Q-14.263-60.473-14.443-61.031Q-14.624-61.589-14.925-62.097Q-15.226-62.604-15.661-63Q-15.696-63.035-15.696-63.070Q-15.696-63.171-15.608-63.171L-15.524-63.171Q-15.507-63.171-15.472-63.153Q-14.966-62.771-14.593-62.257Q-14.219-61.743-13.982-61.165Q-13.745-60.587-13.628-59.959Q-13.512-59.330-13.512-58.671Q-13.512-58.012-13.628-57.381Q-13.745-56.751-13.984-56.166Q-14.224-55.582-14.595-55.072Q-14.966-54.562-15.472-54.180Q-15.507-54.162-15.524-54.162",[868],[864,3967],{"fill":1028,"d":3968},"M-59.494 10.443h32.587v-31.298h-32.587Z",[853,3970,3971,3977,3983,3989,3995],{"stroke":1028,"fontSize":3874},[853,3972,3974],{"transform":3973},"translate(-15.294 53.465)",[864,3975],{"d":3880,"fill":855,"stroke":855,"className":3976,"style":869},[868],[853,3978,3979],{"transform":3973},[864,3980],{"d":3981,"fill":855,"stroke":855,"className":3982,"style":869},"M-38.874-57.080Q-38.874-57.225-38.812-57.410L-38.065-59.348Q-37.955-59.647-37.955-59.866Q-37.955-60.139-38.144-60.139Q-38.496-60.139-38.731-59.778Q-38.966-59.418-39.071-58.987Q-39.089-58.904-39.164-58.904L-39.269-58.904Q-39.317-58.904-39.339-58.943Q-39.361-58.983-39.361-59.023Q-39.273-59.365-39.113-59.671Q-38.953-59.976-38.702-60.187Q-38.452-60.398-38.126-60.398Q-37.797-60.398-37.566-60.192Q-37.335-59.985-37.335-59.642Q-37.335-59.475-37.388-59.308L-38.135-57.375Q-38.241-57.089-38.254-56.852Q-38.254-56.751-38.208-56.667Q-38.162-56.584-38.056-56.584Q-37.705-56.584-37.469-56.942Q-37.234-57.300-37.129-57.735Q-37.120-57.766-37.096-57.790Q-37.072-57.814-37.037-57.814L-36.931-57.814Q-36.883-57.814-36.861-57.781Q-36.839-57.748-36.839-57.700Q-36.966-57.177-37.289-56.748Q-37.612-56.320-38.074-56.320Q-38.403-56.320-38.638-56.533Q-38.874-56.746-38.874-57.080M-37.850-61.866Q-37.850-62.064-37.687-62.217Q-37.524-62.371-37.327-62.371Q-37.177-62.371-37.076-62.275Q-36.975-62.178-36.975-62.028Q-36.975-61.822-37.133-61.672Q-37.291-61.523-37.489-61.523Q-37.639-61.523-37.744-61.620Q-37.850-61.716-37.850-61.866M-35.542-54.817Q-35.542-54.857-35.507-54.892Q-35.182-55.204-35.002-55.610Q-34.822-56.017-34.822-56.465L-34.822-56.548Q-34.962-56.421-35.165-56.421Q-35.310-56.421-35.424-56.487Q-35.538-56.553-35.604-56.665Q-35.670-56.777-35.670-56.926Q-35.670-57.146-35.529-57.287Q-35.389-57.427-35.165-57.427Q-34.844-57.427-34.703-57.129Q-34.562-56.830-34.562-56.465Q-34.562-55.955-34.767-55.500Q-34.971-55.046-35.336-54.694Q-35.371-54.676-35.397-54.676Q-35.455-54.676-35.499-54.720Q-35.542-54.764-35.542-54.817",[868],[853,3984,3985],{"transform":3973},[864,3986],{"d":3987,"fill":855,"stroke":855,"className":3988,"style":869},"M-32.454-55.151Q-32.454-55.371-32.303-55.531Q-32.151-55.692-31.931-55.692Q-31.786-55.692-31.683-55.599Q-31.580-55.507-31.580-55.358Q-31.580-55.208-31.670-55.076Q-31.760-54.944-31.914-54.883Q-31.786-54.839-31.624-54.839Q-31.365-54.839-31.145-55.006Q-30.925-55.173-30.771-55.437Q-30.618-55.700-30.556-55.955L-29.708-59.348Q-29.655-59.546-29.655-59.743Q-29.655-60.139-29.914-60.139Q-30.319-60.139-30.618-59.787Q-30.916-59.436-31.114-58.961Q-31.132-58.904-31.184-58.904L-31.290-58.904Q-31.338-58.904-31.360-58.943Q-31.382-58.983-31.382-59.023Q-31.158-59.581-30.785-59.989Q-30.411-60.398-29.897-60.398Q-29.646-60.398-29.444-60.293Q-29.242-60.187-29.123-59.998Q-29.005-59.809-29.005-59.563Q-29.005-59.436-29.031-59.308L-29.879-55.916Q-29.976-55.546-30.244-55.237Q-30.512-54.927-30.881-54.751Q-31.250-54.575-31.641-54.575Q-31.940-54.575-32.197-54.720Q-32.454-54.865-32.454-55.151M-29.545-61.866Q-29.545-62.064-29.387-62.217Q-29.229-62.371-29.022-62.371Q-28.882-62.371-28.778-62.272Q-28.675-62.173-28.675-62.028Q-28.675-61.822-28.829-61.672Q-28.983-61.523-29.185-61.523Q-29.334-61.523-29.440-61.620Q-29.545-61.716-29.545-61.866",[868],[853,3990,3991],{"transform":3973},[864,3992],{"d":3993,"fill":855,"stroke":855,"className":3994,"style":869},"M-21.793-58.473L-27.075-58.473Q-27.150-58.486-27.203-58.539Q-27.256-58.592-27.256-58.671Q-27.256-58.737-27.201-58.792Q-27.146-58.847-27.075-58.860L-21.793-58.860Q-21.723-58.847-21.672-58.796Q-21.622-58.746-21.622-58.671Q-21.622-58.504-21.793-58.473",[868],[853,3996,3997],{"transform":3973},[864,3998],{"d":3999,"fill":855,"stroke":855,"className":4000,"style":869},"M-16.928-56.421L-19.960-56.421L-19.960-56.737Q-18.809-56.737-18.809-57.032L-18.809-61.756Q-19.297-61.523-20.018-61.523L-20.018-61.839Q-18.888-61.839-18.326-62.415L-18.181-62.415Q-18.146-62.415-18.113-62.382Q-18.080-62.349-18.080-62.314L-18.080-57.032Q-18.080-56.737-16.928-56.737L-16.928-56.421M-15.531-54.162L-15.614-54.162Q-15.702-54.162-15.702-54.259Q-15.702-54.298-15.667-54.334Q-14.832-55.107-14.472-56.241Q-14.111-57.375-14.111-58.671Q-14.111-59.291-14.190-59.882Q-14.270-60.473-14.450-61.031Q-14.630-61.589-14.931-62.097Q-15.232-62.604-15.667-63Q-15.702-63.035-15.702-63.070Q-15.702-63.171-15.614-63.171L-15.531-63.171Q-15.513-63.171-15.478-63.153Q-14.973-62.771-14.599-62.257Q-14.226-61.743-13.988-61.165Q-13.751-60.587-13.635-59.959Q-13.518-59.330-13.518-58.671Q-13.518-58.012-13.635-57.381Q-13.751-56.751-13.991-56.166Q-14.230-55.582-14.601-55.072Q-14.973-54.562-15.478-54.180Q-15.513-54.162-15.531-54.162",[868],[853,4002,4004,4007],{"fill":4003},"var(--tk-soft-accent)",[864,4005],{"d":4006},"M-7.634 10.443h31.298v-31.298H-7.634Z",[853,4008,4009,4015,4020,4025],{"fill":855,"stroke":1028,"fontSize":3874},[853,4010,4012],{"transform":4011},"translate(41.831 53.465)",[864,4013],{"d":3880,"fill":855,"stroke":855,"className":4014,"style":869},[868],[853,4016,4017],{"transform":4011},[864,4018],{"d":3981,"fill":855,"stroke":855,"className":4019,"style":869},[868],[853,4021,4022],{"transform":4011},[864,4023],{"d":3987,"fill":855,"stroke":855,"className":4024,"style":869},[868],[853,4026,4027],{"transform":4011},[864,4028],{"d":4029,"fill":855,"stroke":855,"className":4030,"style":869},"M-27.343-54.162L-27.427-54.162Q-27.515-54.162-27.515-54.259Q-27.515-54.298-27.480-54.334Q-26.645-55.107-26.284-56.241Q-25.924-57.375-25.924-58.671Q-25.924-59.291-26.003-59.882Q-26.082-60.473-26.262-61.031Q-26.443-61.589-26.744-62.097Q-27.045-62.604-27.480-63Q-27.515-63.035-27.515-63.070Q-27.515-63.171-27.427-63.171L-27.343-63.171Q-27.326-63.171-27.291-63.153Q-26.785-62.771-26.412-62.257Q-26.038-61.743-25.801-61.165Q-25.564-60.587-25.447-59.959Q-25.331-59.330-25.331-58.671Q-25.331-58.012-25.447-57.381Q-25.564-56.751-25.803-56.166Q-26.043-55.582-26.414-55.072Q-26.785-54.562-27.291-54.180Q-27.326-54.162-27.343-54.162",[868],[853,4032,4033,4036],{"fill":859,"stroke":859,"style":1030},[864,4034],{"fill":1028,"d":4035},"m-20.797-40.572 10.68 16.08",[864,4037],{"d":4038,"style":4039},"m-8.464-22.004-.994-4.345-.548 2.024-2.078-.28Z","stroke-width:.7999520000000001",[853,4041,4042,4045],{"style":1030},[864,4043],{"fill":1028,"d":4044},"M8.015-40.572v15.391",[864,4046],{"d":4047},"m8.015-22.194 1.576-4.17-1.576 1.383-1.577-1.382Z",[853,4049,4050,4053],{"style":1030},[864,4051],{"fill":1028,"d":4052},"M-26.707-5.206h14.747",[864,4054],{"d":4055},"m-8.973-5.206-4.17-1.576 1.383 1.576-1.382 1.576Z",[853,4057,4059,4062],{"fill":4058,"stroke":859},"var(--tk-bg)",[864,4060],{"fill":4058,"stroke":1028,"d":4061},"M-59.041-29.581h62.98v-11h-62.98Z",[853,4063,4064,4071,4077,4083,4089],{"fill":859,"stroke":1028,"fontFamily":1035,"fontSize":1036},[853,4065,4067],{"transform":4066},"translate(-14.34 23.34)",[864,4068],{"d":4069,"fill":859,"stroke":859,"className":4070,"style":1044},"M-41.032-56.421L-42.888-56.421L-42.888-56.718Q-42.614-56.718-42.446-56.765Q-42.278-56.812-42.278-56.980L-42.278-59.116Q-42.278-59.331-42.341-59.427Q-42.403-59.523-42.522-59.544Q-42.641-59.566-42.888-59.566L-42.888-59.862L-41.696-59.948L-41.696-59.214Q-41.583-59.429-41.389-59.597Q-41.196-59.765-40.958-59.857Q-40.720-59.948-40.466-59.948Q-39.505-59.948-39.329-59.237Q-39.145-59.566-38.817-59.757Q-38.489-59.948-38.110-59.948Q-36.934-59.948-36.934-58.870L-36.934-56.980Q-36.934-56.812-36.766-56.765Q-36.598-56.718-36.329-56.718L-36.329-56.421L-38.184-56.421L-38.184-56.718Q-37.911-56.718-37.743-56.763Q-37.575-56.808-37.575-56.980L-37.575-58.855Q-37.575-59.241-37.700-59.468Q-37.825-59.694-38.177-59.694Q-38.481-59.694-38.737-59.532Q-38.993-59.370-39.141-59.101Q-39.290-58.831-39.290-58.534L-39.290-56.980Q-39.290-56.812-39.120-56.765Q-38.950-56.718-38.680-56.718L-38.680-56.421L-40.536-56.421L-40.536-56.718Q-40.263-56.718-40.095-56.765Q-39.927-56.812-39.927-56.980L-39.927-58.855Q-39.927-59.241-40.052-59.468Q-40.177-59.694-40.528-59.694Q-40.833-59.694-41.089-59.532Q-41.345-59.370-41.493-59.101Q-41.641-58.831-41.641-58.534L-41.641-56.980Q-41.641-56.812-41.471-56.765Q-41.302-56.718-41.032-56.718L-41.032-56.421M-35.786-57.253Q-35.786-57.737-35.384-58.032Q-34.981-58.327-34.430-58.446Q-33.880-58.566-33.388-58.566L-33.388-58.855Q-33.388-59.081-33.503-59.288Q-33.618-59.495-33.815-59.614Q-34.013-59.733-34.243-59.733Q-34.669-59.733-34.954-59.628Q-34.884-59.601-34.837-59.546Q-34.790-59.491-34.764-59.421Q-34.739-59.351-34.739-59.276Q-34.739-59.171-34.790-59.079Q-34.841-58.987-34.932-58.937Q-35.024-58.886-35.130-58.886Q-35.235-58.886-35.327-58.937Q-35.419-58.987-35.470-59.079Q-35.520-59.171-35.520-59.276Q-35.520-59.694-35.132-59.841Q-34.743-59.987-34.243-59.987Q-33.911-59.987-33.557-59.857Q-33.204-59.726-32.975-59.472Q-32.747-59.218-32.747-58.870L-32.747-57.069Q-32.747-56.937-32.675-56.827Q-32.602-56.718-32.473-56.718Q-32.348-56.718-32.280-56.823Q-32.212-56.929-32.212-57.069L-32.212-57.581L-31.930-57.581L-31.930-57.069Q-31.930-56.866-32.048-56.708Q-32.165-56.550-32.346-56.466Q-32.528-56.382-32.731-56.382Q-32.962-56.382-33.114-56.554Q-33.266-56.726-33.298-56.956Q-33.458-56.675-33.766-56.509Q-34.075-56.343-34.427-56.343Q-34.938-56.343-35.362-56.566Q-35.786-56.788-35.786-57.253M-35.098-57.253Q-35.098-56.968-34.872-56.782Q-34.645-56.597-34.352-56.597Q-34.106-56.597-33.882-56.714Q-33.657-56.831-33.522-57.034Q-33.388-57.237-33.388-57.491L-33.388-58.323Q-33.653-58.323-33.938-58.269Q-34.223-58.214-34.495-58.085Q-34.766-57.956-34.932-57.749Q-35.098-57.542-35.098-57.253M-31.013-57.382L-31.013-59.573L-31.716-59.573L-31.716-59.827Q-31.360-59.827-31.118-60.060Q-30.876-60.292-30.764-60.640Q-30.653-60.987-30.653-61.343L-30.372-61.343L-30.372-59.870L-29.196-59.870L-29.196-59.573L-30.372-59.573L-30.372-57.398Q-30.372-57.077-30.253-56.849Q-30.134-56.620-29.852-56.620Q-29.673-56.620-29.555-56.743Q-29.438-56.866-29.386-57.046Q-29.333-57.226-29.333-57.398L-29.333-57.870L-29.052-57.870L-29.052-57.382Q-29.052-57.128-29.157-56.888Q-29.263-56.648-29.460-56.495Q-29.657-56.343-29.915-56.343Q-30.231-56.343-30.483-56.466Q-30.735-56.589-30.874-56.823Q-31.013-57.058-31.013-57.382M-28.290-58.148Q-28.290-58.644-28.040-59.069Q-27.790-59.495-27.370-59.741Q-26.950-59.987-26.450-59.987Q-25.911-59.987-25.520-59.862Q-25.130-59.737-25.130-59.323Q-25.130-59.218-25.180-59.126Q-25.231-59.034-25.323-58.983Q-25.415-58.933-25.524-58.933Q-25.630-58.933-25.721-58.983Q-25.813-59.034-25.864-59.126Q-25.915-59.218-25.915-59.323Q-25.915-59.546-25.747-59.651Q-25.970-59.710-26.442-59.710Q-26.739-59.710-26.954-59.571Q-27.169-59.433-27.300-59.202Q-27.430-58.972-27.489-58.702Q-27.548-58.433-27.548-58.148Q-27.548-57.753-27.415-57.403Q-27.282-57.054-27.011-56.837Q-26.739-56.620-26.341-56.620Q-25.966-56.620-25.690-56.837Q-25.415-57.054-25.313-57.413Q-25.298-57.476-25.235-57.476L-25.130-57.476Q-25.095-57.476-25.069-57.448Q-25.044-57.421-25.044-57.382L-25.044-57.358Q-25.177-56.878-25.561-56.610Q-25.946-56.343-26.450-56.343Q-26.813-56.343-27.147-56.480Q-27.481-56.616-27.741-56.866Q-28.001-57.116-28.145-57.452Q-28.290-57.788-28.290-58.148",[868],[853,4072,4073],{"transform":4066},[864,4074],{"d":4075,"fill":859,"stroke":859,"className":4076,"style":1044},"M-22.851-56.421L-24.706-56.421L-24.706-56.718Q-24.433-56.718-24.265-56.765Q-24.097-56.812-24.097-56.980L-24.097-61.140Q-24.097-61.355-24.160-61.450Q-24.222-61.546-24.341-61.567Q-24.460-61.589-24.706-61.589L-24.706-61.886L-23.484-61.972L-23.484-59.269Q-23.359-59.480-23.171-59.630Q-22.984-59.780-22.757-59.864Q-22.531-59.948-22.285-59.948Q-21.117-59.948-21.117-58.870L-21.117-56.980Q-21.117-56.812-20.947-56.765Q-20.777-56.718-20.507-56.718L-20.507-56.421L-22.363-56.421L-22.363-56.718Q-22.089-56.718-21.921-56.765Q-21.753-56.812-21.753-56.980L-21.753-58.855Q-21.753-59.237-21.874-59.466Q-21.996-59.694-22.347-59.694Q-22.660-59.694-22.914-59.532Q-23.167-59.370-23.314-59.101Q-23.460-58.831-23.460-58.534L-23.460-56.980Q-23.460-56.812-23.290-56.765Q-23.121-56.718-22.851-56.718",[868],[853,4078,4079],{"transform":4066},[864,4080],{"d":4081,"fill":859,"stroke":859,"className":4082,"style":1044},"M-14.343-58.237L-16.816-58.237Q-16.894-58.249-16.943-58.298Q-16.991-58.347-16.991-58.421Q-16.991-58.495-16.943-58.544Q-16.894-58.593-16.816-58.605L-14.343-58.605L-14.343-61.085Q-14.316-61.253-14.159-61.253Q-14.085-61.253-14.036-61.204Q-13.987-61.155-13.976-61.085L-13.976-58.605L-11.503-58.605Q-11.335-58.573-11.335-58.421Q-11.335-58.269-11.503-58.237L-13.976-58.237L-13.976-55.757Q-13.987-55.687-14.036-55.638Q-14.085-55.589-14.159-55.589Q-14.316-55.589-14.343-55.757L-14.343-58.237M-7.261-56.421L-10.054-56.421L-10.054-56.718Q-8.991-56.718-8.991-56.980L-8.991-61.148Q-9.421-60.933-10.101-60.933L-10.101-61.230Q-9.081-61.230-8.566-61.741L-8.421-61.741Q-8.347-61.722-8.327-61.644L-8.327-56.980Q-8.327-56.718-7.261-56.718",[868],[853,4084,4085],{"transform":4066},[864,4086],{"d":4087,"fill":859,"stroke":859,"className":4088,"style":1044},"M-3.296-54.605Q-3.296-54.624-3.281-54.679L-0.355-62.316Q-0.289-62.421-0.183-62.421Q-0.105-62.421-0.052-62.368Q0.001-62.316 0.001-62.237Q0.001-62.218-0.015-62.163L-2.945-54.526Q-3.007-54.421-3.113-54.421Q-3.187-54.421-3.242-54.476Q-3.296-54.530-3.296-54.605",[868],[853,4090,4091],{"transform":4066},[864,4092],{"d":4093,"fill":859,"stroke":859,"className":4094,"style":1044},"M5.619-56.421L3.634-56.421L3.634-56.718Q3.908-56.718 4.076-56.765Q4.244-56.812 4.244-56.980L4.244-59.573L3.603-59.573L3.603-59.870L4.244-59.870L4.244-60.804Q4.244-61.069 4.361-61.306Q4.478-61.542 4.671-61.706Q4.865-61.870 5.113-61.962Q5.361-62.054 5.627-62.054Q5.912-62.054 6.136-61.896Q6.361-61.737 6.361-61.460Q6.361-61.304 6.255-61.194Q6.150-61.085 5.986-61.085Q5.830-61.085 5.720-61.194Q5.611-61.304 5.611-61.460Q5.611-61.667 5.771-61.773Q5.673-61.796 5.580-61.796Q5.349-61.796 5.177-61.640Q5.005-61.483 4.919-61.247Q4.834-61.011 4.834-60.788L4.834-59.870L5.802-59.870L5.802-59.573L4.857-59.573L4.857-56.980Q4.857-56.812 5.084-56.765Q5.310-56.718 5.619-56.718L5.619-56.421M8.154-56.421L6.173-56.421L6.173-56.718Q6.443-56.718 6.611-56.763Q6.779-56.808 6.779-56.980L6.779-59.116Q6.779-59.331 6.716-59.427Q6.654-59.523 6.537-59.544Q6.419-59.566 6.173-59.566L6.173-59.862L7.341-59.948L7.341-59.163Q7.419-59.374 7.572-59.560Q7.724-59.745 7.923-59.847Q8.123-59.948 8.349-59.948Q8.595-59.948 8.787-59.804Q8.978-59.659 8.978-59.429Q8.978-59.273 8.873-59.163Q8.767-59.054 8.611-59.054Q8.455-59.054 8.345-59.163Q8.236-59.273 8.236-59.429Q8.236-59.589 8.341-59.694Q8.017-59.694 7.802-59.466Q7.587-59.237 7.492-58.898Q7.396-58.558 7.396-58.253L7.396-56.980Q7.396-56.812 7.623-56.765Q7.849-56.718 8.154-56.718L8.154-56.421M9.459-58.175Q9.459-58.655 9.691-59.071Q9.923-59.487 10.334-59.737Q10.744-59.987 11.220-59.987Q11.951-59.987 12.349-59.546Q12.748-59.105 12.748-58.374Q12.748-58.269 12.654-58.245L10.205-58.245L10.205-58.175Q10.205-57.765 10.326-57.409Q10.447-57.054 10.718-56.837Q10.990-56.620 11.419-56.620Q11.783-56.620 12.080-56.849Q12.377-57.077 12.478-57.429Q12.486-57.476 12.572-57.491L12.654-57.491Q12.748-57.464 12.748-57.382Q12.748-57.374 12.740-57.343Q12.677-57.116 12.539-56.933Q12.400-56.749 12.209-56.616Q12.017-56.483 11.798-56.413Q11.580-56.343 11.341-56.343Q10.970-56.343 10.632-56.480Q10.294-56.616 10.027-56.868Q9.759-57.120 9.609-57.460Q9.459-57.800 9.459-58.175M10.212-58.483L12.173-58.483Q12.173-58.788 12.072-59.079Q11.970-59.370 11.753-59.552Q11.537-59.733 11.220-59.733Q10.919-59.733 10.689-59.546Q10.459-59.358 10.335-59.067Q10.212-58.776 10.212-58.483M13.236-58.175Q13.236-58.655 13.468-59.071Q13.701-59.487 14.111-59.737Q14.521-59.987 14.998-59.987Q15.728-59.987 16.127-59.546Q16.525-59.105 16.525-58.374Q16.525-58.269 16.431-58.245L13.982-58.245L13.982-58.175Q13.982-57.765 14.103-57.409Q14.224-57.054 14.496-56.837Q14.767-56.620 15.197-56.620Q15.560-56.620 15.857-56.849Q16.154-57.077 16.255-57.429Q16.263-57.476 16.349-57.491L16.431-57.491Q16.525-57.464 16.525-57.382Q16.525-57.374 16.517-57.343Q16.455-57.116 16.316-56.933Q16.177-56.749 15.986-56.616Q15.794-56.483 15.576-56.413Q15.357-56.343 15.119-56.343Q14.748-56.343 14.410-56.480Q14.072-56.616 13.804-56.868Q13.537-57.120 13.386-57.460Q13.236-57.800 13.236-58.175M13.990-58.483L15.951-58.483Q15.951-58.788 15.849-59.079Q15.748-59.370 15.531-59.552Q15.314-59.733 14.998-59.733Q14.697-59.733 14.466-59.546Q14.236-59.358 14.113-59.067Q13.990-58.776 13.990-58.483",[868],[853,4096,4097,4104,4110],{"stroke":1028,"fontFamily":1035,"fontSize":1036},[853,4098,4100],{"transform":4099},"translate(60.545 27.607)",[864,4101],{"d":4102,"fill":855,"stroke":855,"className":4103,"style":1044},"M-41.145-56.343Q-41.626-56.343-42.034-56.587Q-42.442-56.831-42.680-57.245Q-42.919-57.659-42.919-58.148Q-42.919-58.640-42.661-59.056Q-42.403-59.472-41.971-59.710Q-41.540-59.948-41.048-59.948Q-40.427-59.948-39.977-59.511L-39.977-61.140Q-39.977-61.355-40.040-61.450Q-40.102-61.546-40.220-61.567Q-40.337-61.589-40.583-61.589L-40.583-61.886L-39.360-61.972L-39.360-57.163Q-39.360-56.952-39.298-56.857Q-39.235-56.761-39.118-56.739Q-39.001-56.718-38.751-56.718L-38.751-56.421L-40.001-56.343L-40.001-56.827Q-40.466-56.343-41.145-56.343M-41.079-56.597Q-40.739-56.597-40.446-56.788Q-40.153-56.980-40.001-57.276L-40.001-59.108Q-40.149-59.382-40.411-59.538Q-40.673-59.694-40.985-59.694Q-41.610-59.694-41.893-59.247Q-42.177-58.800-42.177-58.140Q-42.177-57.495-41.925-57.046Q-41.673-56.597-41.079-56.597M-36.235-56.421L-38.216-56.421L-38.216-56.718Q-37.946-56.718-37.778-56.763Q-37.610-56.808-37.610-56.980L-37.610-59.116Q-37.610-59.331-37.673-59.427Q-37.735-59.523-37.852-59.544Q-37.970-59.566-38.216-59.566L-38.216-59.862L-37.048-59.948L-37.048-59.163Q-36.970-59.374-36.817-59.560Q-36.665-59.745-36.466-59.847Q-36.266-59.948-36.040-59.948Q-35.794-59.948-35.602-59.804Q-35.411-59.659-35.411-59.429Q-35.411-59.273-35.516-59.163Q-35.622-59.054-35.778-59.054Q-35.934-59.054-36.044-59.163Q-36.153-59.273-36.153-59.429Q-36.153-59.589-36.048-59.694Q-36.372-59.694-36.587-59.466Q-36.802-59.237-36.897-58.898Q-36.993-58.558-36.993-58.253L-36.993-56.980Q-36.993-56.812-36.766-56.765Q-36.540-56.718-36.235-56.718L-36.235-56.421M-34.930-58.116Q-34.930-58.620-34.675-59.052Q-34.419-59.483-33.983-59.735Q-33.548-59.987-33.048-59.987Q-32.661-59.987-32.319-59.843Q-31.977-59.698-31.716-59.437Q-31.454-59.175-31.311-58.839Q-31.169-58.503-31.169-58.116Q-31.169-57.624-31.432-57.214Q-31.696-56.804-32.126-56.573Q-32.555-56.343-33.048-56.343Q-33.540-56.343-33.973-56.575Q-34.407-56.808-34.669-57.216Q-34.930-57.624-34.930-58.116M-33.048-56.620Q-32.591-56.620-32.339-56.843Q-32.087-57.066-31.999-57.417Q-31.911-57.769-31.911-58.214Q-31.911-58.644-32.005-58.982Q-32.098-59.319-32.352-59.526Q-32.606-59.733-33.048-59.733Q-33.696-59.733-33.940-59.317Q-34.184-58.901-34.184-58.214Q-34.184-57.769-34.096-57.417Q-34.009-57.066-33.757-56.843Q-33.505-56.620-33.048-56.620M-28.802-54.870L-30.657-54.870L-30.657-55.163Q-30.388-55.163-30.220-55.208Q-30.052-55.253-30.052-55.429L-30.052-59.253Q-30.052-59.460-30.208-59.513Q-30.364-59.566-30.657-59.566L-30.657-59.862L-29.434-59.948L-29.434-59.483Q-29.204-59.706-28.889-59.827Q-28.575-59.948-28.235-59.948Q-27.763-59.948-27.358-59.702Q-26.954-59.456-26.721-59.040Q-26.489-58.624-26.489-58.148Q-26.489-57.773-26.638-57.444Q-26.786-57.116-27.055-56.864Q-27.325-56.612-27.669-56.478Q-28.013-56.343-28.372-56.343Q-28.661-56.343-28.932-56.464Q-29.204-56.585-29.411-56.796L-29.411-55.429Q-29.411-55.253-29.243-55.208Q-29.075-55.163-28.802-55.163L-28.802-54.870M-29.411-59.085L-29.411-57.245Q-29.259-56.956-28.997-56.776Q-28.735-56.597-28.427-56.597Q-28.141-56.597-27.919-56.735Q-27.696-56.874-27.544-57.105Q-27.391-57.335-27.313-57.607Q-27.235-57.878-27.235-58.148Q-27.235-58.480-27.360-58.837Q-27.485-59.194-27.733-59.431Q-27.981-59.667-28.329-59.667Q-28.653-59.667-28.948-59.511Q-29.243-59.355-29.411-59.085",[868],[853,4105,4106],{"transform":4099},[864,4107],{"d":4108,"fill":855,"stroke":855,"className":4109,"style":1044},"M-22.887-54.605Q-22.887-54.624-22.872-54.679L-19.946-62.316Q-19.880-62.421-19.774-62.421Q-19.696-62.421-19.643-62.368Q-19.590-62.316-19.590-62.237Q-19.590-62.218-19.606-62.163L-22.536-54.526Q-22.598-54.421-22.704-54.421Q-22.778-54.421-22.833-54.476Q-22.887-54.530-22.887-54.605",[868],[853,4111,4112],{"transform":4099},[864,4113],{"d":4114,"fill":855,"stroke":855,"className":4115,"style":1044},"M-16.038-58.175Q-16.038-58.655-15.805-59.071Q-15.573-59.487-15.163-59.737Q-14.753-59.987-14.276-59.987Q-13.546-59.987-13.147-59.546Q-12.749-59.105-12.749-58.374Q-12.749-58.269-12.842-58.245L-15.292-58.245L-15.292-58.175Q-15.292-57.765-15.171-57.409Q-15.049-57.054-14.778-56.837Q-14.506-56.620-14.077-56.620Q-13.713-56.620-13.417-56.849Q-13.120-57.077-13.018-57.429Q-13.010-57.476-12.924-57.491L-12.842-57.491Q-12.749-57.464-12.749-57.382Q-12.749-57.374-12.756-57.343Q-12.819-57.116-12.958-56.933Q-13.096-56.749-13.288-56.616Q-13.479-56.483-13.698-56.413Q-13.917-56.343-14.155-56.343Q-14.526-56.343-14.864-56.480Q-15.202-56.616-15.469-56.868Q-15.737-57.120-15.887-57.460Q-16.038-57.800-16.038-58.175M-15.284-58.483L-13.323-58.483Q-13.323-58.788-13.424-59.079Q-13.526-59.370-13.743-59.552Q-13.960-59.733-14.276-59.733Q-14.577-59.733-14.807-59.546Q-15.038-59.358-15.161-59.067Q-15.284-58.776-15.284-58.483M-10.444-56.343Q-10.924-56.343-11.333-56.587Q-11.741-56.831-11.979-57.245Q-12.217-57.659-12.217-58.148Q-12.217-58.640-11.960-59.056Q-11.702-59.472-11.270-59.710Q-10.838-59.948-10.346-59.948Q-9.725-59.948-9.276-59.511L-9.276-61.140Q-9.276-61.355-9.338-61.450Q-9.401-61.546-9.518-61.567Q-9.635-61.589-9.881-61.589L-9.881-61.886L-8.659-61.972L-8.659-57.163Q-8.659-56.952-8.596-56.857Q-8.534-56.761-8.417-56.739Q-8.299-56.718-8.049-56.718L-8.049-56.421L-9.299-56.343L-9.299-56.827Q-9.764-56.343-10.444-56.343M-10.378-56.597Q-10.038-56.597-9.745-56.788Q-9.452-56.980-9.299-57.276L-9.299-59.108Q-9.448-59.382-9.710-59.538Q-9.971-59.694-10.284-59.694Q-10.909-59.694-11.192-59.247Q-11.475-58.800-11.475-58.140Q-11.475-57.495-11.223-57.046Q-10.971-56.597-10.378-56.597M-5.682-56.421L-7.460-56.421L-7.460-56.718Q-7.186-56.718-7.018-56.765Q-6.850-56.812-6.850-56.980L-6.850-59.116Q-6.850-59.331-6.907-59.427Q-6.963-59.523-7.077-59.544Q-7.190-59.566-7.436-59.566L-7.436-59.862L-6.237-59.948L-6.237-56.980Q-6.237-56.812-6.090-56.765Q-5.944-56.718-5.682-56.718L-5.682-56.421M-7.124-61.343Q-7.124-61.534-6.989-61.665Q-6.854-61.796-6.659-61.796Q-6.538-61.796-6.434-61.733Q-6.331-61.671-6.268-61.567Q-6.206-61.464-6.206-61.343Q-6.206-61.148-6.337-61.013Q-6.467-60.878-6.659-60.878Q-6.858-60.878-6.991-61.011Q-7.124-61.144-7.124-61.343M-4.557-57.382L-4.557-59.573L-5.260-59.573L-5.260-59.827Q-4.905-59.827-4.663-60.060Q-4.421-60.292-4.309-60.640Q-4.198-60.987-4.198-61.343L-3.917-61.343L-3.917-59.870L-2.741-59.870L-2.741-59.573L-3.917-59.573L-3.917-57.398Q-3.917-57.077-3.797-56.849Q-3.678-56.620-3.397-56.620Q-3.217-56.620-3.100-56.743Q-2.983-56.866-2.930-57.046Q-2.878-57.226-2.878-57.398L-2.878-57.870L-2.596-57.870L-2.596-57.382Q-2.596-57.128-2.702-56.888Q-2.807-56.648-3.005-56.495Q-3.202-56.343-3.460-56.343Q-3.776-56.343-4.028-56.466Q-4.280-56.589-4.419-56.823Q-4.557-57.058-4.557-57.382",[868],[853,4117,4118,4124,4129],{"stroke":1028,"fontFamily":1035,"fontSize":1036},[853,4119,4121],{"transform":4120},"translate(5.062 74.555)",[864,4122],{"d":4102,"fill":855,"stroke":855,"className":4123,"style":1044},[868],[853,4125,4126],{"transform":4120},[864,4127],{"d":4108,"fill":855,"stroke":855,"className":4128,"style":1044},[868],[853,4130,4131],{"transform":4120},[864,4132],{"d":4114,"fill":855,"stroke":855,"className":4133,"style":1044},[868],[1058,4135,4137,4138,4168,4169,4220],{"className":4136},[1061],"The shared stencil of every sequence DP: cell ",[464,4139,4141],{"className":4140},[467],[464,4142,4144],{"className":4143,"ariaHidden":472},[471],[464,4145,4147,4150,4153,4156,4159,4162,4165],{"className":4146},[476],[464,4148],{"className":4149,"style":1210},[480],[464,4151,1392],{"className":4152},[1217],[464,4154,405],{"className":4155},[485,486],[464,4157,1595],{"className":4158},[1594],[464,4160],{"className":4161,"style":610},[492],[464,4163,1603],{"className":4164,"style":1602},[485,486],[464,4166,1431],{"className":4167},[1229]," reads its left, upper, and upper-left neighbours; the diagonal fires on a match (",[464,4170,4172],{"className":4171},[467],[464,4173,4175,4202],{"className":4174,"ariaHidden":472},[471],[464,4176,4178,4181,4184,4187,4190,4193,4196,4199],{"className":4177},[476],[464,4179],{"className":4180,"style":1210},[480],[464,4182,1078],{"className":4183},[485,486],[464,4185,1218],{"className":4186},[1217],[464,4188,405],{"className":4189},[485,486],[464,4191,1230],{"className":4192},[1229],[464,4194],{"className":4195,"style":493},[492],[464,4197,498],{"className":4198},[497],[464,4200],{"className":4201,"style":493},[492],[464,4203,4205,4208,4211,4214,4217],{"className":4204},[476],[464,4206],{"className":4207,"style":1210},[480],[464,4209,1535],{"className":4210,"style":1534},[485,486],[464,4212,1218],{"className":4213},[1217],[464,4215,1603],{"className":4216,"style":1602},[485,486],[464,4218,1230],{"className":4219},[1229],"), the other two on a drop or an edit.",[435,4222,4224,4225],{"id":4223},"step-3-correctness-by-induction-on-ij","Step 3: Correctness by induction on ",[464,4226,4228],{"className":4227},[467],[464,4229,4231,4250],{"className":4230,"ariaHidden":472},[471],[464,4232,4234,4238,4241,4244,4247],{"className":4233},[476],[464,4235],{"className":4236,"style":4237},[480],"height:0.7429em;vertical-align:-0.0833em;",[464,4239,405],{"className":4240},[485,486],[464,4242],{"className":4243,"style":676},[492],[464,4245,1804],{"className":4246},[1803],[464,4248],{"className":4249,"style":676},[492],[464,4251,4253,4256],{"className":4252},[476],[464,4254],{"className":4255,"style":1934},[480],[464,4257,1603],{"className":4258,"style":1602},[485,486],[381,4260,4261,4262,4359,4360,4384,4385,4421,4422,4440,4441,4457,4458,4473],{},"We claim ",[464,4263,4265],{"className":4264},[467],[464,4266,4268,4307],{"className":4267,"ariaHidden":472},[471],[464,4269,4271,4274,4280,4283,4286,4289,4292,4295,4298,4301,4304],{"className":4270},[476],[464,4272],{"className":4273,"style":1210},[480],[464,4275,4277],{"className":4276},[1579],[464,4278,1584],{"className":4279},[485,1583],[464,4281,1392],{"className":4282},[1217],[464,4284,405],{"className":4285},[485,486],[464,4287,1595],{"className":4288},[1594],[464,4290],{"className":4291,"style":610},[492],[464,4293,1603],{"className":4294,"style":1602},[485,486],[464,4296,1431],{"className":4297},[1229],[464,4299],{"className":4300,"style":493},[492],[464,4302,498],{"className":4303},[497],[464,4305],{"className":4306,"style":493},[492],[464,4308,4310,4313,4319,4322,4325,4328,4331,4334,4337,4340,4343,4346,4349,4352,4355],{"className":4309},[476],[464,4311],{"className":4312,"style":1210},[480],[464,4314,4316],{"className":4315},[1579],[464,4317,1629],{"className":4318},[485,1583],[464,4320,1392],{"className":4321},[1217],[464,4323,1078],{"className":4324},[485,486],[464,4326,1218],{"className":4327},[1217],[464,4329,1222],{"className":4330},[485],[464,4332,405],{"className":4333},[485,486],[464,4335,1230],{"className":4336},[1229],[464,4338,1595],{"className":4339},[1594],[464,4341],{"className":4342,"style":610},[492],[464,4344,1535],{"className":4345,"style":1534},[485,486],[464,4347,1218],{"className":4348},[1217],[464,4350,1222],{"className":4351},[485],[464,4353,1603],{"className":4354,"style":1602},[485,486],[464,4356,4358],{"className":4357},[1229],"])","\nfor all ",[464,4361,4363],{"className":4362},[467],[464,4364,4366],{"className":4365,"ariaHidden":472},[471],[464,4367,4369,4372,4375,4378,4381],{"className":4368},[476],[464,4370],{"className":4371,"style":1934},[480],[464,4373,405],{"className":4374},[485,486],[464,4376,1595],{"className":4377},[1594],[464,4379],{"className":4380,"style":610},[492],[464,4382,1603],{"className":4383,"style":1602},[485,486],", and prove it by ",[411,4386,4387,4388],{},"induction on ",[464,4389,4391],{"className":4390},[467],[464,4392,4394,4412],{"className":4393,"ariaHidden":472},[471],[464,4395,4397,4400,4403,4406,4409],{"className":4396},[476],[464,4398],{"className":4399,"style":4237},[480],[464,4401,405],{"className":4402},[485,486],[464,4404],{"className":4405,"style":676},[492],[464,4407,1804],{"className":4408},[1803],[464,4410],{"className":4411,"style":676},[492],[464,4413,4415,4418],{"className":4414},[476],[464,4416],{"className":4417,"style":1934},[480],[464,4419,1603],{"className":4420,"style":1602},[485,486],". The recurrence is itself\na ",[464,4423,4425],{"className":4424},[467],[464,4426,4428],{"className":4427,"ariaHidden":472},[471],[464,4429,4431,4434],{"className":4430},[476],[464,4432],{"className":4433,"style":1900},[480],[464,4435,4437],{"className":4436},[1579],[464,4438,2041],{"className":4439},[485,1583],", so the cleanest proof shows two inequalities: that the recurrence is\nneither too small (",[464,4442,4444],{"className":4443},[467],[464,4445,4447],{"className":4446,"ariaHidden":472},[471],[464,4448,4450,4454],{"className":4449},[476],[464,4451],{"className":4452,"style":4453},[480],"height:0.7719em;vertical-align:-0.136em;",[464,4455,3016],{"className":4456},[497],") nor too large (",[464,4459,4461],{"className":4460},[467],[464,4462,4464],{"className":4463,"ariaHidden":472},[471],[464,4465,4467,4470],{"className":4466},[476],[464,4468],{"className":4469,"style":4453},[480],[464,4471,1871],{"className":4472},[497],").",[381,4475,4476,4479,4480,4531,4532,4566,4567,4600,4601,4616],{},[411,4477,4478],{},"Base case"," (",[464,4481,4483],{"className":4482},[467],[464,4484,4486,4504,4522],{"className":4485,"ariaHidden":472},[471],[464,4487,4489,4492,4495,4498,4501],{"className":4488},[476],[464,4490],{"className":4491,"style":4237},[480],[464,4493,405],{"className":4494},[485,486],[464,4496],{"className":4497,"style":676},[492],[464,4499,1804],{"className":4500},[1803],[464,4502],{"className":4503,"style":676},[492],[464,4505,4507,4510,4513,4516,4519],{"className":4506},[476],[464,4508],{"className":4509,"style":1934},[480],[464,4511,1603],{"className":4512,"style":1602},[485,486],[464,4514],{"className":4515,"style":493},[492],[464,4517,498],{"className":4518},[497],[464,4520],{"className":4521,"style":493},[492],[464,4523,4525,4528],{"className":4524},[476],[464,4526],{"className":4527,"style":3449},[480],[464,4529,1864],{"className":4530},[485],", i.e. ",[464,4533,4535],{"className":4534},[467],[464,4536,4538,4557],{"className":4537,"ariaHidden":472},[471],[464,4539,4541,4545,4548,4551,4554],{"className":4540},[476],[464,4542],{"className":4543,"style":4544},[480],"height:0.6595em;",[464,4546,405],{"className":4547},[485,486],[464,4549],{"className":4550,"style":493},[492],[464,4552,498],{"className":4553},[497],[464,4555],{"className":4556,"style":493},[492],[464,4558,4560,4563],{"className":4559},[476],[464,4561],{"className":4562,"style":3449},[480],[464,4564,1864],{"className":4565},[485]," or ",[464,4568,4570],{"className":4569},[467],[464,4571,4573,4591],{"className":4572,"ariaHidden":472},[471],[464,4574,4576,4579,4582,4585,4588],{"className":4575},[476],[464,4577],{"className":4578,"style":1934},[480],[464,4580,1603],{"className":4581,"style":1602},[485,486],[464,4583],{"className":4584,"style":493},[492],[464,4586,498],{"className":4587},[497],[464,4589],{"className":4590,"style":493},[492],[464,4592,4594,4597],{"className":4593},[476],[464,4595],{"className":4596,"style":3449},[480],[464,4598,1864],{"className":4599},[485],"). One prefix is empty, so the\nonly common subsequence is empty and the length is ",[464,4602,4604],{"className":4603},[467],[464,4605,4607],{"className":4606,"ariaHidden":472},[471],[464,4608,4610,4613],{"className":4609},[476],[464,4611],{"className":4612,"style":3449},[480],[464,4614,1864],{"className":4615},[485],", exactly case 0. Trivial.",[381,4618,4619,4622,4623,4665,4666,4751,4752,1293],{},[411,4620,4621],{},"Inductive step."," Fix ",[464,4624,4626],{"className":4625},[467],[464,4627,4629,4656],{"className":4628,"ariaHidden":472},[471],[464,4630,4632,4635,4638,4641,4644,4647,4650,4653],{"className":4631},[476],[464,4633],{"className":4634,"style":1934},[480],[464,4636,405],{"className":4637},[485,486],[464,4639,1595],{"className":4640},[1594],[464,4642],{"className":4643,"style":610},[492],[464,4645,1603],{"className":4646,"style":1602},[485,486],[464,4648],{"className":4649,"style":493},[492],[464,4651,2786],{"className":4652},[497],[464,4654],{"className":4655,"style":493},[492],[464,4657,4659,4662],{"className":4658},[476],[464,4660],{"className":4661,"style":3449},[480],[464,4663,1864],{"className":4664},[485]," and assume the claim for all ",[464,4667,4669],{"className":4668},[467],[464,4670,4672],{"className":4671,"ariaHidden":472},[471],[464,4673,4675,4679,4713,4716,4719],{"className":4674},[476],[464,4676],{"className":4677,"style":4678},[480],"height:0.9463em;vertical-align:-0.1944em;",[464,4680,4682,4685],{"className":4681},[485],[464,4683,405],{"className":4684},[485,486],[464,4686,4688],{"className":4687},[519],[464,4689,4691],{"className":4690},[523],[464,4692,4694],{"className":4693},[528],[464,4695,4698],{"className":4696,"style":4697},[532],"height:0.7519em;",[464,4699,4700,4703],{"style":1346},[464,4701],{"className":4702,"style":541},[540],[464,4704,4706],{"className":4705},[545,546,547,548],[464,4707,4709],{"className":4708},[485,548],[464,4710,4712],{"className":4711},[485,548],"′",[464,4714,1595],{"className":4715},[1594],[464,4717],{"className":4718,"style":610},[492],[464,4720,4722,4725],{"className":4721},[485],[464,4723,1603],{"className":4724,"style":1602},[485,486],[464,4726,4728],{"className":4727},[519],[464,4729,4731],{"className":4730},[523],[464,4732,4734],{"className":4733},[528],[464,4735,4737],{"className":4736,"style":4697},[532],[464,4738,4739,4742],{"style":1346},[464,4740],{"className":4741,"style":541},[540],[464,4743,4745],{"className":4744},[545,546,547,548],[464,4746,4748],{"className":4747},[485,548],[464,4749,4712],{"className":4750},[485,548]," with\n",[464,4753,4755],{"className":4754},[467],[464,4756,4758,4806,4854,4872],{"className":4757,"ariaHidden":472},[471],[464,4759,4761,4765,4797,4800,4803],{"className":4760},[476],[464,4762],{"className":4763,"style":4764},[480],"height:0.8352em;vertical-align:-0.0833em;",[464,4766,4768,4771],{"className":4767},[485],[464,4769,405],{"className":4770},[485,486],[464,4772,4774],{"className":4773},[519],[464,4775,4777],{"className":4776},[523],[464,4778,4780],{"className":4779},[528],[464,4781,4783],{"className":4782,"style":4697},[532],[464,4784,4785,4788],{"style":1346},[464,4786],{"className":4787,"style":541},[540],[464,4789,4791],{"className":4790},[545,546,547,548],[464,4792,4794],{"className":4793},[485,548],[464,4795,4712],{"className":4796},[485,548],[464,4798],{"className":4799,"style":676},[492],[464,4801,1804],{"className":4802},[1803],[464,4804],{"className":4805,"style":676},[492],[464,4807,4809,4812,4844,4847,4851],{"className":4808},[476],[464,4810],{"className":4811,"style":4678},[480],[464,4813,4815,4818],{"className":4814},[485],[464,4816,1603],{"className":4817,"style":1602},[485,486],[464,4819,4821],{"className":4820},[519],[464,4822,4824],{"className":4823},[523],[464,4825,4827],{"className":4826},[528],[464,4828,4830],{"className":4829,"style":4697},[532],[464,4831,4832,4835],{"style":1346},[464,4833],{"className":4834,"style":541},[540],[464,4836,4838],{"className":4837},[545,546,547,548],[464,4839,4841],{"className":4840},[485,548],[464,4842,4712],{"className":4843},[485,548],[464,4845],{"className":4846,"style":493},[492],[464,4848,4850],{"className":4849},[497],"\u003C",[464,4852],{"className":4853,"style":493},[492],[464,4855,4857,4860,4863,4866,4869],{"className":4856},[476],[464,4858],{"className":4859,"style":4237},[480],[464,4861,405],{"className":4862},[485,486],[464,4864],{"className":4865,"style":676},[492],[464,4867,1804],{"className":4868},[1803],[464,4870],{"className":4871,"style":676},[492],[464,4873,4875,4878],{"className":4874},[476],[464,4876],{"className":4877,"style":1934},[480],[464,4879,1603],{"className":4880,"style":1602},[485,486],[381,4882,4883,4902],{},[447,4884,4885,4886,4901],{},"The ",[464,4887,4889],{"className":4888},[467],[464,4890,4892],{"className":4891,"ariaHidden":472},[471],[464,4893,4895,4898],{"className":4894},[476],[464,4896],{"className":4897,"style":4453},[480],[464,4899,3016],{"className":4900},[497]," direction"," (the recurrence is achievable). We exhibit a common\nsubsequence of length at least the right-hand side.",[2812,4904,4905,5363],{},[2815,4906,4907,4908,4977,4978,388,5023,5068,5069,5141,5142,5157,5158,388,5185,5212,5213,1293],{},"If ",[464,4909,4911],{"className":4910},[467],[464,4912,4914,4941,4968],{"className":4913,"ariaHidden":472},[471],[464,4915,4917,4920,4923,4926,4929,4932,4935,4938],{"className":4916},[476],[464,4918],{"className":4919,"style":1210},[480],[464,4921,1078],{"className":4922},[485,486],[464,4924,1218],{"className":4925},[1217],[464,4927,405],{"className":4928},[485,486],[464,4930,1230],{"className":4931},[1229],[464,4933],{"className":4934,"style":493},[492],[464,4936,498],{"className":4937},[497],[464,4939],{"className":4940,"style":493},[492],[464,4942,4944,4947,4950,4953,4956,4959,4962,4965],{"className":4943},[476],[464,4945],{"className":4946,"style":1210},[480],[464,4948,1535],{"className":4949,"style":1534},[485,486],[464,4951,1218],{"className":4952},[1217],[464,4954,1603],{"className":4955,"style":1602},[485,486],[464,4957,1230],{"className":4958},[1229],[464,4960],{"className":4961,"style":493},[492],[464,4963,498],{"className":4964},[497],[464,4966],{"className":4967,"style":493},[492],[464,4969,4971,4974],{"className":4970},[476],[464,4972],{"className":4973,"style":1900},[480],[464,4975,408],{"className":4976},[485,486],": by the induction hypothesis there is a common subsequence\nof ",[464,4979,4981],{"className":4980},[467],[464,4982,4984,5011],{"className":4983,"ariaHidden":472},[471],[464,4985,4987,4990,4993,4996,4999,5002,5005,5008],{"className":4986},[476],[464,4988],{"className":4989,"style":1210},[480],[464,4991,1078],{"className":4992},[485,486],[464,4994,1218],{"className":4995},[1217],[464,4997,1222],{"className":4998},[485],[464,5000,405],{"className":5001},[485,486],[464,5003],{"className":5004,"style":676},[492],[464,5006,2393],{"className":5007},[1803],[464,5009],{"className":5010,"style":676},[492],[464,5012,5014,5017,5020],{"className":5013},[476],[464,5015],{"className":5016,"style":1210},[480],[464,5018,428],{"className":5019},[485],[464,5021,1230],{"className":5022},[1229],[464,5024,5026],{"className":5025},[467],[464,5027,5029,5056],{"className":5028,"ariaHidden":472},[471],[464,5030,5032,5035,5038,5041,5044,5047,5050,5053],{"className":5031},[476],[464,5033],{"className":5034,"style":1210},[480],[464,5036,1535],{"className":5037,"style":1534},[485,486],[464,5039,1218],{"className":5040},[1217],[464,5042,1222],{"className":5043},[485],[464,5045,1603],{"className":5046,"style":1602},[485,486],[464,5048],{"className":5049,"style":676},[492],[464,5051,2393],{"className":5052},[1803],[464,5054],{"className":5055,"style":676},[492],[464,5057,5059,5062,5065],{"className":5058},[476],[464,5060],{"className":5061,"style":1210},[480],[464,5063,428],{"className":5064},[485],[464,5066,1230],{"className":5067},[1229]," of length ",[464,5070,5072],{"className":5071},[467],[464,5073,5075,5102,5129],{"className":5074,"ariaHidden":472},[471],[464,5076,5078,5081,5087,5090,5093,5096,5099],{"className":5077},[476],[464,5079],{"className":5080,"style":1210},[480],[464,5082,5084],{"className":5083},[1579],[464,5085,1584],{"className":5086},[485,1583],[464,5088,1392],{"className":5089},[1217],[464,5091,405],{"className":5092},[485,486],[464,5094],{"className":5095,"style":676},[492],[464,5097,2393],{"className":5098},[1803],[464,5100],{"className":5101,"style":676},[492],[464,5103,5105,5108,5111,5114,5117,5120,5123,5126],{"className":5104},[476],[464,5106],{"className":5107,"style":1934},[480],[464,5109,428],{"className":5110},[485],[464,5112,1595],{"className":5113},[1594],[464,5115],{"className":5116,"style":610},[492],[464,5118,1603],{"className":5119,"style":1602},[485,486],[464,5121],{"className":5122,"style":676},[492],[464,5124,2393],{"className":5125},[1803],[464,5127],{"className":5128,"style":676},[492],[464,5130,5132,5135,5138],{"className":5131},[476],[464,5133],{"className":5134,"style":1210},[480],[464,5136,428],{"className":5137},[485],[464,5139,1431],{"className":5140},[1229],".\nAppending ",[464,5143,5145],{"className":5144},[467],[464,5146,5148],{"className":5147,"ariaHidden":472},[471],[464,5149,5151,5154],{"className":5150},[476],[464,5152],{"className":5153,"style":1900},[480],[464,5155,408],{"className":5156},[485,486]," yields a common subsequence of ",[464,5159,5161],{"className":5160},[467],[464,5162,5164],{"className":5163,"ariaHidden":472},[471],[464,5165,5167,5170,5173,5176,5179,5182],{"className":5166},[476],[464,5168],{"className":5169,"style":1210},[480],[464,5171,1078],{"className":5172},[485,486],[464,5174,1218],{"className":5175},[1217],[464,5177,1222],{"className":5178},[485],[464,5180,405],{"className":5181},[485,486],[464,5183,1230],{"className":5184},[1229],[464,5186,5188],{"className":5187},[467],[464,5189,5191],{"className":5190,"ariaHidden":472},[471],[464,5192,5194,5197,5200,5203,5206,5209],{"className":5193},[476],[464,5195],{"className":5196,"style":1210},[480],[464,5198,1535],{"className":5199,"style":1534},[485,486],[464,5201,1218],{"className":5202},[1217],[464,5204,1222],{"className":5205},[485],[464,5207,1603],{"className":5208,"style":1602},[485,486],[464,5210,1230],{"className":5211},[1229],", so\n",[464,5214,5216],{"className":5215},[467],[464,5217,5219,5279,5306,5333,5354],{"className":5218,"ariaHidden":472},[471],[464,5220,5222,5225,5231,5234,5237,5240,5243,5246,5249,5252,5255,5258,5261,5264,5267,5270,5273,5276],{"className":5221},[476],[464,5223],{"className":5224,"style":1210},[480],[464,5226,5228],{"className":5227},[1579],[464,5229,1629],{"className":5230},[485,1583],[464,5232,1392],{"className":5233},[1217],[464,5235,1078],{"className":5236},[485,486],[464,5238,1218],{"className":5239},[1217],[464,5241,1222],{"className":5242},[485],[464,5244,405],{"className":5245},[485,486],[464,5247,1230],{"className":5248},[1229],[464,5250,1595],{"className":5251},[1594],[464,5253],{"className":5254,"style":610},[492],[464,5256,1535],{"className":5257,"style":1534},[485,486],[464,5259,1218],{"className":5260},[1217],[464,5262,1222],{"className":5263},[485],[464,5265,1603],{"className":5266,"style":1602},[485,486],[464,5268,4358],{"className":5269},[1229],[464,5271],{"className":5272,"style":493},[492],[464,5274,3016],{"className":5275},[497],[464,5277],{"className":5278,"style":493},[492],[464,5280,5282,5285,5291,5294,5297,5300,5303],{"className":5281},[476],[464,5283],{"className":5284,"style":1210},[480],[464,5286,5288],{"className":5287},[1579],[464,5289,1584],{"className":5290},[485,1583],[464,5292,1392],{"className":5293},[1217],[464,5295,405],{"className":5296},[485,486],[464,5298],{"className":5299,"style":676},[492],[464,5301,2393],{"className":5302},[1803],[464,5304],{"className":5305,"style":676},[492],[464,5307,5309,5312,5315,5318,5321,5324,5327,5330],{"className":5308},[476],[464,5310],{"className":5311,"style":1934},[480],[464,5313,428],{"className":5314},[485],[464,5316,1595],{"className":5317},[1594],[464,5319],{"className":5320,"style":610},[492],[464,5322,1603],{"className":5323,"style":1602},[485,486],[464,5325],{"className":5326,"style":676},[492],[464,5328,2393],{"className":5329},[1803],[464,5331],{"className":5332,"style":676},[492],[464,5334,5336,5339,5342,5345,5348,5351],{"className":5335},[476],[464,5337],{"className":5338,"style":1210},[480],[464,5340,428],{"className":5341},[485],[464,5343,1431],{"className":5344},[1229],[464,5346],{"className":5347,"style":676},[492],[464,5349,1804],{"className":5350},[1803],[464,5352],{"className":5353,"style":676},[492],[464,5355,5357,5360],{"className":5356},[476],[464,5358],{"className":5359,"style":3449},[480],[464,5361,428],{"className":5362},[485],[2815,5364,5365,5366,1711,5432,5498,5499,5514,5515,1293],{},"Cases 1 and 2 are even simpler: any common subsequence of a shorter prefix pair\nis still common for the longer pair, giving ",[464,5367,5369],{"className":5368},[467],[464,5370,5372,5384,5411],{"className":5371,"ariaHidden":472},[471],[464,5373,5375,5378,5381],{"className":5374},[476],[464,5376],{"className":5377,"style":4453},[480],[464,5379,3016],{"className":5380},[497],[464,5382],{"className":5383,"style":493},[492],[464,5385,5387,5390,5396,5399,5402,5405,5408],{"className":5386},[476],[464,5388],{"className":5389,"style":1210},[480],[464,5391,5393],{"className":5392},[1579],[464,5394,1584],{"className":5395},[485,1583],[464,5397,1392],{"className":5398},[1217],[464,5400,405],{"className":5401},[485,486],[464,5403],{"className":5404,"style":676},[492],[464,5406,2393],{"className":5407},[1803],[464,5409],{"className":5410,"style":676},[492],[464,5412,5414,5417,5420,5423,5426,5429],{"className":5413},[476],[464,5415],{"className":5416,"style":1210},[480],[464,5418,428],{"className":5419},[485],[464,5421,1595],{"className":5422},[1594],[464,5424],{"className":5425,"style":610},[492],[464,5427,1603],{"className":5428,"style":1602},[485,486],[464,5430,1431],{"className":5431},[1229],[464,5433,5435],{"className":5434},[467],[464,5436,5438,5450,5486],{"className":5437,"ariaHidden":472},[471],[464,5439,5441,5444,5447],{"className":5440},[476],[464,5442],{"className":5443,"style":4453},[480],[464,5445,3016],{"className":5446},[497],[464,5448],{"className":5449,"style":493},[492],[464,5451,5453,5456,5462,5465,5468,5471,5474,5477,5480,5483],{"className":5452},[476],[464,5454],{"className":5455,"style":1210},[480],[464,5457,5459],{"className":5458},[1579],[464,5460,1584],{"className":5461},[485,1583],[464,5463,1392],{"className":5464},[1217],[464,5466,405],{"className":5467},[485,486],[464,5469,1595],{"className":5470},[1594],[464,5472],{"className":5473,"style":610},[492],[464,5475,1603],{"className":5476,"style":1602},[485,486],[464,5478],{"className":5479,"style":676},[492],[464,5481,2393],{"className":5482},[1803],[464,5484],{"className":5485,"style":676},[492],[464,5487,5489,5492,5495],{"className":5488},[476],[464,5490],{"className":5491,"style":1210},[480],[464,5493,428],{"className":5494},[485],[464,5496,1431],{"className":5497},[1229],". So the true length is ",[464,5500,5502],{"className":5501},[467],[464,5503,5505],{"className":5504,"ariaHidden":472},[471],[464,5506,5508,5511],{"className":5507},[476],[464,5509],{"className":5510,"style":4453},[480],[464,5512,3016],{"className":5513},[497]," the ",[464,5516,5518],{"className":5517},[467],[464,5519,5521],{"className":5520,"ariaHidden":472},[471],[464,5522,5524,5527],{"className":5523},[476],[464,5525],{"className":5526,"style":1900},[480],[464,5528,5530],{"className":5529},[1579],[464,5531,2041],{"className":5532},[485,1583],[381,5534,5535,5552,5553,5556,5557,5573,5574,388,5601,5628,5629,5651],{},[447,5536,4885,5537,4901],{},[464,5538,5540],{"className":5539},[467],[464,5541,5543],{"className":5542,"ariaHidden":472},[471],[464,5544,5546,5549],{"className":5545},[476],[464,5547],{"className":5548,"style":4453},[480],[464,5550,1871],{"className":5551},[497]," (the recurrence is not exceeded). Take ",[411,5554,5555],{},"any"," common\nsubsequence ",[464,5558,5560],{"className":5559},[467],[464,5561,5563],{"className":5562,"ariaHidden":472},[471],[464,5564,5566,5569],{"className":5565},[476],[464,5567],{"className":5568,"style":1900},[480],[464,5570,5572],{"className":5571,"style":700},[485,486],"σ"," of ",[464,5575,5577],{"className":5576},[467],[464,5578,5580],{"className":5579,"ariaHidden":472},[471],[464,5581,5583,5586,5589,5592,5595,5598],{"className":5582},[476],[464,5584],{"className":5585,"style":1210},[480],[464,5587,1078],{"className":5588},[485,486],[464,5590,1218],{"className":5591},[1217],[464,5593,1222],{"className":5594},[485],[464,5596,405],{"className":5597},[485,486],[464,5599,1230],{"className":5600},[1229],[464,5602,5604],{"className":5603},[467],[464,5605,5607],{"className":5606,"ariaHidden":472},[471],[464,5608,5610,5613,5616,5619,5622,5625],{"className":5609},[476],[464,5611],{"className":5612,"style":1210},[480],[464,5614,1535],{"className":5615,"style":1534},[485,486],[464,5617,1218],{"className":5618},[1217],[464,5620,1222],{"className":5621},[485],[464,5623,1603],{"className":5624,"style":1602},[485,486],[464,5626,1230],{"className":5627},[1229],"; we show ",[464,5630,5632],{"className":5631},[467],[464,5633,5635],{"className":5634,"ariaHidden":472},[471],[464,5636,5638,5641,5645,5648],{"className":5637},[476],[464,5639],{"className":5640,"style":1210},[480],[464,5642,5644],{"className":5643},[485],"∣",[464,5646,5572],{"className":5647,"style":700},[485,486],[464,5649,5644],{"className":5650},[485]," is bounded by\none of the three branches.",[2812,5653,5654,5864,5984],{},[2815,5655,4907,5656,5671,5672,5696,5697,5712,5713,388,5758,2973,5785,5863],{},[464,5657,5659],{"className":5658},[467],[464,5660,5662],{"className":5661,"ariaHidden":472},[471],[464,5663,5665,5668],{"className":5664},[476],[464,5666],{"className":5667,"style":1900},[480],[464,5669,5572],{"className":5670,"style":700},[485,486]," does not use ",[464,5673,5675],{"className":5674},[467],[464,5676,5678],{"className":5677,"ariaHidden":472},[471],[464,5679,5681,5684,5687,5690,5693],{"className":5680},[476],[464,5682],{"className":5683,"style":1210},[480],[464,5685,1078],{"className":5686},[485,486],[464,5688,1218],{"className":5689},[1217],[464,5691,405],{"className":5692},[485,486],[464,5694,1230],{"className":5695},[1229],": then ",[464,5698,5700],{"className":5699},[467],[464,5701,5703],{"className":5702,"ariaHidden":472},[471],[464,5704,5706,5709],{"className":5705},[476],[464,5707],{"className":5708,"style":1900},[480],[464,5710,5572],{"className":5711,"style":700},[485,486]," is a common subsequence of\n",[464,5714,5716],{"className":5715},[467],[464,5717,5719,5746],{"className":5718,"ariaHidden":472},[471],[464,5720,5722,5725,5728,5731,5734,5737,5740,5743],{"className":5721},[476],[464,5723],{"className":5724,"style":1210},[480],[464,5726,1078],{"className":5727},[485,486],[464,5729,1218],{"className":5730},[1217],[464,5732,1222],{"className":5733},[485],[464,5735,405],{"className":5736},[485,486],[464,5738],{"className":5739,"style":676},[492],[464,5741,2393],{"className":5742},[1803],[464,5744],{"className":5745,"style":676},[492],[464,5747,5749,5752,5755],{"className":5748},[476],[464,5750],{"className":5751,"style":1210},[480],[464,5753,428],{"className":5754},[485],[464,5756,1230],{"className":5757},[1229],[464,5759,5761],{"className":5760},[467],[464,5762,5764],{"className":5763,"ariaHidden":472},[471],[464,5765,5767,5770,5773,5776,5779,5782],{"className":5766},[476],[464,5768],{"className":5769,"style":1210},[480],[464,5771,1535],{"className":5772,"style":1534},[485,486],[464,5774,1218],{"className":5775},[1217],[464,5777,1222],{"className":5778},[485],[464,5780,1603],{"className":5781,"style":1602},[485,486],[464,5783,1230],{"className":5784},[1229],[464,5786,5788],{"className":5787},[467],[464,5789,5791,5815,5842],{"className":5790,"ariaHidden":472},[471],[464,5792,5794,5797,5800,5803,5806,5809,5812],{"className":5793},[476],[464,5795],{"className":5796,"style":1210},[480],[464,5798,5644],{"className":5799},[485],[464,5801,5572],{"className":5802,"style":700},[485,486],[464,5804,5644],{"className":5805},[485],[464,5807],{"className":5808,"style":493},[492],[464,5810,1871],{"className":5811},[497],[464,5813],{"className":5814,"style":493},[492],[464,5816,5818,5821,5827,5830,5833,5836,5839],{"className":5817},[476],[464,5819],{"className":5820,"style":1210},[480],[464,5822,5824],{"className":5823},[1579],[464,5825,1584],{"className":5826},[485,1583],[464,5828,1392],{"className":5829},[1217],[464,5831,405],{"className":5832},[485,486],[464,5834],{"className":5835,"style":676},[492],[464,5837,2393],{"className":5838},[1803],[464,5840],{"className":5841,"style":676},[492],[464,5843,5845,5848,5851,5854,5857,5860],{"className":5844},[476],[464,5846],{"className":5847,"style":1210},[480],[464,5849,428],{"className":5850},[485],[464,5852,1595],{"className":5853},[1594],[464,5855],{"className":5856,"style":610},[492],[464,5858,1603],{"className":5859,"style":1602},[485,486],[464,5861,1431],{"className":5862},[1229]," by the IH.",[2815,5865,4907,5866,5671,5881,5905,5906,1293],{},[464,5867,5869],{"className":5868},[467],[464,5870,5872],{"className":5871,"ariaHidden":472},[471],[464,5873,5875,5878],{"className":5874},[476],[464,5876],{"className":5877,"style":1900},[480],[464,5879,5572],{"className":5880,"style":700},[485,486],[464,5882,5884],{"className":5883},[467],[464,5885,5887],{"className":5886,"ariaHidden":472},[471],[464,5888,5890,5893,5896,5899,5902],{"className":5889},[476],[464,5891],{"className":5892,"style":1210},[480],[464,5894,1535],{"className":5895,"style":1534},[485,486],[464,5897,1218],{"className":5898},[1217],[464,5900,1603],{"className":5901,"style":1602},[485,486],[464,5903,1230],{"className":5904},[1229],": symmetrically ",[464,5907,5909],{"className":5908},[467],[464,5910,5912,5936,5972],{"className":5911,"ariaHidden":472},[471],[464,5913,5915,5918,5921,5924,5927,5930,5933],{"className":5914},[476],[464,5916],{"className":5917,"style":1210},[480],[464,5919,5644],{"className":5920},[485],[464,5922,5572],{"className":5923,"style":700},[485,486],[464,5925,5644],{"className":5926},[485],[464,5928],{"className":5929,"style":493},[492],[464,5931,1871],{"className":5932},[497],[464,5934],{"className":5935,"style":493},[492],[464,5937,5939,5942,5948,5951,5954,5957,5960,5963,5966,5969],{"className":5938},[476],[464,5940],{"className":5941,"style":1210},[480],[464,5943,5945],{"className":5944},[1579],[464,5946,1584],{"className":5947},[485,1583],[464,5949,1392],{"className":5950},[1217],[464,5952,405],{"className":5953},[485,486],[464,5955,1595],{"className":5956},[1594],[464,5958],{"className":5959,"style":610},[492],[464,5961,1603],{"className":5962,"style":1602},[485,486],[464,5964],{"className":5965,"style":676},[492],[464,5967,2393],{"className":5968},[1803],[464,5970],{"className":5971,"style":676},[492],[464,5973,5975,5978,5981],{"className":5974},[476],[464,5976],{"className":5977,"style":1210},[480],[464,5979,428],{"className":5980},[485],[464,5982,1431],{"className":5983},[1229],[2815,5985,4907,5986,6001,6002,3200,6005,388,6029,6053,6054,6069,6070,6121,6122,388,6167,6212,6213,6327,6328,1293],{},[464,5987,5989],{"className":5988},[467],[464,5990,5992],{"className":5991,"ariaHidden":472},[471],[464,5993,5995,5998],{"className":5994},[476],[464,5996],{"className":5997,"style":1900},[480],[464,5999,5572],{"className":6000,"style":700},[485,486]," uses ",[411,6003,6004],{},"both",[464,6006,6008],{"className":6007},[467],[464,6009,6011],{"className":6010,"ariaHidden":472},[471],[464,6012,6014,6017,6020,6023,6026],{"className":6013},[476],[464,6015],{"className":6016,"style":1210},[480],[464,6018,1078],{"className":6019},[485,486],[464,6021,1218],{"className":6022},[1217],[464,6024,405],{"className":6025},[485,486],[464,6027,1230],{"className":6028},[1229],[464,6030,6032],{"className":6031},[467],[464,6033,6035],{"className":6034,"ariaHidden":472},[471],[464,6036,6038,6041,6044,6047,6050],{"className":6037},[476],[464,6039],{"className":6040,"style":1210},[480],[464,6042,1535],{"className":6043,"style":1534},[485,486],[464,6045,1218],{"className":6046},[1217],[464,6048,1603],{"className":6049,"style":1602},[485,486],[464,6051,1230],{"className":6052},[1229],": then they must match as ",[464,6055,6057],{"className":6056},[467],[464,6058,6060],{"className":6059,"ariaHidden":472},[471],[464,6061,6063,6066],{"className":6062},[476],[464,6064],{"className":6065,"style":1900},[480],[464,6067,5572],{"className":6068,"style":700},[485,486],"'s\nlast character, so ",[464,6071,6073],{"className":6072},[467],[464,6074,6076,6103],{"className":6075,"ariaHidden":472},[471],[464,6077,6079,6082,6085,6088,6091,6094,6097,6100],{"className":6078},[476],[464,6080],{"className":6081,"style":1210},[480],[464,6083,1078],{"className":6084},[485,486],[464,6086,1218],{"className":6087},[1217],[464,6089,405],{"className":6090},[485,486],[464,6092,1230],{"className":6093},[1229],[464,6095],{"className":6096,"style":493},[492],[464,6098,498],{"className":6099},[497],[464,6101],{"className":6102,"style":493},[492],[464,6104,6106,6109,6112,6115,6118],{"className":6105},[476],[464,6107],{"className":6108,"style":1210},[480],[464,6110,1535],{"className":6111,"style":1534},[485,486],[464,6113,1218],{"className":6114},[1217],[464,6116,1603],{"className":6117,"style":1602},[485,486],[464,6119,1230],{"className":6120},[1229],", and dropping it leaves a common subsequence of\n",[464,6123,6125],{"className":6124},[467],[464,6126,6128,6155],{"className":6127,"ariaHidden":472},[471],[464,6129,6131,6134,6137,6140,6143,6146,6149,6152],{"className":6130},[476],[464,6132],{"className":6133,"style":1210},[480],[464,6135,1078],{"className":6136},[485,486],[464,6138,1218],{"className":6139},[1217],[464,6141,1222],{"className":6142},[485],[464,6144,405],{"className":6145},[485,486],[464,6147],{"className":6148,"style":676},[492],[464,6150,2393],{"className":6151},[1803],[464,6153],{"className":6154,"style":676},[492],[464,6156,6158,6161,6164],{"className":6157},[476],[464,6159],{"className":6160,"style":1210},[480],[464,6162,428],{"className":6163},[485],[464,6165,1230],{"className":6166},[1229],[464,6168,6170],{"className":6169},[467],[464,6171,6173,6200],{"className":6172,"ariaHidden":472},[471],[464,6174,6176,6179,6182,6185,6188,6191,6194,6197],{"className":6175},[476],[464,6177],{"className":6178,"style":1210},[480],[464,6180,1535],{"className":6181,"style":1534},[485,486],[464,6183,1218],{"className":6184},[1217],[464,6186,1222],{"className":6187},[485],[464,6189,1603],{"className":6190,"style":1602},[485,486],[464,6192],{"className":6193,"style":676},[492],[464,6195,2393],{"className":6196},[1803],[464,6198],{"className":6199,"style":676},[492],[464,6201,6203,6206,6209],{"className":6202},[476],[464,6204],{"className":6205,"style":1210},[480],[464,6207,428],{"className":6208},[485],[464,6210,1230],{"className":6211},[1229],"; hence ",[464,6214,6216],{"className":6215},[467],[464,6217,6219,6243,6261,6288,6315],{"className":6218,"ariaHidden":472},[471],[464,6220,6222,6225,6228,6231,6234,6237,6240],{"className":6221},[476],[464,6223],{"className":6224,"style":1210},[480],[464,6226,5644],{"className":6227},[485],[464,6229,5572],{"className":6230,"style":700},[485,486],[464,6232,5644],{"className":6233},[485],[464,6235],{"className":6236,"style":676},[492],[464,6238,2393],{"className":6239},[1803],[464,6241],{"className":6242,"style":676},[492],[464,6244,6246,6249,6252,6255,6258],{"className":6245},[476],[464,6247],{"className":6248,"style":1860},[480],[464,6250,428],{"className":6251},[485],[464,6253],{"className":6254,"style":493},[492],[464,6256,1871],{"className":6257},[497],[464,6259],{"className":6260,"style":493},[492],[464,6262,6264,6267,6273,6276,6279,6282,6285],{"className":6263},[476],[464,6265],{"className":6266,"style":1210},[480],[464,6268,6270],{"className":6269},[1579],[464,6271,1584],{"className":6272},[485,1583],[464,6274,1392],{"className":6275},[1217],[464,6277,405],{"className":6278},[485,486],[464,6280],{"className":6281,"style":676},[492],[464,6283,2393],{"className":6284},[1803],[464,6286],{"className":6287,"style":676},[492],[464,6289,6291,6294,6297,6300,6303,6306,6309,6312],{"className":6290},[476],[464,6292],{"className":6293,"style":1934},[480],[464,6295,428],{"className":6296},[485],[464,6298,1595],{"className":6299},[1594],[464,6301],{"className":6302,"style":610},[492],[464,6304,1603],{"className":6305,"style":1602},[485,486],[464,6307],{"className":6308,"style":676},[492],[464,6310,2393],{"className":6311},[1803],[464,6313],{"className":6314,"style":676},[492],[464,6316,6318,6321,6324],{"className":6317},[476],[464,6319],{"className":6320,"style":1210},[480],[464,6322,428],{"className":6323},[485],[464,6325,1431],{"className":6326},[1229],",\ni.e. ",[464,6329,6331],{"className":6330},[467],[464,6332,6334,6358,6385,6412,6433],{"className":6333,"ariaHidden":472},[471],[464,6335,6337,6340,6343,6346,6349,6352,6355],{"className":6336},[476],[464,6338],{"className":6339,"style":1210},[480],[464,6341,5644],{"className":6342},[485],[464,6344,5572],{"className":6345,"style":700},[485,486],[464,6347,5644],{"className":6348},[485],[464,6350],{"className":6351,"style":493},[492],[464,6353,1871],{"className":6354},[497],[464,6356],{"className":6357,"style":493},[492],[464,6359,6361,6364,6370,6373,6376,6379,6382],{"className":6360},[476],[464,6362],{"className":6363,"style":1210},[480],[464,6365,6367],{"className":6366},[1579],[464,6368,1584],{"className":6369},[485,1583],[464,6371,1392],{"className":6372},[1217],[464,6374,405],{"className":6375},[485,486],[464,6377],{"className":6378,"style":676},[492],[464,6380,2393],{"className":6381},[1803],[464,6383],{"className":6384,"style":676},[492],[464,6386,6388,6391,6394,6397,6400,6403,6406,6409],{"className":6387},[476],[464,6389],{"className":6390,"style":1934},[480],[464,6392,428],{"className":6393},[485],[464,6395,1595],{"className":6396},[1594],[464,6398],{"className":6399,"style":610},[492],[464,6401,1603],{"className":6402,"style":1602},[485,486],[464,6404],{"className":6405,"style":676},[492],[464,6407,2393],{"className":6408},[1803],[464,6410],{"className":6411,"style":676},[492],[464,6413,6415,6418,6421,6424,6427,6430],{"className":6414},[476],[464,6416],{"className":6417,"style":1210},[480],[464,6419,428],{"className":6420},[485],[464,6422,1431],{"className":6423},[1229],[464,6425],{"className":6426,"style":676},[492],[464,6428,1804],{"className":6429},[1803],[464,6431],{"className":6432,"style":676},[492],[464,6434,6436,6439],{"className":6435},[476],[464,6437],{"className":6438,"style":3449},[480],[464,6440,428],{"className":6441},[485],[381,6443,6444,6445,6502,6503,6518,6519,6521,6522,6612],{},"One of these three cases always applies, so ",[464,6446,6448],{"className":6447},[467],[464,6449,6451,6475],{"className":6450,"ariaHidden":472},[471],[464,6452,6454,6457,6460,6463,6466,6469,6472],{"className":6453},[476],[464,6455],{"className":6456,"style":1210},[480],[464,6458,5644],{"className":6459},[485],[464,6461,5572],{"className":6462,"style":700},[485,486],[464,6464,5644],{"className":6465},[485],[464,6467],{"className":6468,"style":493},[492],[464,6470,1871],{"className":6471},[497],[464,6473],{"className":6474,"style":493},[492],[464,6476,6478,6481,6487,6491,6495,6498],{"className":6477},[476],[464,6479],{"className":6480,"style":1210},[480],[464,6482,6484],{"className":6483},[1579],[464,6485,2041],{"className":6486},[485,1583],[464,6488,6490],{"className":6489},[1217],"{",[464,6492,6494],{"className":6493},[614],"…",[464,6496],{"className":6497,"style":610},[492],[464,6499,6501],{"className":6500},[1229],"}"," over the\napplicable branches. Taking ",[464,6504,6506],{"className":6505},[467],[464,6507,6509],{"className":6508,"ariaHidden":472},[471],[464,6510,6512,6515],{"className":6511},[476],[464,6513],{"className":6514,"style":1900},[480],[464,6516,5572],{"className":6517,"style":700},[485,486]," to be a ",[447,6520,834],{}," common subsequence,\n",[464,6523,6525],{"className":6524},[467],[464,6526,6528,6588],{"className":6527,"ariaHidden":472},[471],[464,6529,6531,6534,6540,6543,6546,6549,6552,6555,6558,6561,6564,6567,6570,6573,6576,6579,6582,6585],{"className":6530},[476],[464,6532],{"className":6533,"style":1210},[480],[464,6535,6537],{"className":6536},[1579],[464,6538,1629],{"className":6539},[485,1583],[464,6541,1392],{"className":6542},[1217],[464,6544,1078],{"className":6545},[485,486],[464,6547,1218],{"className":6548},[1217],[464,6550,1222],{"className":6551},[485],[464,6553,405],{"className":6554},[485,486],[464,6556,1230],{"className":6557},[1229],[464,6559,1595],{"className":6560},[1594],[464,6562],{"className":6563,"style":610},[492],[464,6565,1535],{"className":6566,"style":1534},[485,486],[464,6568,1218],{"className":6569},[1217],[464,6571,1222],{"className":6572},[485],[464,6574,1603],{"className":6575,"style":1602},[485,486],[464,6577,4358],{"className":6578},[1229],[464,6580],{"className":6581,"style":493},[492],[464,6583,1871],{"className":6584},[497],[464,6586],{"className":6587,"style":493},[492],[464,6589,6591,6594,6600,6603,6606,6609],{"className":6590},[476],[464,6592],{"className":6593,"style":1210},[480],[464,6595,6597],{"className":6596},[1579],[464,6598,2041],{"className":6599},[485,1583],[464,6601,6490],{"className":6602},[1217],[464,6604,6494],{"className":6605},[614],[464,6607],{"className":6608,"style":610},[492],[464,6610,6501],{"className":6611},[1229],". Both directions\ntogether give equality, completing the induction.",[435,6614,6616],{"id":6615},"step-4-iterative-pseudocode","Step 4: Iterative pseudocode",[381,6618,6619,6620,6663],{},"The equations are non-circular, since every entry reads strictly smaller prefixes, so\nthey convert directly into a bottom-up table fill. Allocate\n",[464,6621,6623],{"className":6622},[467],[464,6624,6626],{"className":6625,"ariaHidden":472},[471],[464,6627,6629,6632,6638,6641,6645,6648,6651,6654,6657,6660],{"className":6628},[476],[464,6630],{"className":6631,"style":1210},[480],[464,6633,6635],{"className":6634},[1579],[464,6636,1584],{"className":6637},[485,1583],[464,6639,1218],{"className":6640},[1217],[464,6642,6644],{"className":6643},[485],"0..",[464,6646,649],{"className":6647},[485,486],[464,6649,1230],{"className":6650},[1229],[464,6652,1218],{"className":6653},[1217],[464,6655,6644],{"className":6656},[485],[464,6658,815],{"className":6659},[485,486],[464,6661,1230],{"className":6662},[1229],", zero the border, then sweep:",[6665,6666,6669],"pre",{"className":6667,"code":6668,"language":387,"meta":376,"style":376},"language-algorithm shiki shiki-themes Vesper Light - Orange Boost (Quick Open Adjusted) vesper","caption: $\\textsc{LCS-Length}(A[1..m], B[1..n])$ — fill the DP table\nnumber: 1\nfor $i \\gets 0$ to $m$ do\n  $\\operatorname{OPT}[i][0] \\gets 0$ \u002F\u002F empty $B$ prefix\nfor $j \\gets 0$ to $n$ do\n  $\\operatorname{OPT}[0][j] \\gets 0$ \u002F\u002F empty $A$ prefix\nfor $i \\gets 1$ to $m$ do\n  for $j \\gets 1$ to $n$ do\n    $\\operatorname{OPT}[i][j] \\gets \\max\\bigl(\\operatorname{OPT}[i-1][j],\\ \\operatorname{OPT}[i][j-1]\\bigr)$ \u002F\u002F cases 1, 2\n    if $A[i] = B[j]$ then\n      $\\operatorname{OPT}[i][j] \\gets \\max\\bigl(\\operatorname{OPT}[i][j],\\ \\operatorname{OPT}[i-1][j-1] + 1\\bigr)$ \u002F\u002F case 3\nreturn $\\operatorname{OPT}[m][n]$\n",[385,6670,6671,6677,6682,6687,6692,6697,6702,6707,6712,6717,6722,6727],{"__ignoreMap":376},[464,6672,6674],{"class":6673,"line":6},"line",[464,6675,6676],{},"caption: $\\textsc{LCS-Length}(A[1..m], B[1..n])$ — fill the DP table\n",[464,6678,6679],{"class":6673,"line":18},[464,6680,6681],{},"number: 1\n",[464,6683,6684],{"class":6673,"line":24},[464,6685,6686],{},"for $i \\gets 0$ to $m$ do\n",[464,6688,6689],{"class":6673,"line":73},[464,6690,6691],{},"  $\\operatorname{OPT}[i][0] \\gets 0$ \u002F\u002F empty $B$ prefix\n",[464,6693,6694],{"class":6673,"line":102},[464,6695,6696],{},"for $j \\gets 0$ to $n$ do\n",[464,6698,6699],{"class":6673,"line":108},[464,6700,6701],{},"  $\\operatorname{OPT}[0][j] \\gets 0$ \u002F\u002F empty $A$ prefix\n",[464,6703,6704],{"class":6673,"line":116},[464,6705,6706],{},"for $i \\gets 1$ to $m$ do\n",[464,6708,6709],{"class":6673,"line":196},[464,6710,6711],{},"  for $j \\gets 1$ to $n$ do\n",[464,6713,6714],{"class":6673,"line":202},[464,6715,6716],{},"    $\\operatorname{OPT}[i][j] \\gets \\max\\bigl(\\operatorname{OPT}[i-1][j],\\ \\operatorname{OPT}[i][j-1]\\bigr)$ \u002F\u002F cases 1, 2\n",[464,6718,6719],{"class":6673,"line":283},[464,6720,6721],{},"    if $A[i] = B[j]$ then\n",[464,6723,6724],{"class":6673,"line":333},[464,6725,6726],{},"      $\\operatorname{OPT}[i][j] \\gets \\max\\bigl(\\operatorname{OPT}[i][j],\\ \\operatorname{OPT}[i-1][j-1] + 1\\bigr)$ \u002F\u002F case 3\n",[464,6728,6729],{"class":6673,"line":354},[464,6730,6731],{},"return $\\operatorname{OPT}[m][n]$\n",[381,6733,6734,6735,6759,6760,1293],{},"Every cell costs ",[464,6736,6738],{"className":6737},[467],[464,6739,6741],{"className":6740,"ariaHidden":472},[471],[464,6742,6744,6747,6750,6753,6756],{"className":6743},[476],[464,6745],{"className":6746,"style":1210},[480],[464,6748,1388],{"className":6749},[485],[464,6751,1392],{"className":6752},[1217],[464,6754,428],{"className":6755},[485],[464,6757,1431],{"className":6758},[1229],", so the fill is ",[464,6761,6763],{"className":6762},[467],[464,6764,6766],{"className":6765,"ariaHidden":472},[471],[464,6767,6769,6772,6775,6778,6782],{"className":6768},[476],[464,6770],{"className":6771,"style":1210},[480],[464,6773,1388],{"className":6774},[485],[464,6776,1392],{"className":6777},[1217],[464,6779,6781],{"className":6780},[485,486],"mn",[464,6783,1431],{"className":6784},[1229],[435,6786,6788],{"id":6787},"the-dp-table-filled","The DP table, filled",[381,6790,6791,6792,388,6831,6868,6869,6951,6952,6988,6989,7004,7005,7020],{},"Take ",[464,6793,6795],{"className":6794},[467],[464,6796,6798,6816],{"className":6797,"ariaHidden":472},[471],[464,6799,6801,6804,6807,6810,6813],{"className":6800},[476],[464,6802],{"className":6803,"style":481},[480],[464,6805,1078],{"className":6806},[485,486],[464,6808],{"className":6809,"style":493},[492],[464,6811,498],{"className":6812},[497],[464,6814],{"className":6815,"style":493},[492],[464,6817,6819,6823],{"className":6818},[476],[464,6820],{"className":6821,"style":6822},[480],"height:0.6111em;",[464,6824,6826],{"className":6825},[485,2566],[464,6827,6830],{"className":6828},[485,6829],"texttt","BDCAB",[464,6832,6834],{"className":6833},[467],[464,6835,6837,6855],{"className":6836,"ariaHidden":472},[471],[464,6838,6840,6843,6846,6849,6852],{"className":6839},[476],[464,6841],{"className":6842,"style":481},[480],[464,6844,1535],{"className":6845,"style":1534},[485,486],[464,6847],{"className":6848,"style":493},[492],[464,6850,498],{"className":6851},[497],[464,6853],{"className":6854,"style":493},[492],[464,6856,6858,6861],{"className":6857},[476],[464,6859],{"className":6860,"style":6822},[480],[464,6862,6864],{"className":6863},[485,2566],[464,6865,6867],{"className":6866},[485,6829],"ABCB",". We build the\n",[464,6870,6872],{"className":6871},[467],[464,6873,6875,6896,6918,6939],{"className":6874,"ariaHidden":472},[471],[464,6876,6878,6881,6884,6887,6890,6893],{"className":6877},[476],[464,6879],{"className":6880,"style":1210},[480],[464,6882,1392],{"className":6883},[1217],[464,6885,649],{"className":6886},[485,486],[464,6888],{"className":6889,"style":676},[492],[464,6891,1804],{"className":6892},[1803],[464,6894],{"className":6895,"style":676},[492],[464,6897,6899,6902,6905,6908,6911,6915],{"className":6898},[476],[464,6900],{"className":6901,"style":1210},[480],[464,6903,428],{"className":6904},[485],[464,6906,1431],{"className":6907},[1229],[464,6909],{"className":6910,"style":676},[492],[464,6912,6914],{"className":6913},[1803],"×",[464,6916],{"className":6917,"style":676},[492],[464,6919,6921,6924,6927,6930,6933,6936],{"className":6920},[476],[464,6922],{"className":6923,"style":1210},[480],[464,6925,1392],{"className":6926},[1217],[464,6928,815],{"className":6929},[485,486],[464,6931],{"className":6932,"style":676},[492],[464,6934,1804],{"className":6935},[1803],[464,6937],{"className":6938,"style":676},[492],[464,6940,6942,6945,6948],{"className":6941},[476],[464,6943],{"className":6944,"style":1210},[480],[464,6946,428],{"className":6947},[485],[464,6949,1431],{"className":6950},[1229]," table of ",[464,6953,6955],{"className":6954},[467],[464,6956,6958],{"className":6957,"ariaHidden":472},[471],[464,6959,6961,6964,6970,6973,6976,6979,6982,6985],{"className":6960},[476],[464,6962],{"className":6963,"style":1210},[480],[464,6965,6967],{"className":6966},[1579],[464,6968,1584],{"className":6969},[485,1583],[464,6971,1392],{"className":6972},[1217],[464,6974,405],{"className":6975},[485,486],[464,6977,1595],{"className":6978},[1594],[464,6980],{"className":6981,"style":610},[492],[464,6983,1603],{"className":6984,"style":1602},[485,486],[464,6986,1431],{"className":6987},[1229]," values. Row ",[464,6990,6992],{"className":6991},[467],[464,6993,6995],{"className":6994,"ariaHidden":472},[471],[464,6996,6998,7001],{"className":6997},[476],[464,6999],{"className":7000,"style":3449},[480],[464,7002,1864],{"className":7003},[485]," and column\n",[464,7006,7008],{"className":7007},[467],[464,7009,7011],{"className":7010,"ariaHidden":472},[471],[464,7012,7014,7017],{"className":7013},[476],[464,7015],{"className":7016,"style":3449},[480],[464,7018,1864],{"className":7019},[485]," are all zero (empty prefix); every other cell is filled by the recurrence. The\nshaded diagonal steps mark the matches that build the answer, and the red arrows\ntrace the reconstruction walk (Step 5) backwards from the corner.",[840,7022,7024,7431],{"className":7023},[843,844],[846,7025,7029],{"xmlns":848,"width":7026,"height":7027,"viewBox":7028},"228.622","262.238","-75 -75 171.466 196.678",[853,7030,7031,7038,7045,7052,7059,7065,7071,7077,7084,7090,7096,7102,7105,7112,7115,7121,7124,7130,7133,7139,7142,7148,7151,7157,7160,7166,7179,7182,7188,7199,7202,7208,7211,7217,7220,7226,7229,7235,7238,7244,7247,7253,7256,7262,7265,7271,7283,7286,7292,7295,7301,7312,7315,7321,7324,7330,7333,7339,7342,7348,7351,7357,7368,7371,7377,7389,7399,7407,7415,7423],{"stroke":855,"style":856},[853,7032,7034],{"transform":7033},"translate(26.14 3.125)",[864,7035],{"d":7036,"fill":855,"stroke":855,"className":7037,"style":869},"M-61.047-64.798Q-61.047-64.815-61.034-64.864L-60.836-65.519Q-61.183-65.826-61.370-66.316Q-61.557-66.806-61.612-67.318Q-61.667-67.830-61.667-68.410Q-61.667-69.750-61.278-70.752Q-60.889-71.754-59.759-71.754Q-59.360-71.754-59.021-71.574L-58.850-72.141Q-58.823-72.260-58.670-72.260Q-58.595-72.260-58.538-72.203Q-58.481-72.145-58.481-72.071Q-58.481-72.053-58.489-72.009L-58.687-71.341Q-58.186-70.897-58.024-70.131Q-57.861-69.364-57.861-68.410Q-57.861-67.597-57.997-66.876Q-58.133-66.156-58.560-65.635Q-58.986-65.114-59.759-65.114Q-60.159-65.114-60.507-65.294L-60.669-64.728Q-60.713-64.609-60.845-64.609Q-60.928-64.609-60.988-64.664Q-61.047-64.719-61.047-64.798M-58.823-70.902L-60.405-65.620Q-60.115-65.374-59.759-65.374Q-59.333-65.374-59.074-65.712Q-58.815-66.050-58.703-66.542Q-58.591-67.035-58.562-67.527Q-58.533-68.019-58.533-68.560Q-58.533-69.333-58.582-69.926Q-58.630-70.520-58.823-70.902M-60.696-65.989L-59.118-71.262Q-59.417-71.495-59.759-71.495Q-60.318-71.495-60.590-70.999Q-60.863-70.502-60.926-69.893Q-60.990-69.285-60.990-68.560Q-60.990-68.028-60.977-67.608Q-60.964-67.188-60.895-66.734Q-60.827-66.279-60.696-65.989",[868],[853,7039,7041],{"transform":7040},"translate(53.437 3.075)",[864,7042],{"d":7043,"fill":855,"stroke":855,"className":7044,"style":869},"M-59.795-65.312L-61.763-65.312L-61.763-65.628Q-61.539-65.628-61.344-65.679Q-61.148-65.729-60.997-65.850Q-60.845-65.971-60.775-66.178L-58.815-71.649Q-58.762-71.754-58.652-71.754L-58.560-71.754Q-58.450-71.754-58.397-71.649L-56.345-65.923Q-56.266-65.734-56.033-65.681Q-55.800-65.628-55.448-65.628L-55.448-65.312L-57.949-65.312L-57.949-65.628Q-57.211-65.628-57.211-65.879Q-57.211-65.905-57.219-65.923L-57.725-67.338L-60.019-67.338L-60.432-66.178Q-60.458-66.121-60.458-66.068Q-60.458-65.844-60.252-65.736Q-60.045-65.628-59.795-65.628L-59.795-65.312M-58.876-70.541L-59.909-67.650L-57.839-67.650",[868],[853,7046,7048],{"transform":7047},"translate(82.083 3.075)",[864,7049],{"d":7050,"fill":855,"stroke":855,"className":7051,"style":869},"M-58.094-65.312L-61.719-65.312L-61.719-65.628Q-60.801-65.628-60.801-65.923L-60.801-70.849Q-60.801-71.144-61.719-71.144L-61.719-71.460L-58.353-71.460Q-57.887-71.460-57.408-71.282Q-56.929-71.104-56.615-70.759Q-56.301-70.414-56.301-69.931Q-56.301-69.381-56.762-69.010Q-57.224-68.639-57.821-68.524Q-57.527-68.524-57.211-68.401Q-56.894-68.278-56.631-68.065Q-56.367-67.852-56.204-67.566Q-56.042-67.281-56.042-66.969Q-56.042-66.468-56.349-66.088Q-56.657-65.708-57.134-65.510Q-57.611-65.312-58.094-65.312M-60.010-68.379L-60.010-65.923Q-60.010-65.729-59.904-65.679Q-59.799-65.628-59.553-65.628L-58.353-65.628Q-57.993-65.628-57.670-65.809Q-57.347-65.989-57.158-66.294Q-56.969-66.600-56.969-66.969Q-56.969-67.312-57.127-67.641Q-57.285-67.971-57.578-68.175Q-57.870-68.379-58.230-68.379L-60.010-68.379M-60.010-70.849L-60.010-68.643L-58.608-68.643Q-58.059-68.643-57.630-69.014Q-57.202-69.386-57.202-69.931Q-57.202-70.256-57.353-70.531Q-57.505-70.805-57.769-70.974Q-58.032-71.144-58.353-71.144L-59.553-71.144Q-59.799-71.144-59.904-71.095Q-60.010-71.047-60.010-70.849",[868],[853,7053,7055],{"transform":7054},"translate(110.47 3.075)",[864,7056],{"d":7057,"fill":855,"stroke":855,"className":7058,"style":869},"M-59.992-66.274Q-59.672-65.883-59.197-65.657Q-58.722-65.431-58.208-65.431Q-57.646-65.431-57.189-65.714Q-56.732-65.998-56.468-66.481Q-56.204-66.964-56.204-67.509Q-56.204-67.540-56.174-67.564Q-56.143-67.588-56.112-67.588L-56.007-67.588Q-55.914-67.588-55.914-67.474Q-55.914-66.833-56.244-66.290Q-56.573-65.747-57.132-65.431Q-57.690-65.114-58.327-65.114Q-59.206-65.114-59.948-65.558Q-60.691-66.002-61.124-66.758Q-61.557-67.514-61.557-68.388Q-61.557-69.034-61.309-69.634Q-61.060-70.234-60.612-70.691Q-60.164-71.148-59.575-71.403Q-58.986-71.658-58.327-71.658Q-57.852-71.658-57.411-71.451Q-56.969-71.245-56.644-70.884L-56.121-71.623Q-56.103-71.658-56.059-71.658L-56.007-71.658Q-55.971-71.658-55.943-71.629Q-55.914-71.601-55.914-71.574L-55.914-69.144Q-55.914-69.122-55.947-69.093Q-55.980-69.065-56.007-69.065L-56.138-69.065Q-56.165-69.065-56.198-69.093Q-56.231-69.122-56.231-69.144Q-56.231-69.430-56.371-69.823Q-56.512-70.216-56.679-70.458Q-56.956-70.862-57.353-71.102Q-57.751-71.341-58.217-71.341Q-58.555-71.341-58.885-71.240Q-59.215-71.139-59.498-70.946Q-59.781-70.752-59.992-70.498Q-60.603-69.746-60.603-68.388Q-60.603-67.769-60.467-67.230Q-60.331-66.692-59.992-66.274",[868],[853,7060,7062],{"transform":7061},"translate(138.988 3.075)",[864,7063],{"d":7050,"fill":855,"stroke":855,"className":7064,"style":869},[868],[853,7066,7068],{"transform":7067},"translate(-2.312 31.578)",[864,7069],{"d":7036,"fill":855,"stroke":855,"className":7070,"style":869},[868],[853,7072,7074],{"transform":7073},"translate(-3.276 59.98)",[864,7075],{"d":7050,"fill":855,"stroke":855,"className":7076,"style":869},[868],[853,7078,7080],{"transform":7079},"translate(-3.533 88.433)",[864,7081],{"d":7082,"fill":855,"stroke":855,"className":7083,"style":869},"M-58.353-65.312L-61.728-65.312L-61.728-65.628Q-60.810-65.628-60.810-65.923L-60.810-70.849Q-60.810-71.144-61.728-71.144L-61.728-71.460L-58.353-71.460Q-57.738-71.460-57.213-71.201Q-56.688-70.941-56.312-70.500Q-55.936-70.058-55.732-69.493Q-55.528-68.929-55.528-68.327Q-55.528-67.549-55.897-66.850Q-56.266-66.151-56.914-65.732Q-57.562-65.312-58.353-65.312M-59.992-70.849L-59.992-65.923Q-59.992-65.729-59.887-65.679Q-59.781-65.628-59.531-65.628L-58.586-65.628Q-58.112-65.628-57.679-65.824Q-57.246-66.020-56.960-66.384Q-56.666-66.749-56.560-67.230Q-56.455-67.711-56.455-68.327Q-56.455-68.727-56.494-69.085Q-56.534-69.443-56.644-69.761Q-56.754-70.080-56.960-70.353Q-57.149-70.607-57.408-70.783Q-57.668-70.959-57.967-71.051Q-58.265-71.144-58.586-71.144L-59.531-71.144Q-59.781-71.144-59.887-71.095Q-59.992-71.047-59.992-70.849",[868],[853,7085,7087],{"transform":7086},"translate(-3.34 116.886)",[864,7088],{"d":7057,"fill":855,"stroke":855,"className":7089,"style":869},[868],[853,7091,7093],{"transform":7092},"translate(-3.468 145.339)",[864,7094],{"d":7043,"fill":855,"stroke":855,"className":7095,"style":869},[868],[853,7097,7099],{"transform":7098},"translate(-3.276 173.791)",[864,7100],{"d":7050,"fill":855,"stroke":855,"className":7101,"style":869},[868],[864,7103],{"fill":1028,"d":7104},"M-46.422-24.056h25.607v-25.607h-25.607Z",[853,7106,7108],{"transform":7107},"translate(26.14 31.353)",[864,7109],{"d":7110,"fill":855,"stroke":855,"className":7111,"style":869},"M-59.759-65.114Q-60.884-65.114-61.298-66.011Q-61.711-66.907-61.711-68.182Q-61.711-68.955-61.561-69.654Q-61.412-70.353-60.977-70.829Q-60.542-71.306-59.759-71.306Q-58.982-71.306-58.547-70.827Q-58.112-70.348-57.962-69.652Q-57.813-68.955-57.813-68.182Q-57.813-66.903-58.226-66.009Q-58.639-65.114-59.759-65.114M-59.759-65.374Q-59.241-65.374-58.990-65.885Q-58.740-66.397-58.683-67.008Q-58.626-67.619-58.626-68.327Q-58.626-69.012-58.683-69.572Q-58.740-70.133-58.993-70.590Q-59.245-71.047-59.759-71.047Q-60.164-71.047-60.401-70.770Q-60.638-70.493-60.746-70.052Q-60.854-69.610-60.878-69.217Q-60.902-68.823-60.902-68.327Q-60.902-67.821-60.878-67.393Q-60.854-66.964-60.746-66.481Q-60.638-65.998-60.399-65.686Q-60.159-65.374-59.759-65.374",[868],[864,7113],{"fill":1028,"d":7114},"M-17.97-24.056H7.639v-25.607h-25.607Z",[853,7116,7118],{"transform":7117},"translate(54.593 31.353)",[864,7119],{"d":7110,"fill":855,"stroke":855,"className":7120,"style":869},[868],[864,7122],{"fill":1028,"d":7123},"M10.483-24.056h25.608v-25.607H10.483Z",[853,7125,7127],{"transform":7126},"translate(83.046 31.353)",[864,7128],{"d":7110,"fill":855,"stroke":855,"className":7129,"style":869},[868],[864,7131],{"fill":1028,"d":7132},"M38.936-24.056h25.608v-25.607H38.936Z",[853,7134,7136],{"transform":7135},"translate(111.498 31.353)",[864,7137],{"d":7110,"fill":855,"stroke":855,"className":7138,"style":869},[868],[864,7140],{"fill":1028,"d":7141},"M67.389-24.056h25.607v-25.607H67.39Z",[853,7143,7145],{"transform":7144},"translate(139.951 31.353)",[864,7146],{"d":7110,"fill":855,"stroke":855,"className":7147,"style":869},[868],[864,7149],{"fill":1028,"d":7150},"M-46.422 4.397h25.607V-21.21h-25.607Z",[853,7152,7154],{"transform":7153},"translate(26.14 59.805)",[864,7155],{"d":7110,"fill":855,"stroke":855,"className":7156,"style":869},[868],[864,7158],{"fill":1028,"d":7159},"M-17.97 4.397H7.639V-21.21h-25.607Z",[853,7161,7163],{"transform":7162},"translate(54.593 59.805)",[864,7164],{"d":7110,"fill":855,"stroke":855,"className":7165,"style":869},[868],[853,7167,7169,7172],{"fill":7168},"var(--tk-soft-neutral)",[864,7170],{"d":7171},"M10.483 4.397h25.608V-21.21H10.483Z",[853,7173,7175],{"transform":7174},"translate(83.046 59.805)",[864,7176],{"d":7177,"fill":855,"stroke":855,"className":7178,"style":869},"M-58.164-65.312L-61.196-65.312L-61.196-65.628Q-60.045-65.628-60.045-65.923L-60.045-70.647Q-60.533-70.414-61.254-70.414L-61.254-70.730Q-60.124-70.730-59.562-71.306L-59.417-71.306Q-59.382-71.306-59.349-71.273Q-59.316-71.240-59.316-71.205L-59.316-65.923Q-59.316-65.628-58.164-65.628",[868],[864,7180],{"fill":1028,"d":7181},"M38.936 4.397h25.608V-21.21H38.936Z",[853,7183,7185],{"transform":7184},"translate(111.498 59.805)",[864,7186],{"d":7177,"fill":855,"stroke":855,"className":7187,"style":869},[868],[853,7189,7190,7193],{"fill":7168},[864,7191],{"d":7192},"M67.389 4.397h25.607V-21.21H67.39Z",[853,7194,7196],{"transform":7195},"translate(139.951 59.805)",[864,7197],{"d":7177,"fill":855,"stroke":855,"className":7198,"style":869},[868],[864,7200],{"fill":1028,"d":7201},"M-46.422 32.85h25.607V7.242h-25.607Z",[853,7203,7205],{"transform":7204},"translate(26.14 88.258)",[864,7206],{"d":7110,"fill":855,"stroke":855,"className":7207,"style":869},[868],[864,7209],{"fill":1028,"d":7210},"M-17.97 32.85H7.639V7.242h-25.607Z",[853,7212,7214],{"transform":7213},"translate(54.593 88.258)",[864,7215],{"d":7110,"fill":855,"stroke":855,"className":7216,"style":869},[868],[864,7218],{"fill":1028,"d":7219},"M10.483 32.85h25.608V7.242H10.483Z",[853,7221,7223],{"transform":7222},"translate(83.046 88.258)",[864,7224],{"d":7177,"fill":855,"stroke":855,"className":7225,"style":869},[868],[864,7227],{"fill":1028,"d":7228},"M38.936 32.85h25.608V7.242H38.936Z",[853,7230,7232],{"transform":7231},"translate(111.498 88.258)",[864,7233],{"d":7177,"fill":855,"stroke":855,"className":7234,"style":869},[868],[864,7236],{"fill":1028,"d":7237},"M67.389 32.85h25.607V7.242H67.39Z",[853,7239,7241],{"transform":7240},"translate(139.951 88.258)",[864,7242],{"d":7177,"fill":855,"stroke":855,"className":7243,"style":869},[868],[864,7245],{"fill":1028,"d":7246},"M-46.422 61.303h25.607V35.695h-25.607Z",[853,7248,7250],{"transform":7249},"translate(26.14 116.711)",[864,7251],{"d":7110,"fill":855,"stroke":855,"className":7252,"style":869},[868],[864,7254],{"fill":1028,"d":7255},"M-17.97 61.303H7.639V35.695h-25.607Z",[853,7257,7259],{"transform":7258},"translate(54.593 116.711)",[864,7260],{"d":7110,"fill":855,"stroke":855,"className":7261,"style":869},[868],[864,7263],{"fill":1028,"d":7264},"M10.483 61.303h25.608V35.695H10.483Z",[853,7266,7268],{"transform":7267},"translate(83.046 116.711)",[864,7269],{"d":7177,"fill":855,"stroke":855,"className":7270,"style":869},[868],[853,7272,7273,7276],{"fill":7168},[864,7274],{"d":7275},"M38.936 61.303h25.608V35.695H38.936Z",[853,7277,7279],{"transform":7278},"translate(111.498 116.711)",[864,7280],{"d":7281,"fill":855,"stroke":855,"className":7282,"style":869},"M-58.164-65.312L-61.614-65.312L-61.614-65.545Q-61.614-65.558-61.583-65.589L-60.129-67.166Q-59.663-67.663-59.410-67.968Q-59.157-68.274-58.966-68.685Q-58.775-69.096-58.775-69.535Q-58.775-70.124-59.098-70.557Q-59.421-70.990-60.001-70.990Q-60.265-70.990-60.511-70.880Q-60.757-70.770-60.933-70.583Q-61.109-70.396-61.205-70.146L-61.126-70.146Q-60.924-70.146-60.781-70.010Q-60.638-69.874-60.638-69.658Q-60.638-69.452-60.781-69.313Q-60.924-69.175-61.126-69.175Q-61.328-69.175-61.471-69.318Q-61.614-69.460-61.614-69.658Q-61.614-70.120-61.377-70.493Q-61.139-70.867-60.739-71.086Q-60.340-71.306-59.891-71.306Q-59.368-71.306-58.914-71.091Q-58.459-70.875-58.186-70.476Q-57.914-70.076-57.914-69.535Q-57.914-69.140-58.085-68.786Q-58.257-68.432-58.522-68.153Q-58.788-67.874-59.239-67.489Q-59.689-67.105-59.768-67.030L-60.792-66.068L-59.975-66.068Q-59.324-66.068-58.887-66.079Q-58.450-66.090-58.419-66.112Q-58.349-66.195-58.294-66.435Q-58.239-66.674-58.199-66.942L-57.914-66.942",[868],[864,7284],{"fill":1028,"d":7285},"M67.389 61.303h25.607V35.695H67.39Z",[853,7287,7289],{"transform":7288},"translate(139.951 116.711)",[864,7290],{"d":7281,"fill":855,"stroke":855,"className":7291,"style":869},[868],[864,7293],{"fill":1028,"d":7294},"M-46.422 89.755h25.607V64.148h-25.607Z",[853,7296,7298],{"transform":7297},"translate(26.14 145.164)",[864,7299],{"d":7110,"fill":855,"stroke":855,"className":7300,"style":869},[868],[853,7302,7303,7306],{"fill":7168},[864,7304],{"d":7305},"M-17.97 89.755H7.639V64.148h-25.607Z",[853,7307,7309],{"transform":7308},"translate(54.593 145.164)",[864,7310],{"d":7177,"fill":855,"stroke":855,"className":7311,"style":869},[868],[864,7313],{"fill":1028,"d":7314},"M10.483 89.755h25.608V64.148H10.483Z",[853,7316,7318],{"transform":7317},"translate(83.046 145.164)",[864,7319],{"d":7177,"fill":855,"stroke":855,"className":7320,"style":869},[868],[864,7322],{"fill":1028,"d":7323},"M38.936 89.755h25.608V64.148H38.936Z",[853,7325,7327],{"transform":7326},"translate(111.498 145.164)",[864,7328],{"d":7281,"fill":855,"stroke":855,"className":7329,"style":869},[868],[864,7331],{"fill":1028,"d":7332},"M67.389 89.755h25.607V64.148H67.39Z",[853,7334,7336],{"transform":7335},"translate(139.951 145.164)",[864,7337],{"d":7281,"fill":855,"stroke":855,"className":7338,"style":869},[868],[864,7340],{"fill":1028,"d":7341},"M-46.422 118.208h25.607V92.601h-25.607Z",[853,7343,7345],{"transform":7344},"translate(26.14 173.616)",[864,7346],{"d":7110,"fill":855,"stroke":855,"className":7347,"style":869},[868],[864,7349],{"fill":1028,"d":7350},"M-17.97 118.208H7.639V92.601h-25.607Z",[853,7352,7354],{"transform":7353},"translate(54.593 173.616)",[864,7355],{"d":7177,"fill":855,"stroke":855,"className":7356,"style":869},[868],[853,7358,7359,7362],{"fill":7168},[864,7360],{"d":7361},"M10.483 118.208h25.608V92.601H10.483Z",[853,7363,7365],{"transform":7364},"translate(83.046 173.616)",[864,7366],{"d":7281,"fill":855,"stroke":855,"className":7367,"style":869},[868],[864,7369],{"fill":1028,"d":7370},"M38.936 118.208h25.608V92.601H38.936Z",[853,7372,7374],{"transform":7373},"translate(111.498 173.616)",[864,7375],{"d":7281,"fill":855,"stroke":855,"className":7376,"style":869},[868],[853,7378,7379,7382],{"fill":7168},[864,7380],{"d":7381},"M67.389 118.208h25.607V92.601H67.39Z",[853,7383,7385],{"transform":7384},"translate(139.951 173.616)",[864,7386],{"d":7387,"fill":855,"stroke":855,"className":7388,"style":869},"M-61.170-66.033L-61.214-66.033Q-61.012-65.716-60.625-65.558Q-60.238-65.400-59.812-65.400Q-59.276-65.400-59.037-65.835Q-58.797-66.270-58.797-66.850Q-58.797-67.430-59.043-67.870Q-59.289-68.309-59.821-68.309L-60.441-68.309Q-60.467-68.309-60.500-68.338Q-60.533-68.366-60.533-68.388L-60.533-68.489Q-60.533-68.520-60.504-68.544Q-60.476-68.568-60.441-68.568L-59.922-68.608Q-59.456-68.608-59.210-69.080Q-58.964-69.553-58.964-70.071Q-58.964-70.498-59.177-70.772Q-59.390-71.047-59.812-71.047Q-60.155-71.047-60.480-70.917Q-60.805-70.788-60.990-70.533L-60.964-70.533Q-60.761-70.533-60.625-70.392Q-60.489-70.251-60.489-70.054Q-60.489-69.856-60.623-69.722Q-60.757-69.588-60.955-69.588Q-61.157-69.588-61.295-69.722Q-61.434-69.856-61.434-70.054Q-61.434-70.643-60.931-70.974Q-60.427-71.306-59.812-71.306Q-59.434-71.306-59.032-71.166Q-58.630-71.025-58.362-70.746Q-58.094-70.467-58.094-70.071Q-58.094-69.522-58.448-69.085Q-58.801-68.647-59.342-68.463Q-58.951-68.384-58.606-68.160Q-58.261-67.936-58.050-67.595Q-57.839-67.254-57.839-66.859Q-57.839-66.477-58.002-66.154Q-58.164-65.831-58.456-65.595Q-58.749-65.360-59.096-65.237Q-59.443-65.114-59.812-65.114Q-60.260-65.114-60.691-65.275Q-61.122-65.435-61.403-65.762Q-61.684-66.090-61.684-66.547Q-61.684-66.762-61.537-66.905Q-61.390-67.048-61.170-67.048Q-60.959-67.048-60.814-66.903Q-60.669-66.758-60.669-66.547Q-60.669-66.336-60.816-66.184Q-60.964-66.033-61.170-66.033",[868],[853,7390,7392,7395],{"fill":7391,"stroke":7391,"style":1030},"var(--tk-warn)",[864,7393],{"fill":1028,"d":7394},"M73.755 98.966 60.66 85.873",[864,7396],{"d":7397,"style":7398},"m58.984 84.195 1.43 3.179.106-1.642 1.642-.105Z","stroke-width:.799992",[853,7400,7401,7404],{"fill":7391,"stroke":7391,"style":1030},[864,7402],{"fill":1028,"d":7403},"M51.74 67.847v-6.731",[864,7405],{"d":7406},"m51.74 58.743-1.236 3.26 1.236-1.087 1.235 1.087Z",[853,7408,7409,7412],{"fill":7391,"stroke":7391,"style":1030},[864,7410],{"fill":1028,"d":7411},"M45.302 42.06 32.208 28.969",[864,7413],{"d":7414,"style":7398},"m30.53 27.29 1.432 3.178.105-1.642 1.642-.105Z",[853,7416,7417,7420],{"fill":7391,"stroke":7391,"style":1030},[864,7418],{"fill":1028,"d":7419},"M23.287 10.941v-6.73",[864,7421],{"d":7422},"m23.287 1.837-1.235 3.26 1.235-1.087 1.236 1.087Z",[853,7424,7425,7428],{"fill":7391,"stroke":7391,"style":1030},[864,7426],{"fill":1028,"d":7427},"M16.849-14.845 3.756-27.938",[864,7429],{"d":7430,"style":7398},"m2.078-29.616 1.431 3.179.105-1.642 1.643-.105Z",[1058,7432,7434,7435,388,7463,7487],{"className":7433},[1061],"Filled LCS table for ",[464,7436,7438],{"className":7437},[467],[464,7439,7441],{"className":7440,"ariaHidden":472},[471],[464,7442,7444,7447,7450,7454,7457,7460],{"className":7443},[476],[464,7445],{"className":7446,"style":481},[480],[464,7448,1535],{"className":7449,"style":1534},[485,486],[464,7451,7453],{"className":7452,"style":1119},[485,486],"D",[464,7455,1186],{"className":7456,"style":1185},[485,486],[464,7458,1078],{"className":7459},[485,486],[464,7461,1535],{"className":7462,"style":1534},[485,486],[464,7464,7466],{"className":7465},[467],[464,7467,7469],{"className":7468,"ariaHidden":472},[471],[464,7470,7472,7475,7478,7481,7484],{"className":7471},[476],[464,7473],{"className":7474,"style":481},[480],[464,7476,1078],{"className":7477},[485,486],[464,7479,1535],{"className":7480,"style":1534},[485,486],[464,7482,1186],{"className":7483,"style":1185},[485,486],[464,7485,1535],{"className":7486,"style":1534},[485,486]," with the traceback path arrowed.",[381,7489,7490,7491,7548,7549,388,7551,7553,7554,7569,7570,7573,7574,7577,7578,7580,7581,7580,7583,7585],{},"The bottom-right entry reads ",[464,7492,7494],{"className":7493},[467],[464,7495,7497,7538],{"className":7496,"ariaHidden":472},[471],[464,7498,7500,7503,7509,7512,7516,7519,7522,7526,7529,7532,7535],{"className":7499},[476],[464,7501],{"className":7502,"style":1210},[480],[464,7504,7506],{"className":7505},[1579],[464,7507,1584],{"className":7508},[485,1583],[464,7510,1392],{"className":7511},[1217],[464,7513,7515],{"className":7514},[485],"5",[464,7517,1595],{"className":7518},[1594],[464,7520],{"className":7521,"style":610},[492],[464,7523,7525],{"className":7524},[485],"4",[464,7527,1431],{"className":7528},[1229],[464,7530],{"className":7531,"style":493},[492],[464,7533,498],{"className":7534},[497],[464,7536],{"className":7537,"style":493},[492],[464,7539,7541,7544],{"className":7540},[476],[464,7542],{"className":7543,"style":3449},[480],[464,7545,7547],{"className":7546},[485],"3",": the longest common\nsubsequence of ",[385,7550,6830],{},[385,7552,6867],{}," has length ",[464,7555,7557],{"className":7556},[467],[464,7558,7560],{"className":7559,"ariaHidden":472},[471],[464,7561,7563,7566],{"className":7562},[476],[464,7564],{"className":7565,"style":3449},[480],[464,7567,7547],{"className":7568},[485],", namely ",[385,7571,7572],{},"BCB"," (the only one here,\nthough in general there may be ties). The arrows enter each shaded ",[411,7575,7576],{},"match"," cell\ndiagonally (emitting ",[385,7579,1535],{},", then ",[385,7582,1186],{},[385,7584,1535],{},", read from the corner upward) and step\nstraight up or left through non-match cells, exactly as the reconstruction below\nprescribes.",[435,7587,7589],{"id":7588},"step-5-reconstructing-the-subsequence","Step 5: Reconstructing the subsequence",[381,7591,7592,7593,7595,7596,7599,7600,7603,7604,7640,7641,7671,7672,7723,7724,7790,7791,7809],{},"The table gives the ",[447,7594,1477],{},"; this is where the Step 0 simplification is paid back.\nIn a ",[411,7597,7598],{},"second pass"," we walk ",[411,7601,7602],{},"backwards"," from ",[464,7605,7607],{"className":7606},[467],[464,7608,7610],{"className":7609,"ariaHidden":472},[471],[464,7611,7613,7616,7622,7625,7628,7631,7634,7637],{"className":7612},[476],[464,7614],{"className":7615,"style":1210},[480],[464,7617,7619],{"className":7618},[1579],[464,7620,1584],{"className":7621},[485,1583],[464,7623,1392],{"className":7624},[1217],[464,7626,649],{"className":7627},[485,486],[464,7629,1595],{"className":7630},[1594],[464,7632],{"className":7633,"style":610},[492],[464,7635,815],{"className":7636},[485,486],[464,7638,1431],{"className":7639},[1229],", undoing\nthe recurrence. At cell ",[464,7642,7644],{"className":7643},[467],[464,7645,7647],{"className":7646,"ariaHidden":472},[471],[464,7648,7650,7653,7656,7659,7662,7665,7668],{"className":7649},[476],[464,7651],{"className":7652,"style":1210},[480],[464,7654,1392],{"className":7655},[1217],[464,7657,405],{"className":7658},[485,486],[464,7660,1595],{"className":7661},[1594],[464,7663],{"className":7664,"style":610},[492],[464,7666,1603],{"className":7667,"style":1602},[485,486],[464,7669,1431],{"className":7670},[1229],": if ",[464,7673,7675],{"className":7674},[467],[464,7676,7678,7705],{"className":7677,"ariaHidden":472},[471],[464,7679,7681,7684,7687,7690,7693,7696,7699,7702],{"className":7680},[476],[464,7682],{"className":7683,"style":1210},[480],[464,7685,1078],{"className":7686},[485,486],[464,7688,1218],{"className":7689},[1217],[464,7691,405],{"className":7692},[485,486],[464,7694,1230],{"className":7695},[1229],[464,7697],{"className":7698,"style":493},[492],[464,7700,498],{"className":7701},[497],[464,7703],{"className":7704,"style":493},[492],[464,7706,7708,7711,7714,7717,7720],{"className":7707},[476],[464,7709],{"className":7710,"style":1210},[480],[464,7712,1535],{"className":7713,"style":1534},[485,486],[464,7715,1218],{"className":7716},[1217],[464,7718,1603],{"className":7719,"style":1602},[485,486],[464,7721,1230],{"className":7722},[1229],", that character belongs to the\nLCS — emit it and step diagonally to ",[464,7725,7727],{"className":7726},[467],[464,7728,7730,7751,7778],{"className":7729,"ariaHidden":472},[471],[464,7731,7733,7736,7739,7742,7745,7748],{"className":7732},[476],[464,7734],{"className":7735,"style":1210},[480],[464,7737,1392],{"className":7738},[1217],[464,7740,405],{"className":7741},[485,486],[464,7743],{"className":7744,"style":676},[492],[464,7746,2393],{"className":7747},[1803],[464,7749],{"className":7750,"style":676},[492],[464,7752,7754,7757,7760,7763,7766,7769,7772,7775],{"className":7753},[476],[464,7755],{"className":7756,"style":1934},[480],[464,7758,428],{"className":7759},[485],[464,7761,1595],{"className":7762},[1594],[464,7764],{"className":7765,"style":610},[492],[464,7767,1603],{"className":7768,"style":1602},[485,486],[464,7770],{"className":7771,"style":676},[492],[464,7773,2393],{"className":7774},[1803],[464,7776],{"className":7777,"style":676},[492],[464,7779,7781,7784,7787],{"className":7780},[476],[464,7782],{"className":7783,"style":1210},[480],[464,7785,428],{"className":7786},[485],[464,7788,1431],{"className":7789},[1229]," (case 3); otherwise move to\nwhichever neighbor, up or left, holds the larger value (the one the ",[464,7792,7794],{"className":7793},[467],[464,7795,7797],{"className":7796,"ariaHidden":472},[471],[464,7798,7800,7803],{"className":7799},[476],[464,7801],{"className":7802,"style":1900},[480],[464,7804,7806],{"className":7805},[1579],[464,7807,2041],{"className":7808},[485,1583]," of cases\n1 and 2 chose).",[6665,7811,7813],{"className":6667,"code":7812,"language":387,"meta":376,"style":376},"caption: $\\textsc{LCS-Reconstruct}(A, B, \\operatorname{OPT}, i, j)$ — recover the subsequence\nnumber: 2\nif $i = 0$ or $j = 0$ then\n  return the empty string \u002F\u002F empty prefix\nif $A[i] = B[j]$ then\n  return $\\textsc{LCS-Reconstruct}(A, B, \\operatorname{OPT}, i-1, j-1)$ followed by $A[i]$ \u002F\u002F case 3 match\nelse if $\\operatorname{OPT}[i-1][j] \\ge \\operatorname{OPT}[i][j-1]$ then\n  return $\\textsc{LCS-Reconstruct}(A, B, \\operatorname{OPT}, i-1, j)$ \u002F\u002F from above (case 1)\nelse\n  return $\\textsc{LCS-Reconstruct}(A, B, \\operatorname{OPT}, i, j-1)$ \u002F\u002F from left (case 2)\n",[385,7814,7815,7820,7825,7830,7835,7840,7845,7850,7855,7860],{"__ignoreMap":376},[464,7816,7817],{"class":6673,"line":6},[464,7818,7819],{},"caption: $\\textsc{LCS-Reconstruct}(A, B, \\operatorname{OPT}, i, j)$ — recover the subsequence\n",[464,7821,7822],{"class":6673,"line":18},[464,7823,7824],{},"number: 2\n",[464,7826,7827],{"class":6673,"line":24},[464,7828,7829],{},"if $i = 0$ or $j = 0$ then\n",[464,7831,7832],{"class":6673,"line":73},[464,7833,7834],{},"  return the empty string \u002F\u002F empty prefix\n",[464,7836,7837],{"class":6673,"line":102},[464,7838,7839],{},"if $A[i] = B[j]$ then\n",[464,7841,7842],{"class":6673,"line":108},[464,7843,7844],{},"  return $\\textsc{LCS-Reconstruct}(A, B, \\operatorname{OPT}, i-1, j-1)$ followed by $A[i]$ \u002F\u002F case 3 match\n",[464,7846,7847],{"class":6673,"line":116},[464,7848,7849],{},"else if $\\operatorname{OPT}[i-1][j] \\ge \\operatorname{OPT}[i][j-1]$ then\n",[464,7851,7852],{"class":6673,"line":196},[464,7853,7854],{},"  return $\\textsc{LCS-Reconstruct}(A, B, \\operatorname{OPT}, i-1, j)$ \u002F\u002F from above (case 1)\n",[464,7856,7857],{"class":6673,"line":202},[464,7858,7859],{},"else\n",[464,7861,7862],{"class":6673,"line":283},[464,7863,7864],{},"  return $\\textsc{LCS-Reconstruct}(A, B, \\operatorname{OPT}, i, j-1)$ \u002F\u002F from left (case 2)\n",[381,7866,7867,7868,7911],{},"The walk takes one step toward the origin each call, so it runs in ",[464,7869,7871],{"className":7870},[467],[464,7872,7874,7899],{"className":7873,"ariaHidden":472},[471],[464,7875,7877,7880,7884,7887,7890,7893,7896],{"className":7876},[476],[464,7878],{"className":7879,"style":1210},[480],[464,7881,7883],{"className":7882,"style":1119},[485,486],"O",[464,7885,1392],{"className":7886},[1217],[464,7888,649],{"className":7889},[485,486],[464,7891],{"className":7892,"style":676},[492],[464,7894,1804],{"className":7895},[1803],[464,7897],{"className":7898,"style":676},[492],[464,7900,7902,7905,7908],{"className":7901},[476],[464,7903],{"className":7904,"style":1210},[480],[464,7906,815],{"className":7907},[485,486],[464,7909,1431],{"className":7910},[1229],"\ntime, cheap compared with building the table.",[435,7913,7915],{"id":7914},"running-time-and-space","Running time and space",[381,7917,7918,7919,7985,7986,8010,8011,8029],{},"The table has ",[464,7920,7922],{"className":7921},[467],[464,7923,7925,7946,7973],{"className":7924,"ariaHidden":472},[471],[464,7926,7928,7931,7934,7937,7940,7943],{"className":7927},[476],[464,7929],{"className":7930,"style":1210},[480],[464,7932,1392],{"className":7933},[1217],[464,7935,649],{"className":7936},[485,486],[464,7938],{"className":7939,"style":676},[492],[464,7941,1804],{"className":7942},[1803],[464,7944],{"className":7945,"style":676},[492],[464,7947,7949,7952,7955,7958,7961,7964,7967,7970],{"className":7948},[476],[464,7950],{"className":7951,"style":1210},[480],[464,7953,428],{"className":7954},[485],[464,7956,1431],{"className":7957},[1229],[464,7959,1392],{"className":7960},[1217],[464,7962,815],{"className":7963},[485,486],[464,7965],{"className":7966,"style":676},[492],[464,7968,1804],{"className":7969},[1803],[464,7971],{"className":7972,"style":676},[492],[464,7974,7976,7979,7982],{"className":7975},[476],[464,7977],{"className":7978,"style":1210},[480],[464,7980,428],{"className":7981},[485],[464,7983,1431],{"className":7984},[1229]," entries, and each is computed in ",[464,7987,7989],{"className":7988},[467],[464,7990,7992],{"className":7991,"ariaHidden":472},[471],[464,7993,7995,7998,8001,8004,8007],{"className":7994},[476],[464,7996],{"className":7997,"style":1210},[480],[464,7999,1388],{"className":8000},[485],[464,8002,1392],{"className":8003},[1217],[464,8005,428],{"className":8006},[485],[464,8008,1431],{"className":8009},[1229],": a\ncomparison and a ",[464,8012,8014],{"className":8013},[467],[464,8015,8017],{"className":8016,"ariaHidden":472},[471],[464,8018,8020,8023],{"className":8019},[476],[464,8021],{"className":8022,"style":1900},[480],[464,8024,8026],{"className":8025},[1579],[464,8027,2041],{"className":8028},[485,1583],". Therefore LCS runs in",[464,8031,8033],{"className":8032},[2046],[464,8034,8036],{"className":8035},[467],[464,8037,8039],{"className":8038,"ariaHidden":472},[471],[464,8040,8042,8045,8048,8051,8054],{"className":8041},[476],[464,8043],{"className":8044,"style":1210},[480],[464,8046,1388],{"className":8047},[485],[464,8049,1392],{"className":8050},[1217],[464,8052,6781],{"className":8053},[485,486],[464,8055,1431],{"className":8056},[1229],[381,8058,8059,8060,8084,8085,8087,8088,8132,8133,8157],{},"time, with ",[464,8061,8063],{"className":8062},[467],[464,8064,8066],{"className":8065,"ariaHidden":472},[471],[464,8067,8069,8072,8075,8078,8081],{"className":8068},[476],[464,8070],{"className":8071,"style":1210},[480],[464,8073,1388],{"className":8074},[485],[464,8076,1392],{"className":8077},[1217],[464,8079,6781],{"className":8080},[485,486],[464,8082,1431],{"className":8083},[1229]," space for the full table. If only the ",[447,8086,1477],{}," is wanted,\nnote that each row depends only on the row above it, so two rows, giving ",[464,8089,8091],{"className":8090},[467],[464,8092,8094],{"className":8093,"ariaHidden":472},[471],[464,8095,8097,8100,8103,8106,8113,8116,8119,8122,8125,8128],{"className":8096},[476],[464,8098],{"className":8099,"style":1210},[480],[464,8101,1388],{"className":8102},[485],[464,8104,1392],{"className":8105},[1217],[464,8107,8109],{"className":8108},[1579],[464,8110,8112],{"className":8111},[485,1583],"min",[464,8114,1392],{"className":8115},[1217],[464,8117,649],{"className":8118},[485,486],[464,8120,1595],{"className":8121},[1594],[464,8123],{"className":8124,"style":610},[492],[464,8126,815],{"className":8127},[485,486],[464,8129,8131],{"className":8130},[1229],"))"," space, suffice. The catch, common to all such DPs: this space trick\ndiscards the information needed to reconstruct the subsequence. (Hirschberg's\ndivide-and-conquer refinement recovers the actual LCS in ",[464,8134,8136],{"className":8135},[467],[464,8137,8139],{"className":8138,"ariaHidden":472},[471],[464,8140,8142,8145,8148,8151,8154],{"className":8141},[476],[464,8143],{"className":8144,"style":1210},[480],[464,8146,1388],{"className":8147},[485],[464,8149,1392],{"className":8150},[1217],[464,8152,6781],{"className":8153},[485,486],[464,8155,1431],{"className":8156},[1229]," time and\nonly linear space, but that is a topic for later.)",[435,8159,8161],{"id":8160},"the-same-machine-edit-distance","The same machine: edit distance",[381,8163,8164,8167,8168,8171,8172,8175,8176,8179,8180,8183,8184,8199,8200,8215,8216,8223,8224,8226,8227,8230],{},[411,8165,8166],{},"Edit distance"," (the ",[411,8169,8170],{},"Levenshtein distance",") asks the closely related\nquestion: what is the minimum number of single-character ",[411,8173,8174],{},"insertions",",\n",[411,8177,8178],{},"deletions",", and ",[411,8181,8182],{},"substitutions"," that transform ",[464,8185,8187],{"className":8186},[467],[464,8188,8190],{"className":8189,"ariaHidden":472},[471],[464,8191,8193,8196],{"className":8192},[476],[464,8194],{"className":8195,"style":481},[480],[464,8197,1078],{"className":8198},[485,486]," into ",[464,8201,8203],{"className":8202},[467],[464,8204,8206],{"className":8205,"ariaHidden":472},[471],[464,8207,8209,8212],{"className":8208},[476],[464,8210],{"className":8211,"style":481},[480],[464,8213,1535],{"className":8214,"style":1534},[485,486],"?",[420,8217,8218],{},[395,8219,7547],{"href":8220,"ariaDescribedBy":8221,"dataFootnoteRef":376,"id":8222},"#user-content-fn-erickson-editdist",[426],"user-content-fnref-erickson-editdist"," It is the cost\nmodel behind spell-checkers and ",[385,8225,417],{},", and it is ",[447,8228,8229],{},"structurally identical"," to LCS.",[1189,8232,8233],{"type":1557},[381,8234,8235,1563,8238,8271,8272,388,8299,1293],{},[411,8236,8237],{},"Definition (Edit distance).",[464,8239,8241],{"className":8240},[467],[464,8242,8244],{"className":8243,"ariaHidden":472},[471],[464,8245,8247,8250,8253,8256,8259,8262,8265,8268],{"className":8246},[476],[464,8248],{"className":8249,"style":1210},[480],[464,8251,7453],{"className":8252,"style":1119},[485,486],[464,8254,1392],{"className":8255},[1217],[464,8257,405],{"className":8258},[485,486],[464,8260,1595],{"className":8261},[1594],[464,8263],{"className":8264,"style":610},[492],[464,8266,1603],{"className":8267,"style":1602},[485,486],[464,8269,1431],{"className":8270},[1229]," be the edit distance between the prefixes ",[464,8273,8275],{"className":8274},[467],[464,8276,8278],{"className":8277,"ariaHidden":472},[471],[464,8279,8281,8284,8287,8290,8293,8296],{"className":8280},[476],[464,8282],{"className":8283,"style":1210},[480],[464,8285,1078],{"className":8286},[485,486],[464,8288,1218],{"className":8289},[1217],[464,8291,1222],{"className":8292},[485],[464,8294,405],{"className":8295},[485,486],[464,8297,1230],{"className":8298},[1229],[464,8300,8302],{"className":8301},[467],[464,8303,8305],{"className":8304,"ariaHidden":472},[471],[464,8306,8308,8311,8314,8317,8320,8323],{"className":8307},[476],[464,8309],{"className":8310,"style":1210},[480],[464,8312,1535],{"className":8313,"style":1534},[485,486],[464,8315,1218],{"className":8316},[1217],[464,8318,1222],{"className":8319},[485],[464,8321,1603],{"className":8322,"style":1602},[485,486],[464,8324,1230],{"className":8325},[1229],[381,8327,8328,8329,8380,8381,8405,8406,8430,8431,8483,8484,8499],{},"Again we look at the last characters. If ",[464,8330,8332],{"className":8331},[467],[464,8333,8335,8362],{"className":8334,"ariaHidden":472},[471],[464,8336,8338,8341,8344,8347,8350,8353,8356,8359],{"className":8337},[476],[464,8339],{"className":8340,"style":1210},[480],[464,8342,1078],{"className":8343},[485,486],[464,8345,1218],{"className":8346},[1217],[464,8348,405],{"className":8349},[485,486],[464,8351,1230],{"className":8352},[1229],[464,8354],{"className":8355,"style":493},[492],[464,8357,498],{"className":8358},[497],[464,8360],{"className":8361,"style":493},[492],[464,8363,8365,8368,8371,8374,8377],{"className":8364},[476],[464,8366],{"className":8367,"style":1210},[480],[464,8369,1535],{"className":8370,"style":1534},[485,486],[464,8372,1218],{"className":8373},[1217],[464,8375,1603],{"className":8376,"style":1602},[485,486],[464,8378,1230],{"className":8379},[1229],", they need no edit and we\nalign them for free. Otherwise we make one of three moves (delete ",[464,8382,8384],{"className":8383},[467],[464,8385,8387],{"className":8386,"ariaHidden":472},[471],[464,8388,8390,8393,8396,8399,8402],{"className":8389},[476],[464,8391],{"className":8392,"style":1210},[480],[464,8394,1078],{"className":8395},[485,486],[464,8397,1218],{"className":8398},[1217],[464,8400,405],{"className":8401},[485,486],[464,8403,1230],{"className":8404},[1229],", insert\n",[464,8407,8409],{"className":8408},[467],[464,8410,8412],{"className":8411,"ariaHidden":472},[471],[464,8413,8415,8418,8421,8424,8427],{"className":8414},[476],[464,8416],{"className":8417,"style":1210},[480],[464,8419,1535],{"className":8420,"style":1534},[485,486],[464,8422,1218],{"className":8423},[1217],[464,8425,1603],{"className":8426,"style":1602},[485,486],[464,8428,1230],{"className":8429},[1229],", or substitute ",[464,8432,8434],{"className":8433},[467],[464,8435,8437,8465],{"className":8436,"ariaHidden":472},[471],[464,8438,8440,8443,8446,8449,8452,8455,8458,8462],{"className":8439},[476],[464,8441],{"className":8442,"style":1210},[480],[464,8444,1078],{"className":8445},[485,486],[464,8447,1218],{"className":8448},[1217],[464,8450,405],{"className":8451},[485,486],[464,8453,1230],{"className":8454},[1229],[464,8456],{"className":8457,"style":493},[492],[464,8459,8461],{"className":8460},[497],"→",[464,8463],{"className":8464,"style":493},[492],[464,8466,8468,8471,8474,8477,8480],{"className":8467},[476],[464,8469],{"className":8470,"style":1210},[480],[464,8472,1535],{"className":8473,"style":1534},[485,486],[464,8475,1218],{"className":8476},[1217],[464,8478,1603],{"className":8479,"style":1602},[485,486],[464,8481,1230],{"className":8482},[1229],"), each at cost ",[464,8485,8487],{"className":8486},[467],[464,8488,8490],{"className":8489,"ariaHidden":472},[471],[464,8491,8493,8496],{"className":8492},[476],[464,8494],{"className":8495,"style":3449},[480],[464,8497,428],{"className":8498},[485],", and recurse on the\ncorrespondingly shorter prefixes:",[464,8501,8503],{"className":8502},[2046],[464,8504,8506],{"className":8505},[467],[464,8507,8509,8545],{"className":8508,"ariaHidden":472},[471],[464,8510,8512,8515,8518,8521,8524,8527,8530,8533,8536,8539,8542],{"className":8511},[476],[464,8513],{"className":8514,"style":1210},[480],[464,8516,7453],{"className":8517,"style":1119},[485,486],[464,8519,1392],{"className":8520},[1217],[464,8522,405],{"className":8523},[485,486],[464,8525,1595],{"className":8526},[1594],[464,8528],{"className":8529,"style":610},[492],[464,8531,1603],{"className":8532,"style":1602},[485,486],[464,8534,1431],{"className":8535},[1229],[464,8537],{"className":8538,"style":493},[492],[464,8540,498],{"className":8541},[497],[464,8543],{"className":8544,"style":493},[492],[464,8546,8548,8552],{"className":8547},[476],[464,8549],{"className":8550,"style":8551},[480],"height:9.6em;vertical-align:-4.55em;",[464,8553,8555,8643,9352],{"className":8554},[614],[464,8556,8558],{"className":8557},[1217],[464,8559,8561],{"className":8560},[1636,2108],[464,8562,8564,8634],{"className":8563},[523,524],[464,8565,8567,8631],{"className":8566},[528],[464,8568,8571,8582,8597,8608,8620],{"className":8569,"style":8570},[532],"height:5.05em;",[464,8572,8573,8577],{"style":2121},[464,8574],{"className":8575,"style":8576},[540],"height:5.016em;",[464,8578,8580],{"className":8579},[2129,2130],[464,8581,2133],{},[464,8583,8584,8587],{"style":2136},[464,8585],{"className":8586,"style":8576},[540],[464,8588,8590],{"style":8589},"height:3.016em;width:0.8889em;",[846,8591,8594],{"xmlns":848,"width":2145,"height":8592,"style":2147,"viewBox":8593,"preserveAspectRatio":2149},"3.016em","0 0 888.89 3016",[864,8595],{"d":8596},"M384 0 H504 V3016 H384z M384 0 H504 V3016 H384z",[464,8598,8600,8603],{"style":8599},"top:-5.016em;",[464,8601],{"className":8602,"style":8576},[540],[464,8604,8606],{"className":8605},[2129,2130],[464,8607,2164],{},[464,8609,8611,8614],{"style":8610},"top:-6.158em;",[464,8612],{"className":8613,"style":8576},[540],[464,8615,8616],{"style":8589},[846,8617,8618],{"xmlns":848,"width":2145,"height":8592,"style":2147,"viewBox":8593,"preserveAspectRatio":2149},[864,8619],{"d":8596},[464,8621,8623,8626],{"style":8622},"top:-9.166em;",[464,8624],{"className":8625,"style":8576},[540],[464,8627,8629],{"className":8628},[2129,2130],[464,8630,2188],{},[464,8632,556],{"className":8633},[555],[464,8635,8637],{"className":8636},[528],[464,8638,8641],{"className":8639,"style":8640},[532],"height:4.55em;",[464,8642],{},[464,8644,8646],{"className":8645},[485],[464,8647,8649,9129,9132],{"className":8648},[2207],[464,8650,8652],{"className":8651},[2211],[464,8653,8655,9120],{"className":8654},[523,524],[464,8656,8658,9117],{"className":8657},[528],[464,8659,8662,8674,8686,8740],{"className":8660,"style":8661},[532],"height:5.02em;",[464,8663,8665,8668],{"style":8664},"top:-8.422em;",[464,8666],{"className":8667,"style":2228},[540],[464,8669,8671],{"className":8670},[485],[464,8672,405],{"className":8673},[485,486],[464,8675,8677,8680],{"style":8676},"top:-6.682em;",[464,8678],{"className":8679,"style":2228},[540],[464,8681,8683],{"className":8682},[485],[464,8684,1603],{"className":8685,"style":1602},[485,486],[464,8687,8689,8692],{"style":8688},"top:-4.942em;",[464,8690],{"className":8691,"style":2228},[540],[464,8693,8695,8698,8701,8704,8707,8710,8713,8716,8719,8722,8725,8728,8731,8734,8737],{"className":8694},[485],[464,8696,7453],{"className":8697,"style":1119},[485,486],[464,8699,1392],{"className":8700},[1217],[464,8702,405],{"className":8703},[485,486],[464,8705],{"className":8706,"style":676},[492],[464,8708,2393],{"className":8709},[1803],[464,8711],{"className":8712,"style":676},[492],[464,8714,428],{"className":8715},[485],[464,8717,1595],{"className":8718},[1594],[464,8720],{"className":8721,"style":610},[492],[464,8723,1603],{"className":8724,"style":1602},[485,486],[464,8726],{"className":8727,"style":676},[492],[464,8729,2393],{"className":8730},[1803],[464,8732],{"className":8733,"style":676},[492],[464,8735,428],{"className":8736},[485],[464,8738,1431],{"className":8739},[1229],[464,8741,8743,8746],{"style":8742},"top:-1.8em;",[464,8744],{"className":8745,"style":2228},[540],[464,8747,8749,8752,8755,8758,8761,8767,8771,8774],{"className":8748},[485],[464,8750,428],{"className":8751},[485],[464,8753],{"className":8754,"style":676},[492],[464,8756,1804],{"className":8757},[1803],[464,8759],{"className":8760,"style":676},[492],[464,8762,8764],{"className":8763},[1579],[464,8765,8112],{"className":8766},[485,1583],[464,8768],{"className":8769,"style":8770},[492],"margin-right:-0.1667em;",[464,8772],{"className":8773,"style":610},[492],[464,8775,8777,8855,9114],{"className":8776},[614],[464,8778,8780],{"className":8779},[1217],[464,8781,8783],{"className":8782},[1636,2108],[464,8784,8786,8847],{"className":8785},[523,524],[464,8787,8789,8844],{"className":8788},[528],[464,8790,8792,8802,8813,8823,8834],{"className":8791,"style":2271},[532],[464,8793,8794,8797],{"style":2274},[464,8795],{"className":8796,"style":2278},[540],[464,8798,8800],{"className":8799},[2129,2130],[464,8801,2133],{},[464,8803,8804,8807],{"style":2286},[464,8805],{"className":8806,"style":2278},[540],[464,8808,8809],{"style":2292},[846,8810,8811],{"xmlns":848,"width":2145,"height":2295,"style":2147,"viewBox":2296,"preserveAspectRatio":2149},[864,8812],{"d":2299},[464,8814,8815,8818],{"style":2302},[464,8816],{"className":8817,"style":2278},[540],[464,8819,8821],{"className":8820},[2129,2130],[464,8822,2164],{},[464,8824,8825,8828],{"style":2313},[464,8826],{"className":8827,"style":2278},[540],[464,8829,8830],{"style":2292},[846,8831,8832],{"xmlns":848,"width":2145,"height":2295,"style":2147,"viewBox":2296,"preserveAspectRatio":2149},[864,8833],{"d":2299},[464,8835,8836,8839],{"style":2325},[464,8837],{"className":8838,"style":2278},[540],[464,8840,8842],{"className":8841},[2129,2130],[464,8843,2188],{},[464,8845,556],{"className":8846},[555],[464,8848,8850],{"className":8849},[528],[464,8851,8853],{"className":8852,"style":2343},[532],[464,8854],{},[464,8856,8858],{"className":8857},[485],[464,8859,8861,9019,9022],{"className":8860},[2207],[464,8862,8864],{"className":8863},[2211],[464,8865,8867,9011],{"className":8866},[523,524],[464,8868,8870,9008],{"className":8869},[528],[464,8871,8873,8914,8955],{"className":8872,"style":2364},[532],[464,8874,8875,8878],{"style":2367},[464,8876],{"className":8877,"style":2371},[540],[464,8879,8881,8884,8887,8890,8893,8896,8899,8902,8905,8908,8911],{"className":8880},[485],[464,8882,7453],{"className":8883,"style":1119},[485,486],[464,8885,1392],{"className":8886},[1217],[464,8888,405],{"className":8889},[485,486],[464,8891],{"className":8892,"style":676},[492],[464,8894,2393],{"className":8895},[1803],[464,8897],{"className":8898,"style":676},[492],[464,8900,428],{"className":8901},[485],[464,8903,1595],{"className":8904},[1594],[464,8906],{"className":8907,"style":610},[492],[464,8909,1603],{"className":8910,"style":1602},[485,486],[464,8912,1431],{"className":8913},[1229],[464,8915,8916,8919],{"style":2414},[464,8917],{"className":8918,"style":2371},[540],[464,8920,8922,8925,8928,8931,8934,8937,8940,8943,8946,8949,8952],{"className":8921},[485],[464,8923,7453],{"className":8924,"style":1119},[485,486],[464,8926,1392],{"className":8927},[1217],[464,8929,405],{"className":8930},[485,486],[464,8932,1595],{"className":8933},[1594],[464,8935],{"className":8936,"style":610},[492],[464,8938,1603],{"className":8939,"style":1602},[485,486],[464,8941],{"className":8942,"style":676},[492],[464,8944,2393],{"className":8945},[1803],[464,8947],{"className":8948,"style":676},[492],[464,8950,428],{"className":8951},[485],[464,8953,1431],{"className":8954},[1229],[464,8956,8957,8960],{"style":2459},[464,8958],{"className":8959,"style":2371},[540],[464,8961,8963,8966,8969,8972,8975,8978,8981,8984,8987,8990,8993,8996,8999,9002,9005],{"className":8962},[485],[464,8964,7453],{"className":8965,"style":1119},[485,486],[464,8967,1392],{"className":8968},[1217],[464,8970,405],{"className":8971},[485,486],[464,8973],{"className":8974,"style":676},[492],[464,8976,2393],{"className":8977},[1803],[464,8979],{"className":8980,"style":676},[492],[464,8982,428],{"className":8983},[485],[464,8985,1595],{"className":8986},[1594],[464,8988],{"className":8989,"style":610},[492],[464,8991,1603],{"className":8992,"style":1602},[485,486],[464,8994],{"className":8995,"style":676},[492],[464,8997,2393],{"className":8998},[1803],[464,9000],{"className":9001,"style":676},[492],[464,9003,428],{"className":9004},[485],[464,9006,1431],{"className":9007},[1229],[464,9009,556],{"className":9010},[555],[464,9012,9014],{"className":9013},[528],[464,9015,9017],{"className":9016,"style":2535},[532],[464,9018],{},[464,9020],{"className":9021,"style":2542},[2541],[464,9023,9025],{"className":9024},[2211],[464,9026,9028,9106],{"className":9027},[523,524],[464,9029,9031,9103],{"className":9030},[528],[464,9032,9034,9061,9088],{"className":9033,"style":2364},[532],[464,9035,9036,9039],{"style":2367},[464,9037],{"className":9038,"style":2371},[540],[464,9040,9042,9049,9052,9055,9058],{"className":9041},[485],[464,9043,9045],{"className":9044},[485,2566],[464,9046,9048],{"className":9047},[485],"(delete ",[464,9050,1078],{"className":9051},[485,486],[464,9053,1218],{"className":9054},[1217],[464,9056,405],{"className":9057},[485,486],[464,9059,4358],{"className":9060},[1229],[464,9062,9063,9066],{"style":2414},[464,9064],{"className":9065,"style":2371},[540],[464,9067,9069,9076,9079,9082,9085],{"className":9068},[485],[464,9070,9072],{"className":9071},[485,2566],[464,9073,9075],{"className":9074},[485],"(insert ",[464,9077,1535],{"className":9078,"style":1534},[485,486],[464,9080,1218],{"className":9081},[1217],[464,9083,1603],{"className":9084,"style":1602},[485,486],[464,9086,4358],{"className":9087},[1229],[464,9089,9090,9093],{"style":2459},[464,9091],{"className":9092,"style":2371},[540],[464,9094,9096],{"className":9095},[485],[464,9097,9099],{"className":9098},[485,2566],[464,9100,9102],{"className":9101},[485],"(substitute)",[464,9104,556],{"className":9105},[555],[464,9107,9109],{"className":9108},[528],[464,9110,9112],{"className":9111,"style":2535},[532],[464,9113],{},[464,9115],{"className":9116},[1229,2659],[464,9118,556],{"className":9119},[555],[464,9121,9123],{"className":9122},[528],[464,9124,9127],{"className":9125,"style":9126},[532],"height:4.52em;",[464,9128],{},[464,9130],{"className":9131,"style":2542},[2541],[464,9133,9135],{"className":9134},[2211],[464,9136,9138,9344],{"className":9137},[523,524],[464,9139,9141,9341],{"className":9140},[528],[464,9142,9144,9176,9208,9258],{"className":9143,"style":8661},[532],[464,9145,9146,9149],{"style":8664},[464,9147],{"className":9148,"style":2228},[540],[464,9150,9152,9158,9161,9164,9167,9170,9173],{"className":9151},[485],[464,9153,9155],{"className":9154},[485,2566],[464,9156,2600],{"className":9157},[485],[464,9159,1603],{"className":9160,"style":1602},[485,486],[464,9162],{"className":9163,"style":493},[492],[464,9165,498],{"className":9166},[497],[464,9168],{"className":9169,"style":493},[492],[464,9171,1864],{"className":9172},[485],[464,9174,1595],{"className":9175},[1594],[464,9177,9178,9181],{"style":8676},[464,9179],{"className":9180,"style":2228},[540],[464,9182,9184,9190,9193,9196,9199,9202,9205],{"className":9183},[485],[464,9185,9187],{"className":9186},[485,2566],[464,9188,2600],{"className":9189},[485],[464,9191,405],{"className":9192},[485,486],[464,9194],{"className":9195,"style":493},[492],[464,9197,498],{"className":9198},[497],[464,9200],{"className":9201,"style":493},[492],[464,9203,1864],{"className":9204},[485],[464,9206,1595],{"className":9207},[1594],[464,9209,9210,9213],{"style":8688},[464,9211],{"className":9212,"style":2228},[540],[464,9214,9216,9222,9225,9228,9231,9234,9237,9240,9243,9246,9249,9252,9255],{"className":9215},[485],[464,9217,9219],{"className":9218},[485,2566],[464,9220,2600],{"className":9221},[485],[464,9223,1078],{"className":9224},[485,486],[464,9226,1218],{"className":9227},[1217],[464,9229,405],{"className":9230},[485,486],[464,9232,1230],{"className":9233},[1229],[464,9235],{"className":9236,"style":493},[492],[464,9238,498],{"className":9239},[497],[464,9241],{"className":9242,"style":493},[492],[464,9244,1535],{"className":9245,"style":1534},[485,486],[464,9247,1218],{"className":9248},[1217],[464,9250,1603],{"className":9251,"style":1602},[485,486],[464,9253,1230],{"className":9254},[1229],[464,9256,1595],{"className":9257},[1594],[464,9259,9260,9263],{"style":8742},[464,9261],{"className":9262,"style":2228},[540],[464,9264,9266,9272,9275,9278,9281,9284,9287,9323,9326,9329,9332,9335,9338],{"className":9265},[485],[464,9267,9269],{"className":9268},[485,2566],[464,9270,2600],{"className":9271},[485],[464,9273,1078],{"className":9274},[485,486],[464,9276,1218],{"className":9277},[1217],[464,9279,405],{"className":9280},[485,486],[464,9282,1230],{"className":9283},[1229],[464,9285],{"className":9286,"style":493},[492],[464,9288,9290,9317,9320],{"className":9289},[497],[464,9291,9293],{"className":9292},[497],[464,9294,9296],{"className":9295},[485,3668],[464,9297,9299],{"className":9298},[3672],[464,9300,9302,9305,9314],{"className":9301},[3676],[464,9303],{"className":9304,"style":3680},[480],[464,9306,9308],{"className":9307},[3684],[464,9309,9311],{"className":9310},[485],[464,9312,3691],{"className":9313},[497],[464,9315],{"className":9316},[3695],[464,9318],{"className":9319},[492,3699],[464,9321,498],{"className":9322},[497],[464,9324],{"className":9325,"style":493},[492],[464,9327,1535],{"className":9328,"style":1534},[485,486],[464,9330,1218],{"className":9331},[1217],[464,9333,1603],{"className":9334,"style":1602},[485,486],[464,9336,1230],{"className":9337},[1229],[464,9339,1293],{"className":9340},[485],[464,9342,556],{"className":9343},[555],[464,9345,9347],{"className":9346},[528],[464,9348,9350],{"className":9349,"style":9126},[532],[464,9351],{},[464,9353],{"className":9354},[1229,2659],[381,9356,9357,9358,9373,9374,9389,9390,9405,9406,9421],{},"The base cases say it: turning a length-",[464,9359,9361],{"className":9360},[467],[464,9362,9364],{"className":9363,"ariaHidden":472},[471],[464,9365,9367,9370],{"className":9366},[476],[464,9368],{"className":9369,"style":4544},[480],[464,9371,405],{"className":9372},[485,486]," prefix into the empty string costs ",[464,9375,9377],{"className":9376},[467],[464,9378,9380],{"className":9379,"ariaHidden":472},[471],[464,9381,9383,9386],{"className":9382},[476],[464,9384],{"className":9385,"style":4544},[480],[464,9387,405],{"className":9388},[485,486],"\ndeletions, and building a length-",[464,9391,9393],{"className":9392},[467],[464,9394,9396],{"className":9395,"ariaHidden":472},[471],[464,9397,9399,9402],{"className":9398},[476],[464,9400],{"className":9401,"style":1934},[480],[464,9403,1603],{"className":9404,"style":1602},[485,486]," prefix from nothing costs ",[464,9407,9409],{"className":9408},[467],[464,9410,9412],{"className":9411,"ariaHidden":472},[471],[464,9413,9415,9418],{"className":9414},[476],[464,9416],{"className":9417,"style":1934},[480],[464,9419,1603],{"className":9420,"style":1602},[485,486]," insertions.",[381,9423,9424,9425,9428,9429,388,9466,9503],{},"Filled on a small pair, the table looks just like the LCS one but now\n",[447,9426,9427],{},"minimizes",". Take ",[464,9430,9432],{"className":9431},[467],[464,9433,9435,9453],{"className":9434,"ariaHidden":472},[471],[464,9436,9438,9441,9444,9447,9450],{"className":9437},[476],[464,9439],{"className":9440,"style":481},[480],[464,9442,1078],{"className":9443},[485,486],[464,9445],{"className":9446,"style":493},[492],[464,9448,498],{"className":9449},[497],[464,9451],{"className":9452,"style":493},[492],[464,9454,9456,9459],{"className":9455},[476],[464,9457],{"className":9458,"style":6822},[480],[464,9460,9462],{"className":9461},[485,2566],[464,9463,9465],{"className":9464},[485,6829],"CAT",[464,9467,9469],{"className":9468},[467],[464,9470,9472,9490],{"className":9471,"ariaHidden":472},[471],[464,9473,9475,9478,9481,9484,9487],{"className":9474},[476],[464,9476],{"className":9477,"style":481},[480],[464,9479,1535],{"className":9480,"style":1534},[485,486],[464,9482],{"className":9483,"style":493},[492],[464,9485,498],{"className":9486},[497],[464,9488],{"className":9489,"style":493},[492],[464,9491,9493,9496],{"className":9492},[476],[464,9494],{"className":9495,"style":6822},[480],[464,9497,9499],{"className":9498},[485,2566],[464,9500,9502],{"className":9501},[485,6829],"CARS",": the shaded diagonal\nmarks the free matches, and the corner reports the answer.",[840,9505,9507,9774],{"className":9506},[843,844],[846,9508,9512],{"xmlns":848,"width":9509,"height":9510,"viewBox":9511},"232.980","186.364","-75 -75 174.735 139.773",[853,9513,9514,9520,9527,9534,9541,9548,9553,9559,9565,9571,9574,9580,9583,9589,9592,9598,9601,9607,9610,9616,9619,9624,9634,9637,9642,9645,9650,9653,9658,9661,9666,9669,9674,9684,9687,9692,9695,9700,9703,9708,9711,9716,9719,9724,9727,9732,9742,9750,9758,9766],{"stroke":855,"style":856},[853,9515,9516],{"transform":7033},[864,9517],{"d":9518,"fill":855,"stroke":855,"className":9519,"style":869},"M-57.778-64.798Q-57.778-64.815-57.765-64.864L-57.567-65.519Q-57.914-65.826-58.101-66.316Q-58.288-66.806-58.343-67.318Q-58.398-67.830-58.398-68.410Q-58.398-69.750-58.009-70.752Q-57.620-71.754-56.490-71.754Q-56.091-71.754-55.752-71.574L-55.581-72.141Q-55.554-72.260-55.401-72.260Q-55.326-72.260-55.269-72.203Q-55.212-72.145-55.212-72.071Q-55.212-72.053-55.220-72.009L-55.418-71.341Q-54.917-70.897-54.755-70.131Q-54.592-69.364-54.592-68.410Q-54.592-67.597-54.728-66.876Q-54.864-66.156-55.291-65.635Q-55.717-65.114-56.490-65.114Q-56.890-65.114-57.238-65.294L-57.400-64.728Q-57.444-64.609-57.576-64.609Q-57.659-64.609-57.719-64.664Q-57.778-64.719-57.778-64.798M-55.554-70.902L-57.136-65.620Q-56.846-65.374-56.490-65.374Q-56.064-65.374-55.805-65.712Q-55.546-66.050-55.434-66.542Q-55.322-67.035-55.293-67.527Q-55.264-68.019-55.264-68.560Q-55.264-69.333-55.313-69.926Q-55.361-70.520-55.554-70.902M-57.427-65.989L-55.849-71.262Q-56.148-71.495-56.490-71.495Q-57.049-71.495-57.321-70.999Q-57.594-70.502-57.657-69.893Q-57.721-69.285-57.721-68.560Q-57.721-68.028-57.708-67.608Q-57.695-67.188-57.626-66.734Q-57.558-66.279-57.427-65.989",[868],[853,9521,9523],{"transform":9522},"translate(53.565 3.075)",[864,9524],{"d":9525,"fill":855,"stroke":855,"className":9526,"style":869},"M-56.723-66.274Q-56.403-65.883-55.928-65.657Q-55.453-65.431-54.939-65.431Q-54.377-65.431-53.920-65.714Q-53.463-65.998-53.199-66.481Q-52.935-66.964-52.935-67.509Q-52.935-67.540-52.905-67.564Q-52.874-67.588-52.843-67.588L-52.738-67.588Q-52.645-67.588-52.645-67.474Q-52.645-66.833-52.975-66.290Q-53.304-65.747-53.863-65.431Q-54.421-65.114-55.058-65.114Q-55.937-65.114-56.679-65.558Q-57.422-66.002-57.855-66.758Q-58.288-67.514-58.288-68.388Q-58.288-69.034-58.040-69.634Q-57.791-70.234-57.343-70.691Q-56.895-71.148-56.306-71.403Q-55.717-71.658-55.058-71.658Q-54.583-71.658-54.142-71.451Q-53.700-71.245-53.375-70.884L-52.852-71.623Q-52.834-71.658-52.790-71.658L-52.738-71.658Q-52.702-71.658-52.674-71.629Q-52.645-71.601-52.645-71.574L-52.645-69.144Q-52.645-69.122-52.678-69.093Q-52.711-69.065-52.738-69.065L-52.869-69.065Q-52.896-69.065-52.929-69.093Q-52.962-69.122-52.962-69.144Q-52.962-69.430-53.102-69.823Q-53.243-70.216-53.410-70.458Q-53.687-70.862-54.084-71.102Q-54.482-71.341-54.948-71.341Q-55.286-71.341-55.616-71.240Q-55.946-71.139-56.229-70.946Q-56.512-70.752-56.723-70.498Q-57.334-69.746-57.334-68.388Q-57.334-67.769-57.198-67.230Q-57.062-66.692-56.723-66.274",[868],[853,9528,9530],{"transform":9529},"translate(81.89 3.075)",[864,9531],{"d":9532,"fill":855,"stroke":855,"className":9533,"style":869},"M-56.526-65.312L-58.494-65.312L-58.494-65.628Q-58.270-65.628-58.075-65.679Q-57.879-65.729-57.728-65.850Q-57.576-65.971-57.506-66.178L-55.546-71.649Q-55.493-71.754-55.383-71.754L-55.291-71.754Q-55.181-71.754-55.128-71.649L-53.076-65.923Q-52.997-65.734-52.764-65.681Q-52.531-65.628-52.179-65.628L-52.179-65.312L-54.680-65.312L-54.680-65.628Q-53.942-65.628-53.942-65.879Q-53.942-65.905-53.950-65.923L-54.456-67.338L-56.750-67.338L-57.163-66.178Q-57.189-66.121-57.189-66.068Q-57.189-65.844-56.983-65.736Q-56.776-65.628-56.526-65.628L-56.526-65.312M-55.607-70.541L-56.640-67.650L-54.570-67.650",[868],[853,9535,9537],{"transform":9536},"translate(110.407 3.075)",[864,9538],{"d":9539,"fill":855,"stroke":855,"className":9540,"style":869},"M-55.805-65.312L-58.459-65.312L-58.459-65.628Q-57.541-65.628-57.541-65.923L-57.541-70.849Q-57.541-71.144-58.459-71.144L-58.459-71.460L-55.598-71.460Q-55.225-71.460-54.801-71.361Q-54.377-71.262-54.003-71.062Q-53.630-70.862-53.395-70.552Q-53.159-70.243-53.159-69.830Q-53.159-69.460-53.386-69.159Q-53.612-68.858-53.964-68.661Q-54.315-68.463-54.680-68.371Q-53.761-68.045-53.608-67.210L-53.502-66.419Q-53.458-66.085-53.414-65.892Q-53.370-65.699-53.241-65.536Q-53.111-65.374-52.878-65.374Q-52.606-65.374-52.463-65.624Q-52.320-65.874-52.320-66.178Q-52.320-66.217-52.287-66.246Q-52.254-66.274-52.215-66.274L-52.131-66.274Q-52.083-66.274-52.059-66.241Q-52.034-66.208-52.034-66.160Q-52.034-65.923-52.135-65.675Q-52.237-65.426-52.432-65.270Q-52.628-65.114-52.878-65.114Q-53.537-65.114-53.997-65.439Q-54.456-65.765-54.456-66.402L-54.456-67.193Q-54.456-67.492-54.618-67.738Q-54.781-67.984-55.045-68.120Q-55.308-68.256-55.607-68.256L-56.723-68.256L-56.723-65.923Q-56.723-65.628-55.805-65.628L-55.805-65.312M-56.723-70.849L-56.723-68.516L-55.717-68.516Q-54.966-68.516-54.539-68.814Q-54.113-69.113-54.113-69.830Q-54.113-70.563-54.533-70.854Q-54.952-71.144-55.717-71.144L-56.262-71.144Q-56.512-71.144-56.618-71.095Q-56.723-71.047-56.723-70.849",[868],[853,9542,9544],{"transform":9543},"translate(139.694 3.075)",[864,9545],{"d":9546,"fill":855,"stroke":855,"className":9547,"style":869},"M-58.288-65.193L-58.288-67.272Q-58.288-67.298-58.259-67.327Q-58.231-67.355-58.200-67.355L-58.090-67.355Q-58.059-67.355-58.031-67.327Q-58.002-67.298-58.002-67.272Q-58.002-66.670-57.745-66.259Q-57.488-65.848-57.027-65.639Q-56.565-65.431-55.985-65.431Q-55.651-65.431-55.379-65.606Q-55.106-65.782-54.952-66.074Q-54.799-66.367-54.799-66.687Q-54.799-66.903-54.867-67.105Q-54.935-67.307-55.053-67.472Q-55.172-67.637-55.352-67.758Q-55.532-67.878-55.735-67.922L-56.930-68.208Q-57.312-68.300-57.622-68.549Q-57.932-68.797-58.110-69.159Q-58.288-69.522-58.288-69.913Q-58.288-70.383-58.044-70.788Q-57.800-71.192-57.387-71.425Q-56.974-71.658-56.499-71.658Q-56.060-71.658-55.680-71.502Q-55.300-71.346-55.023-71.038L-54.654-71.623Q-54.636-71.658-54.592-71.658L-54.535-71.658Q-54.504-71.658-54.476-71.629Q-54.447-71.601-54.447-71.574L-54.447-69.496Q-54.447-69.474-54.480-69.445Q-54.513-69.416-54.535-69.416L-54.645-69.416Q-54.667-69.416-54.700-69.445Q-54.733-69.474-54.733-69.496Q-54.733-69.680-54.774-69.869Q-54.816-70.058-54.900-70.258Q-54.983-70.458-55.086-70.632Q-55.190-70.805-55.308-70.919Q-55.550-71.157-55.847-71.262Q-56.143-71.368-56.490-71.368Q-56.794-71.368-57.071-71.216Q-57.347-71.064-57.512-70.801Q-57.677-70.537-57.677-70.216Q-57.677-69.961-57.558-69.724Q-57.440-69.487-57.238-69.329Q-57.035-69.170-56.767-69.100L-55.572-68.814Q-55.163-68.718-54.847-68.443Q-54.531-68.168-54.357-67.784Q-54.183-67.399-54.183-66.986Q-54.183-66.503-54.421-66.068Q-54.658-65.633-55.071-65.374Q-55.484-65.114-55.976-65.114Q-56.473-65.114-56.932-65.268Q-57.391-65.422-57.703-65.734L-58.081-65.149Q-58.099-65.114-58.143-65.114L-58.200-65.114Q-58.222-65.114-58.255-65.143Q-58.288-65.171-58.288-65.193",[868],[853,9549,9550],{"transform":7067},[864,9551],{"d":9518,"fill":855,"stroke":855,"className":9552,"style":869},[868],[853,9554,9556],{"transform":9555},"translate(-3.34 59.98)",[864,9557],{"d":9525,"fill":855,"stroke":855,"className":9558,"style":869},[868],[853,9560,9562],{"transform":9561},"translate(-3.468 88.433)",[864,9563],{"d":9532,"fill":855,"stroke":855,"className":9564,"style":869},[868],[853,9566,9567],{"transform":7086},[864,9568],{"d":9569,"fill":855,"stroke":855,"className":9570,"style":869},"M-53.744-65.312L-57.180-65.312L-57.180-65.628Q-56.319-65.628-56.104-65.681Q-56.016-65.694-55.950-65.765Q-55.884-65.835-55.884-65.923L-55.884-70.849Q-55.884-71.042-55.989-71.093Q-56.095-71.144-56.345-71.144L-56.750-71.144Q-57.106-71.144-57.365-71.080Q-57.624-71.016-57.822-70.818Q-57.989-70.656-58.053-70.346Q-58.116-70.036-58.182-69.399L-58.468-69.399L-58.288-71.460L-52.645-71.460L-52.465-69.399L-52.755-69.399Q-52.777-69.680-52.814-69.966Q-52.852-70.251-52.922-70.476Q-52.992-70.700-53.115-70.818Q-53.427-71.144-54.183-71.144L-54.579-71.144Q-54.829-71.144-54.935-71.095Q-55.040-71.047-55.040-70.849L-55.040-65.923Q-55.040-65.835-54.974-65.765Q-54.908-65.694-54.825-65.681Q-54.610-65.628-53.744-65.628",[868],[864,9572],{"fill":1028,"d":9573},"M-43.153-24.056h25.607v-25.607h-25.607Z",[853,9575,9576],{"transform":7107},[864,9577],{"d":9578,"fill":855,"stroke":855,"className":9579,"style":869},"M-56.490-65.114Q-57.615-65.114-58.029-66.011Q-58.442-66.907-58.442-68.182Q-58.442-68.955-58.292-69.654Q-58.143-70.353-57.708-70.829Q-57.273-71.306-56.490-71.306Q-55.713-71.306-55.278-70.827Q-54.843-70.348-54.693-69.652Q-54.544-68.955-54.544-68.182Q-54.544-66.903-54.957-66.009Q-55.370-65.114-56.490-65.114M-56.490-65.374Q-55.972-65.374-55.721-65.885Q-55.471-66.397-55.414-67.008Q-55.357-67.619-55.357-68.327Q-55.357-69.012-55.414-69.572Q-55.471-70.133-55.724-70.590Q-55.976-71.047-56.490-71.047Q-56.895-71.047-57.132-70.770Q-57.369-70.493-57.477-70.052Q-57.585-69.610-57.609-69.217Q-57.633-68.823-57.633-68.327Q-57.633-67.821-57.609-67.393Q-57.585-66.964-57.477-66.481Q-57.369-65.998-57.130-65.686Q-56.890-65.374-56.490-65.374",[868],[864,9581],{"fill":1028,"d":9582},"M-14.7-24.056h25.607v-25.607h-25.608Z",[853,9584,9585],{"transform":7117},[864,9586],{"d":9587,"fill":855,"stroke":855,"className":9588,"style":869},"M-54.895-65.312L-57.927-65.312L-57.927-65.628Q-56.776-65.628-56.776-65.923L-56.776-70.647Q-57.264-70.414-57.985-70.414L-57.985-70.730Q-56.855-70.730-56.293-71.306L-56.148-71.306Q-56.113-71.306-56.080-71.273Q-56.047-71.240-56.047-71.205L-56.047-65.923Q-56.047-65.628-54.895-65.628",[868],[864,9590],{"fill":1028,"d":9591},"M13.752-24.056H39.36v-25.607H13.752Z",[853,9593,9594],{"transform":7126},[864,9595],{"d":9596,"fill":855,"stroke":855,"className":9597,"style":869},"M-54.895-65.312L-58.345-65.312L-58.345-65.545Q-58.345-65.558-58.314-65.589L-56.860-67.166Q-56.394-67.663-56.141-67.968Q-55.888-68.274-55.697-68.685Q-55.506-69.096-55.506-69.535Q-55.506-70.124-55.829-70.557Q-56.152-70.990-56.732-70.990Q-56.996-70.990-57.242-70.880Q-57.488-70.770-57.664-70.583Q-57.840-70.396-57.936-70.146L-57.857-70.146Q-57.655-70.146-57.512-70.010Q-57.369-69.874-57.369-69.658Q-57.369-69.452-57.512-69.313Q-57.655-69.175-57.857-69.175Q-58.059-69.175-58.202-69.318Q-58.345-69.460-58.345-69.658Q-58.345-70.120-58.108-70.493Q-57.870-70.867-57.470-71.086Q-57.071-71.306-56.622-71.306Q-56.099-71.306-55.645-71.091Q-55.190-70.875-54.917-70.476Q-54.645-70.076-54.645-69.535Q-54.645-69.140-54.816-68.786Q-54.988-68.432-55.253-68.153Q-55.519-67.874-55.970-67.489Q-56.420-67.105-56.499-67.030L-57.523-66.068L-56.706-66.068Q-56.055-66.068-55.618-66.079Q-55.181-66.090-55.150-66.112Q-55.080-66.195-55.025-66.435Q-54.970-66.674-54.930-66.942L-54.645-66.942",[868],[864,9599],{"fill":1028,"d":9600},"M42.205-24.056h25.607v-25.607H42.205Z",[853,9602,9603],{"transform":7135},[864,9604],{"d":9605,"fill":855,"stroke":855,"className":9606,"style":869},"M-57.901-66.033L-57.945-66.033Q-57.743-65.716-57.356-65.558Q-56.969-65.400-56.543-65.400Q-56.007-65.400-55.768-65.835Q-55.528-66.270-55.528-66.850Q-55.528-67.430-55.774-67.870Q-56.020-68.309-56.552-68.309L-57.172-68.309Q-57.198-68.309-57.231-68.338Q-57.264-68.366-57.264-68.388L-57.264-68.489Q-57.264-68.520-57.235-68.544Q-57.207-68.568-57.172-68.568L-56.653-68.608Q-56.187-68.608-55.941-69.080Q-55.695-69.553-55.695-70.071Q-55.695-70.498-55.908-70.772Q-56.121-71.047-56.543-71.047Q-56.886-71.047-57.211-70.917Q-57.536-70.788-57.721-70.533L-57.695-70.533Q-57.492-70.533-57.356-70.392Q-57.220-70.251-57.220-70.054Q-57.220-69.856-57.354-69.722Q-57.488-69.588-57.686-69.588Q-57.888-69.588-58.026-69.722Q-58.165-69.856-58.165-70.054Q-58.165-70.643-57.662-70.974Q-57.158-71.306-56.543-71.306Q-56.165-71.306-55.763-71.166Q-55.361-71.025-55.093-70.746Q-54.825-70.467-54.825-70.071Q-54.825-69.522-55.179-69.085Q-55.532-68.647-56.073-68.463Q-55.682-68.384-55.337-68.160Q-54.992-67.936-54.781-67.595Q-54.570-67.254-54.570-66.859Q-54.570-66.477-54.733-66.154Q-54.895-65.831-55.187-65.595Q-55.480-65.360-55.827-65.237Q-56.174-65.114-56.543-65.114Q-56.991-65.114-57.422-65.275Q-57.853-65.435-58.134-65.762Q-58.415-66.090-58.415-66.547Q-58.415-66.762-58.268-66.905Q-58.121-67.048-57.901-67.048Q-57.690-67.048-57.545-66.903Q-57.400-66.758-57.400-66.547Q-57.400-66.336-57.547-66.184Q-57.695-66.033-57.901-66.033",[868],[864,9608],{"fill":1028,"d":9609},"M70.658-24.056h25.607v-25.607H70.658Z",[853,9611,9612],{"transform":7144},[864,9613],{"d":9614,"fill":855,"stroke":855,"className":9615,"style":869},"M-56.104-66.789L-58.543-66.789L-58.543-67.105L-55.717-71.253Q-55.673-71.306-55.607-71.306L-55.453-71.306Q-55.414-71.306-55.381-71.273Q-55.348-71.240-55.348-71.196L-55.348-67.105L-54.447-67.105L-54.447-66.789L-55.348-66.789L-55.348-65.923Q-55.348-65.628-54.447-65.628L-54.447-65.312L-57-65.312L-57-65.628Q-56.640-65.628-56.372-65.683Q-56.104-65.738-56.104-65.923L-56.104-66.789M-56.047-70.278L-58.209-67.105L-56.047-67.105",[868],[864,9617],{"fill":1028,"d":9618},"M-43.153 4.397h25.607V-21.21h-25.607Z",[853,9620,9621],{"transform":7153},[864,9622],{"d":9587,"fill":855,"stroke":855,"className":9623,"style":869},[868],[853,9625,9626,9629],{"fill":7168},[864,9627],{"d":9628},"M-14.7 4.397h25.607V-21.21h-25.608Z",[853,9630,9631],{"transform":7162},[864,9632],{"d":9578,"fill":855,"stroke":855,"className":9633,"style":869},[868],[864,9635],{"fill":1028,"d":9636},"M13.752 4.397H39.36V-21.21H13.752Z",[853,9638,9639],{"transform":7174},[864,9640],{"d":9587,"fill":855,"stroke":855,"className":9641,"style":869},[868],[864,9643],{"fill":1028,"d":9644},"M42.205 4.397h25.607V-21.21H42.205Z",[853,9646,9647],{"transform":7184},[864,9648],{"d":9596,"fill":855,"stroke":855,"className":9649,"style":869},[868],[864,9651],{"fill":1028,"d":9652},"M70.658 4.397h25.607V-21.21H70.658Z",[853,9654,9655],{"transform":7195},[864,9656],{"d":9605,"fill":855,"stroke":855,"className":9657,"style":869},[868],[864,9659],{"fill":1028,"d":9660},"M-43.153 32.85h25.607V7.242h-25.607Z",[853,9662,9663],{"transform":7204},[864,9664],{"d":9596,"fill":855,"stroke":855,"className":9665,"style":869},[868],[864,9667],{"fill":1028,"d":9668},"M-14.7 32.85h25.607V7.242h-25.608Z",[853,9670,9671],{"transform":7213},[864,9672],{"d":9587,"fill":855,"stroke":855,"className":9673,"style":869},[868],[853,9675,9676,9679],{"fill":7168},[864,9677],{"d":9678},"M13.752 32.85H39.36V7.242H13.752Z",[853,9680,9681],{"transform":7222},[864,9682],{"d":9578,"fill":855,"stroke":855,"className":9683,"style":869},[868],[864,9685],{"fill":1028,"d":9686},"M42.205 32.85h25.607V7.242H42.205Z",[853,9688,9689],{"transform":7231},[864,9690],{"d":9587,"fill":855,"stroke":855,"className":9691,"style":869},[868],[864,9693],{"fill":1028,"d":9694},"M70.658 32.85h25.607V7.242H70.658Z",[853,9696,9697],{"transform":7240},[864,9698],{"d":9596,"fill":855,"stroke":855,"className":9699,"style":869},[868],[864,9701],{"fill":1028,"d":9702},"M-43.153 61.303h25.607V35.695h-25.607Z",[853,9704,9705],{"transform":7249},[864,9706],{"d":9605,"fill":855,"stroke":855,"className":9707,"style":869},[868],[864,9709],{"fill":1028,"d":9710},"M-14.7 61.303h25.607V35.695h-25.608Z",[853,9712,9713],{"transform":7258},[864,9714],{"d":9596,"fill":855,"stroke":855,"className":9715,"style":869},[868],[864,9717],{"fill":1028,"d":9718},"M13.752 61.303H39.36V35.695H13.752Z",[853,9720,9721],{"transform":7267},[864,9722],{"d":9587,"fill":855,"stroke":855,"className":9723,"style":869},[868],[864,9725],{"fill":1028,"d":9726},"M42.205 61.303h25.607V35.695H42.205Z",[853,9728,9729],{"transform":7278},[864,9730],{"d":9587,"fill":855,"stroke":855,"className":9731,"style":869},[868],[853,9733,9734,9737],{"fill":4003},[864,9735],{"d":9736},"M70.658 61.303h25.607V35.695H70.658Z",[853,9738,9739],{"transform":7288},[864,9740],{"d":9596,"fill":855,"stroke":855,"className":9741,"style":869},[868],[853,9743,9744,9747],{"fill":7391,"stroke":7391,"style":1030},[864,9745],{"fill":1028,"d":9746},"M74.357 48.499h-6.732",[864,9748],{"d":9749},"m65.253 48.499 3.26 1.235-1.088-1.235 1.087-1.236Z",[853,9751,9752,9755],{"fill":7391,"stroke":7391,"style":1030},[864,9753],{"fill":1028,"d":9754},"M48.57 42.06 35.478 28.969",[864,9756],{"d":9757,"style":7398},"m33.8 27.29 1.43 3.178.106-1.642 1.642-.105Z",[853,9759,9760,9763],{"fill":7391,"stroke":7391,"style":1030},[864,9761],{"fill":1028,"d":9762},"M20.118 13.608 7.024.515",[864,9764],{"d":9765,"style":7398},"m5.347-1.163 1.431 3.179.105-1.643L8.525.268Z",[853,9767,9768,9771],{"fill":7391,"stroke":7391,"style":1030},[864,9769],{"fill":1028,"d":9770},"m-8.335-14.845-13.093-13.093",[864,9772],{"d":9773,"style":7398},"m-23.106-29.616 1.431 3.179.105-1.642 1.643-.105Z",[1058,9775,9777,9778,9811,9812,9887,9888,9939,9940,9979,9980,9998],{"className":9776},[1061],"Edit-distance table ",[464,9779,9781],{"className":9780},[467],[464,9782,9784],{"className":9783,"ariaHidden":472},[471],[464,9785,9787,9790,9793,9796,9799,9802,9805,9808],{"className":9786},[476],[464,9788],{"className":9789,"style":1210},[480],[464,9791,7453],{"className":9792,"style":1119},[485,486],[464,9794,1392],{"className":9795},[1217],[464,9797,405],{"className":9798},[485,486],[464,9800,1595],{"className":9801},[1594],[464,9803],{"className":9804,"style":610},[492],[464,9806,1603],{"className":9807,"style":1602},[485,486],[464,9809,1431],{"className":9810},[1229]," for ",[464,9813,9815],{"className":9814},[467],[464,9816,9818,9836,9857,9875],{"className":9817,"ariaHidden":472},[471],[464,9819,9821,9824,9827,9830,9833],{"className":9820},[476],[464,9822],{"className":9823,"style":481},[480],[464,9825,1078],{"className":9826},[485,486],[464,9828],{"className":9829,"style":493},[492],[464,9831,498],{"className":9832},[497],[464,9834],{"className":9835,"style":493},[492],[464,9837,9839,9842,9848,9851,9854],{"className":9838},[476],[464,9840],{"className":9841,"style":6822},[480],[464,9843,9845],{"className":9844},[485,2566],[464,9846,9465],{"className":9847},[485,6829],[464,9849],{"className":9850,"style":493},[492],[464,9852,8461],{"className":9853},[497],[464,9855],{"className":9856,"style":493},[492],[464,9858,9860,9863,9866,9869,9872],{"className":9859},[476],[464,9861],{"className":9862,"style":481},[480],[464,9864,1535],{"className":9865,"style":1534},[485,486],[464,9867],{"className":9868,"style":493},[492],[464,9870,498],{"className":9871},[497],[464,9873],{"className":9874,"style":493},[492],[464,9876,9878,9881],{"className":9877},[476],[464,9879],{"className":9880,"style":6822},[480],[464,9882,9884],{"className":9883},[485,2566],[464,9885,9502],{"className":9886},[485,6829],"; the corner ",[464,9889,9891],{"className":9890},[467],[464,9892,9894,9930],{"className":9893,"ariaHidden":472},[471],[464,9895,9897,9900,9903,9906,9909,9912,9915,9918,9921,9924,9927],{"className":9896},[476],[464,9898],{"className":9899,"style":1210},[480],[464,9901,7453],{"className":9902,"style":1119},[485,486],[464,9904,1392],{"className":9905},[1217],[464,9907,7547],{"className":9908},[485],[464,9910,1595],{"className":9911},[1594],[464,9913],{"className":9914,"style":610},[492],[464,9916,7525],{"className":9917},[485],[464,9919,1431],{"className":9920},[1229],[464,9922],{"className":9923,"style":493},[492],[464,9925,498],{"className":9926},[497],[464,9928],{"className":9929,"style":493},[492],[464,9931,9933,9936],{"className":9932},[476],[464,9934],{"className":9935,"style":3449},[480],[464,9937,595],{"className":9938},[485]," counts one substitution (",[464,9941,9943],{"className":9942},[467],[464,9944,9946,9967],{"className":9945,"ariaHidden":472},[471],[464,9947,9949,9952,9958,9961,9964],{"className":9948},[476],[464,9950],{"className":9951,"style":6822},[480],[464,9953,9955],{"className":9954},[485,2566],[464,9956,1096],{"className":9957},[485,6829],[464,9959],{"className":9960,"style":493},[492],[464,9962,8461],{"className":9963},[497],[464,9965],{"className":9966,"style":493},[492],[464,9968,9970,9973],{"className":9969},[476],[464,9971],{"className":9972,"style":6822},[480],[464,9974,9976],{"className":9975},[485,2566],[464,9977,1087],{"className":9978},[485,6829],") and one insertion (",[464,9981,9983],{"className":9982},[467],[464,9984,9986],{"className":9985,"ariaHidden":472},[471],[464,9987,9989,9992],{"className":9988},[476],[464,9990],{"className":9991,"style":6822},[480],[464,9993,9995],{"className":9994},[485,2566],[464,9996,1175],{"className":9997},[485,6829],"). The red arrows trace the alignment back: a diagonal step is a match or substitution, a horizontal step an insertion.",[381,10000,10001,10002,10053,10054,10057,10058,3200,10060,3200,10076,10078,10079,10081,10082,388,10100,10118],{},"Reading the corner, ",[464,10003,10005],{"className":10004},[467],[464,10006,10008,10044],{"className":10007,"ariaHidden":472},[471],[464,10009,10011,10014,10017,10020,10023,10026,10029,10032,10035,10038,10041],{"className":10010},[476],[464,10012],{"className":10013,"style":1210},[480],[464,10015,7453],{"className":10016,"style":1119},[485,486],[464,10018,1392],{"className":10019},[1217],[464,10021,7547],{"className":10022},[485],[464,10024,1595],{"className":10025},[1594],[464,10027],{"className":10028,"style":610},[492],[464,10030,7525],{"className":10031},[485],[464,10033,1431],{"className":10034},[1229],[464,10036],{"className":10037,"style":493},[492],[464,10039,498],{"className":10040},[497],[464,10042],{"className":10043,"style":493},[492],[464,10045,10047,10050],{"className":10046},[476],[464,10048],{"className":10049,"style":3449},[480],[464,10051,595],{"className":10052},[485],": align the shared prefix ",[385,10055,10056],{},"CA"," for free,\nsubstitute ",[385,10059,1096],{},[464,10061,10063],{"className":10062},[467],[464,10064,10066],{"className":10065,"ariaHidden":472},[471],[464,10067,10069,10073],{"className":10068},[476],[464,10070],{"className":10071,"style":10072},[480],"height:0.3669em;",[464,10074,8461],{"className":10075},[497],[385,10077,1087],{},", then insert ",[385,10080,1175],{},". The match cells on the diagonal\n(",[464,10083,10085],{"className":10084},[467],[464,10086,10088],{"className":10087,"ariaHidden":472},[471],[464,10089,10091,10094],{"className":10090},[476],[464,10092],{"className":10093,"style":6822},[480],[464,10095,10097],{"className":10096},[485,2566],[464,10098,1186],{"className":10099},[485,6829],[464,10101,10103],{"className":10102},[467],[464,10104,10106],{"className":10105,"ariaHidden":472},[471],[464,10107,10109,10112],{"className":10108},[476],[464,10110],{"className":10111,"style":6822},[480],[464,10113,10115],{"className":10114},[485,2566],[464,10116,1078],{"className":10117},[485,6829],") copy the upper-left value unchanged, exactly the\nLCS diagonal step but counting saved edits instead of matched characters.",[381,10120,10121,10122,10203,10204,10228,10229,10232,10233,10236,10237,10239,10240,10243,10244,10247,10248,10251,10252,10255],{},"Compare this against LCS line by line. Both index subproblems by prefix pairs;\nboth branch on whether the last characters match; both fill an\n",[464,10123,10125],{"className":10124},[467],[464,10126,10128,10149,10170,10191],{"className":10127,"ariaHidden":472},[471],[464,10129,10131,10134,10137,10140,10143,10146],{"className":10130},[476],[464,10132],{"className":10133,"style":1210},[480],[464,10135,1392],{"className":10136},[1217],[464,10138,649],{"className":10139},[485,486],[464,10141],{"className":10142,"style":676},[492],[464,10144,1804],{"className":10145},[1803],[464,10147],{"className":10148,"style":676},[492],[464,10150,10152,10155,10158,10161,10164,10167],{"className":10151},[476],[464,10153],{"className":10154,"style":1210},[480],[464,10156,428],{"className":10157},[485],[464,10159,1431],{"className":10160},[1229],[464,10162],{"className":10163,"style":676},[492],[464,10165,6914],{"className":10166},[1803],[464,10168],{"className":10169,"style":676},[492],[464,10171,10173,10176,10179,10182,10185,10188],{"className":10172},[476],[464,10174],{"className":10175,"style":1210},[480],[464,10177,1392],{"className":10178},[1217],[464,10180,815],{"className":10181},[485,486],[464,10183],{"className":10184,"style":676},[492],[464,10186,1804],{"className":10187},[1803],[464,10189],{"className":10190,"style":676},[492],[464,10192,10194,10197,10200],{"className":10193},[476],[464,10195],{"className":10196,"style":1210},[480],[464,10198,428],{"className":10199},[485],[464,10201,1431],{"className":10202},[1229]," table where each entry reads its left, upper, and upper-left\nneighbors; both run in ",[464,10205,10207],{"className":10206},[467],[464,10208,10210],{"className":10209,"ariaHidden":472},[471],[464,10211,10213,10216,10219,10222,10225],{"className":10212},[476],[464,10214],{"className":10215,"style":1210},[480],[464,10217,1388],{"className":10218},[485],[464,10220,1392],{"className":10221},[1217],[464,10223,6781],{"className":10224},[485,486],[464,10226,1431],{"className":10227},[1229],". The ",[447,10230,10231],{},"only"," differences are the costs and\nthe optimization direction: LCS ",[411,10234,10235],{},"maximizes"," matched characters, edit distance\n",[411,10238,9427],{}," edits. ",[411,10241,10242],{},"Sequence DPs are a single template",", parameterized by\nwhat a ",[10245,10246,7576],"q",{}," earns and a ",[10245,10249,10250],{},"mismatch"," costs. Recognize the template and a whole\nfamily of problems (LCS, edit distance, sequence alignment, longest common\nsubstring, and ",[395,10253,10254],{"href":143},"string matching",") falls\nto the same code.",[435,10257,10259],{"id":10258},"takeaways","Takeaways",[2812,10261,10262,10368,10524,10596,10747,10793],{},[2815,10263,10264,10265,10267,10268,10364,10365,10367],{},"Index sequence subproblems by ",[411,10266,1484],{},":\n",[464,10269,10271],{"className":10270},[467],[464,10272,10274,10313],{"className":10273,"ariaHidden":472},[471],[464,10275,10277,10280,10286,10289,10292,10295,10298,10301,10304,10307,10310],{"className":10276},[476],[464,10278],{"className":10279,"style":1210},[480],[464,10281,10283],{"className":10282},[1579],[464,10284,1584],{"className":10285},[485,1583],[464,10287,1392],{"className":10288},[1217],[464,10290,405],{"className":10291},[485,486],[464,10293,1595],{"className":10294},[1594],[464,10296],{"className":10297,"style":610},[492],[464,10299,1603],{"className":10300,"style":1602},[485,486],[464,10302,1431],{"className":10303},[1229],[464,10305],{"className":10306,"style":493},[492],[464,10308,498],{"className":10309},[497],[464,10311],{"className":10312,"style":493},[492],[464,10314,10316,10319,10325,10328,10331,10334,10337,10340,10343,10346,10349,10352,10355,10358,10361],{"className":10315},[476],[464,10317],{"className":10318,"style":1210},[480],[464,10320,10322],{"className":10321},[1579],[464,10323,1629],{"className":10324},[485,1583],[464,10326,1392],{"className":10327},[1217],[464,10329,1078],{"className":10330},[485,486],[464,10332,1218],{"className":10333},[1217],[464,10335,1222],{"className":10336},[485],[464,10338,405],{"className":10339},[485,486],[464,10341,1230],{"className":10342},[1229],[464,10344,1595],{"className":10345},[1594],[464,10347],{"className":10348,"style":610},[492],[464,10350,1535],{"className":10351,"style":1534},[485,486],[464,10353,1218],{"className":10354},[1217],[464,10356,1222],{"className":10357},[485],[464,10359,1603],{"className":10360,"style":1602},[485,486],[464,10362,4358],{"className":10363},[1229]," is the\nkey that unlocks LCS, after the Step 0 move of solving for ",[447,10366,1477],{}," first.",[2815,10369,10370,10371,10389,10390,10414,10415,10439,10440,10455,10456,10507,10508,10523],{},"The recurrence is a ",[464,10372,10374],{"className":10373},[467],[464,10375,10377],{"className":10376,"ariaHidden":472},[471],[464,10378,10380,10383],{"className":10379},[476],[464,10381],{"className":10382,"style":1900},[480],[464,10384,10386],{"className":10385},[1579],[464,10387,2041],{"className":10388},[485,1583]," over three cases (drop ",[464,10391,10393],{"className":10392},[467],[464,10394,10396],{"className":10395,"ariaHidden":472},[471],[464,10397,10399,10402,10405,10408,10411],{"className":10398},[476],[464,10400],{"className":10401,"style":1210},[480],[464,10403,1078],{"className":10404},[485,486],[464,10406,1218],{"className":10407},[1217],[464,10409,405],{"className":10410},[485,486],[464,10412,1230],{"className":10413},[1229]," in case 1, drop ",[464,10416,10418],{"className":10417},[467],[464,10419,10421],{"className":10420,"ariaHidden":472},[471],[464,10422,10424,10427,10430,10433,10436],{"className":10423},[476],[464,10425],{"className":10426,"style":1210},[480],[464,10428,1535],{"className":10429,"style":1534},[485,486],[464,10431,1218],{"className":10432},[1217],[464,10434,1603],{"className":10435,"style":1602},[485,486],[464,10437,1230],{"className":10438},[1229],"\nin case 2, or extend the diagonal by ",[464,10441,10443],{"className":10442},[467],[464,10444,10446],{"className":10445,"ariaHidden":472},[471],[464,10447,10449,10452],{"className":10448},[476],[464,10450],{"className":10451,"style":3449},[480],[464,10453,428],{"className":10454},[485]," when ",[464,10457,10459],{"className":10458},[467],[464,10460,10462,10489],{"className":10461,"ariaHidden":472},[471],[464,10463,10465,10468,10471,10474,10477,10480,10483,10486],{"className":10464},[476],[464,10466],{"className":10467,"style":1210},[480],[464,10469,1078],{"className":10470},[485,486],[464,10472,1218],{"className":10473},[1217],[464,10475,405],{"className":10476},[485,486],[464,10478,1230],{"className":10479},[1229],[464,10481],{"className":10482,"style":493},[492],[464,10484,498],{"className":10485},[497],[464,10487],{"className":10488,"style":493},[492],[464,10490,10492,10495,10498,10501,10504],{"className":10491},[476],[464,10493],{"className":10494,"style":1210},[480],[464,10496,1535],{"className":10497,"style":1534},[485,486],[464,10499,1218],{"className":10500},[1217],[464,10502,1603],{"className":10503,"style":1602},[485,486],[464,10505,1230],{"className":10506},[1229]," in case 3) over a base\ncase of ",[464,10509,10511],{"className":10510},[467],[464,10512,10514],{"className":10513,"ariaHidden":472},[471],[464,10515,10517,10520],{"className":10516},[476],[464,10518],{"className":10519,"style":3449},[480],[464,10521,1864],{"className":10522},[485]," for an empty prefix.",[2815,10525,10526,10563,10564,10579,10580,10595],{},[411,10527,10528,10529,10562],{},"Prove it by induction on ",[464,10530,10532],{"className":10531},[467],[464,10533,10535,10553],{"className":10534,"ariaHidden":472},[471],[464,10536,10538,10541,10544,10547,10550],{"className":10537},[476],[464,10539],{"className":10540,"style":4237},[480],[464,10542,405],{"className":10543},[485,486],[464,10545],{"className":10546,"style":676},[492],[464,10548,1804],{"className":10549},[1803],[464,10551],{"className":10552,"style":676},[492],[464,10554,10556,10559],{"className":10555},[476],[464,10557],{"className":10558,"style":1934},[480],[464,10560,1603],{"className":10561,"style":1602},[485,486]," in two directions",": ",[464,10565,10567],{"className":10566},[467],[464,10568,10570],{"className":10569,"ariaHidden":472},[471],[464,10571,10573,10576],{"className":10572},[476],[464,10574],{"className":10575,"style":4453},[480],[464,10577,3016],{"className":10578},[497]," (build a witness\nsubsequence) and ",[464,10581,10583],{"className":10582},[467],[464,10584,10586],{"className":10585,"ariaHidden":472},[471],[464,10587,10589,10592],{"className":10588},[476],[464,10590],{"className":10591,"style":4453},[480],[464,10593,1871],{"className":10594},[497]," (every common subsequence fits one of the three cases).",[2815,10597,10598,10599,10680,10681,10705,10706,10709,10710,10746],{},"Fill the ",[464,10600,10602],{"className":10601},[467],[464,10603,10605,10626,10647,10668],{"className":10604,"ariaHidden":472},[471],[464,10606,10608,10611,10614,10617,10620,10623],{"className":10607},[476],[464,10609],{"className":10610,"style":1210},[480],[464,10612,1392],{"className":10613},[1217],[464,10615,649],{"className":10616},[485,486],[464,10618],{"className":10619,"style":676},[492],[464,10621,1804],{"className":10622},[1803],[464,10624],{"className":10625,"style":676},[492],[464,10627,10629,10632,10635,10638,10641,10644],{"className":10628},[476],[464,10630],{"className":10631,"style":1210},[480],[464,10633,428],{"className":10634},[485],[464,10636,1431],{"className":10637},[1229],[464,10639],{"className":10640,"style":676},[492],[464,10642,6914],{"className":10643},[1803],[464,10645],{"className":10646,"style":676},[492],[464,10648,10650,10653,10656,10659,10662,10665],{"className":10649},[476],[464,10651],{"className":10652,"style":1210},[480],[464,10654,1392],{"className":10655},[1217],[464,10657,815],{"className":10658},[485,486],[464,10660],{"className":10661,"style":676},[492],[464,10663,1804],{"className":10664},[1803],[464,10666],{"className":10667,"style":676},[492],[464,10669,10671,10674,10677],{"className":10670},[476],[464,10672],{"className":10673,"style":1210},[480],[464,10675,428],{"className":10676},[485],[464,10678,1431],{"className":10679},[1229]," table in ",[464,10682,10684],{"className":10683},[467],[464,10685,10687],{"className":10686,"ariaHidden":472},[471],[464,10688,10690,10693,10696,10699,10702],{"className":10689},[476],[464,10691],{"className":10692,"style":1210},[480],[464,10694,1388],{"className":10695},[485],[464,10697,1392],{"className":10698},[1217],[464,10700,6781],{"className":10701},[485,486],[464,10703,1431],{"className":10704},[1229],"; ",[411,10707,10708],{},"reconstruct"," in a second\npass, walking backwards from ",[464,10711,10713],{"className":10712},[467],[464,10714,10716],{"className":10715,"ariaHidden":472},[471],[464,10717,10719,10722,10728,10731,10734,10737,10740,10743],{"className":10718},[476],[464,10720],{"className":10721,"style":1210},[480],[464,10723,10725],{"className":10724},[1579],[464,10726,1584],{"className":10727},[485,1583],[464,10729,1392],{"className":10730},[1217],[464,10732,649],{"className":10733},[485,486],[464,10735,1595],{"className":10736},[1594],[464,10738],{"className":10739,"style":610},[492],[464,10741,815],{"className":10742},[485,486],[464,10744,1431],{"className":10745},[1229]," and emitting a character on\nevery diagonal match.",[2815,10748,10749,10750,10792],{},"Only the length is needed? Two rows give ",[464,10751,10753],{"className":10752},[467],[464,10754,10756],{"className":10755,"ariaHidden":472},[471],[464,10757,10759,10762,10765,10768,10774,10777,10780,10783,10786,10789],{"className":10758},[476],[464,10760],{"className":10761,"style":1210},[480],[464,10763,1388],{"className":10764},[485],[464,10766,1392],{"className":10767},[1217],[464,10769,10771],{"className":10770},[1579],[464,10772,8112],{"className":10773},[485,1583],[464,10775,1392],{"className":10776},[1217],[464,10778,649],{"className":10779},[485,486],[464,10781,1595],{"className":10782},[1594],[464,10784],{"className":10785,"style":610},[492],[464,10787,815],{"className":10788},[485,486],[464,10790,8131],{"className":10791},[1229]," space, at the\ncost of losing the reconstruction.",[2815,10794,10795,10798,10799,10823],{},[411,10796,10797],{},"Edit distance is the same dynamic program",": same prefix subproblems, same\ntable shape, same ",[464,10800,10802],{"className":10801},[467],[464,10803,10805],{"className":10804,"ariaHidden":472},[471],[464,10806,10808,10811,10814,10817,10820],{"className":10807},[476],[464,10809],{"className":10810,"style":1210},[480],[464,10812,1388],{"className":10813},[485],[464,10815,1392],{"className":10816},[1217],[464,10818,6781],{"className":10819},[485,486],[464,10821,1431],{"className":10822},[1229],", minimizing edits instead of maximizing\nmatches. Sequence DP is one reusable template.",[10825,10826,10829,10834],"section",{"className":10827,"dataFootnotes":376},[10828],"footnotes",[435,10830,10833],{"className":10831,"id":426},[10832],"sr-only","Footnotes",[10835,10836,10837,10854,10866],"ol",{},[2815,10838,10840,10843,10844,10846,10847],{"id":10839},"user-content-fn-skiena-lcs",[411,10841,10842],{},"Skiena",", §10 — Dynamic Programming: the longest common subsequence as a similarity measure underlying ",[385,10845,417],{}," and sequence alignment. ",[395,10848,10853],{"href":10849,"ariaLabel":10850,"className":10851,"dataFootnoteBackref":376},"#user-content-fnref-skiena-lcs","Back to reference 1",[10852],"data-footnote-backref","↩",[2815,10855,10857,10860,10861],{"id":10856},"user-content-fn-clrs-lcs",[411,10858,10859],{},"CLRS",", Ch. 15 — Dynamic Programming: the LCS recurrence obtained by examining the last characters of each prefix. ",[395,10862,10853],{"href":10863,"ariaLabel":10864,"className":10865,"dataFootnoteBackref":376},"#user-content-fnref-clrs-lcs","Back to reference 2",[10852],[2815,10867,10869,10872,10873,10907,10908],{"id":10868},"user-content-fn-erickson-editdist",[411,10870,10871],{},"Erickson",", Ch. 3 — Dynamic Programming: edit (Levenshtein) distance as the minimum-cost insert\u002Fdelete\u002Fsubstitute alignment filling an ",[464,10874,10876],{"className":10875},[467],[464,10877,10879,10898],{"className":10878,"ariaHidden":472},[471],[464,10880,10882,10886,10889,10892,10895],{"className":10881},[476],[464,10883],{"className":10884,"style":10885},[480],"height:0.6667em;vertical-align:-0.0833em;",[464,10887,649],{"className":10888},[485,486],[464,10890],{"className":10891,"style":676},[492],[464,10893,6914],{"className":10894},[1803],[464,10896],{"className":10897,"style":676},[492],[464,10899,10901,10904],{"className":10900},[476],[464,10902],{"className":10903,"style":1900},[480],[464,10905,815],{"className":10906},[485,486]," table. ",[395,10909,10853],{"href":10910,"ariaLabel":10911,"className":10912,"dataFootnoteBackref":376},"#user-content-fnref-erickson-editdist","Back to reference 3",[10852],[10914,10915,10916],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark-mode .shiki span {color: var(--shiki-dark-mode);background: var(--shiki-dark-mode-bg);font-style: var(--shiki-dark-mode-font-style);font-weight: var(--shiki-dark-mode-font-weight);text-decoration: var(--shiki-dark-mode-text-decoration);}html.dark-mode .shiki span {color: var(--shiki-dark-mode);background: var(--shiki-dark-mode-bg);font-style: var(--shiki-dark-mode-font-style);font-weight: var(--shiki-dark-mode-font-weight);text-decoration: var(--shiki-dark-mode-text-decoration);}",{"title":376,"searchDepth":18,"depth":18,"links":10918},[10919,10920,10921,10922,10924,10925,10926,10927,10928,10929,10930],{"id":437,"depth":18,"text":438},{"id":1463,"depth":18,"text":1464},{"id":1958,"depth":18,"text":1959},{"id":4223,"depth":18,"text":10923},"Step 3: Correctness by induction on i+j",{"id":6615,"depth":18,"text":6616},{"id":6787,"depth":18,"text":6788},{"id":7588,"depth":18,"text":7589},{"id":7914,"depth":18,"text":7915},{"id":8160,"depth":18,"text":8161},{"id":10258,"depth":18,"text":10259},{"id":426,"depth":18,"text":10833},"How similar are two strings? algorithm and altruistic share the letters\na, l, t, i, c in order, and that shared spine, the longest common\nsubsequence, is one of the most useful measures of similarity in computing. It\nunderlies the diff utility, version-control merges, and (with a change of cost\nfunction) the alignment of DNA and protein sequences in computational biology.1\nThis lesson develops the LCS dynamic program in full, then shows that edit\ndistance is the very same machine with the costs rearranged.","md",{"moduleNumber":116,"lessonNumber":18,"order":10934},702,true,[10937,10941,10943,10946,10949],{"title":10938,"slug":10939,"difficulty":10940},"Longest Common Subsequence","longest-common-subsequence","Medium",{"title":246,"slug":10942,"difficulty":10940},"longest-increasing-subsequence",{"title":10944,"slug":10945,"difficulty":10940},"Edit Distance","edit-distance",{"title":10947,"slug":10948,"difficulty":10940},"Longest Palindromic Subsequence","longest-palindromic-subsequence",{"title":10950,"slug":10951,"difficulty":10952},"Distinct Subsequences","distinct-subsequences","Hard","---\ntitle: Sequence Alignment & LCS\nmodule: Dynamic Programming\nmoduleNumber: 7\nlessonNumber: 2\norder: 702\nsummary: >-\n  Two strings can be compared by asking how much of one survives inside the\n  other. The longest common subsequence (LCS) and edit distance are the two\n  classic answers, and they are the _same_ dynamic program wearing different\n  costs. We derive the LCS recurrence by examining the last characters, fill a\n  worked DP table, reconstruct the subsequence, and then show edit distance as\n  the identical $\\Theta(mn)$ pattern.\ntopics: [Dynamic Programming, String Structures]\nsources:\n  - book: CLRS\n    ref: \"Ch. 15 — Dynamic Programming\"\n  - book: Skiena\n    ref: \"§10 — Dynamic Programming\"\n  - book: Erickson\n    ref: \"Ch. 3 — Dynamic Programming\"\npractice:\n  - title: 'Longest Common Subsequence'\n    slug: longest-common-subsequence\n    difficulty: Medium\n  - title: 'Longest Increasing Subsequence'\n    slug: longest-increasing-subsequence\n    difficulty: Medium\n  - title: 'Edit Distance'\n    slug: edit-distance\n    difficulty: Medium\n  - title: 'Longest Palindromic Subsequence'\n    slug: longest-palindromic-subsequence\n    difficulty: Medium\n  - title: 'Distinct Subsequences'\n    slug: distinct-subsequences\n    difficulty: Hard\n---\n\nHow similar are two strings? `algorithm` and `altruistic` share the letters\n`a`, `l`, `t`, `i`, `c` in order, and that shared spine, the **longest common\nsubsequence**, is one of the most useful measures of similarity in computing. It\nunderlies the `diff` utility, version-control merges, and (with a change of cost\nfunction) the alignment of DNA and protein sequences in computational biology.[^skiena-lcs]\nThis lesson develops the LCS dynamic program in full, then shows that **edit\ndistance** is the very same machine with the costs rearranged.\n\n## The problem\n\nA **subsequence** of a string is what remains after deleting zero or more\ncharacters, _keeping the rest in their original order_. It need not be\ncontiguous: `ace` is a subsequence of `abcde`, but `aec` is not. Given two\nstrings $X = x_1 x_2 \\cdots x_m$ and $Y = y_1 y_2 \\cdots y_n$, a **common\nsubsequence** is a string that is a subsequence of both, and we want a **longest**\none.\n\nA common subsequence is a set of order-preserving matches threading the two\nstrings: the matched letters appear in both, left to right, though the gaps\nbetween them differ.\n\n$$\n% caption: A common subsequence threads order-preserving matches through both strings.\n%          Here $ALRIT$ is the longest common subsequence of $ALGORITHM$ and $ALTRUISTIC$;\n%          matched letters connect, the rest are skipped.\n\\begin{tikzpicture}[\n  >=Stealth,\n  lt\u002F.style={font=\\small, inner sep=1.5pt, minimum size=5mm},\n  sk\u002F.style={lt, black!45},\n  mt\u002F.style={lt, acc},\n  link\u002F.style={draw=acc, thick}]\n  \\definecolor{acc}{HTML}{2348F2}\n  % top string ALGORITHM (index k at x = 0.6k); matched: 0,1,4,5,6\n  \\foreach \\ch\u002F\\k\u002F\\s in {A\u002F0\u002Fmt,L\u002F1\u002Fmt,G\u002F2\u002Fsk,O\u002F3\u002Fsk,R\u002F4\u002Fmt,I\u002F5\u002Fmt,T\u002F6\u002Fmt,H\u002F7\u002Fsk,M\u002F8\u002Fsk}\n    \\node[\\s] (t-\\k) at (0.6*\\k,0.9) {\\ch};\n  % bottom string ALTRUISTIC; matched: 0,1,3,5,7\n  \\foreach \\ch\u002F\\k\u002F\\s in {A\u002F0\u002Fmt,L\u002F1\u002Fmt,T\u002F2\u002Fsk,R\u002F3\u002Fmt,U\u002F4\u002Fsk,I\u002F5\u002Fmt,S\u002F6\u002Fsk,T\u002F7\u002Fmt,I\u002F8\u002Fsk,C\u002F9\u002Fsk}\n    \\node[\\s] (b-\\k) at (0.6*\\k,-0.9) {\\ch};\n  % matches A(t0,b0) L(t1,b1) R(t4,b3) I(t5,b5) T(t6,b7)\n  \\draw[link] (t-0) -- (b-0);\n  \\draw[link] (t-1) -- (b-1);\n  \\draw[link] (t-4) -- (b-3);\n  \\draw[link] (t-5) -- (b-5);\n  \\draw[link] (t-6) -- (b-7);\n  \\node[font=\\footnotesize, acc] at (6.7,0) {LCS $=$ ALRIT};\n\\end{tikzpicture}\n$$\n\n> **Input:** strings $X[1..m]$ and $Y[1..n]$.\n> **Output:** a longest string that is a subsequence of both $X$ and $Y$.\n\nA brute-force search is hopeless: $X$ has $2^m$ subsequences, and checking each\nagainst $Y$ gives $\\Theta(n\\,2^m)$. We need the [recipe](\u002Falgorithms\u002Fdynamic-programming\u002Fprinciples),\nand it pays to follow it literally. The DP recipe runs through fixed steps: **(0)** simplify the\ngoal, **(1)** define the subproblems and notation, **(2)** write the DP equations,\n**(3)** prove them correct by induction, **(4)** turn them into iterative\npseudocode, **(5)** return to the original goal, then analyze. We walk LCS through\nthose steps verbatim.\n\n## Step 0–1: Simplify the goal, define the subproblem\n\n**Simplify first.** Computing the _string_ drags around bookkeeping; computing its\n**length** is cleaner. So we first solve for the LCS _length_, then recover an\nactual subsequence in a cheap second pass (Step 5). With that simplification, the\ndecisive move, the one worth internalizing because it recurs across all\nsequence DPs, is to index subproblems by **prefixes** of the two strings. Write\n$A = X$ and $B = Y$ for the two inputs.\n\n> **Definition (LCS subproblem).** Let $\\operatorname{OPT}(i, j) = \\operatorname{LCS-length}\\bigl(A[1..i],\\,B[1..j]\\bigr)$,\n> the length of a longest common subsequence of the prefixes $A[1..i]$ and\n> $B[1..j]$.\n\nThe answer we want is $\\operatorname{OPT}(m, n)$. There are $(m+1)(n+1)$\nsubproblems, one per pair of prefix lengths $0 \\le i \\le m$ and $0 \\le j \\le n$.\n\n## Step 2: The DP equations\n\nNow apply optimal substructure by looking at the **last** characters, $A[i]$ and\n$B[j]$.[^clrs-lcs] Write the recurrence as a single $\\max$ over three cases,\nplus a base case:\n\n$$\n\\operatorname{OPT}(i,j) =\n\\begin{cases}\n0 & \\text{if } i = 0 \\text{ or } j = 0, \\quad\\text{(case 0)} \\\\[6pt]\n\\max\\begin{cases}\n  \\operatorname{OPT}(i-1, j) & \\text{(case 1)} \\\\\n  \\operatorname{OPT}(i, j-1) & \\text{(case 2)} \\\\\n  \\operatorname{OPT}(i-1, j-1) + 1 & \\text{if } A[i] = B[j] \\quad\\text{(case 3)}\n\\end{cases} & \\text{if } i, j > 0.\n\\end{cases}\n$$\n\nRead the three branches as moves on the prefixes:\n\n- **Case 1** drops $A[i]$: an LCS of $A[1..i-1]$ and $B[1..j]$ is a common\n  subsequence of $A[1..i]$ and $B[1..j]$, so $\\operatorname{OPT}(i,j) \\ge \\operatorname{OPT}(i-1,j)$.\n- **Case 2** drops $B[j]$ symmetrically, so $\\operatorname{OPT}(i,j) \\ge \\operatorname{OPT}(i,j-1)$.\n- **Case 3** fires _only when_ $A[i] = B[j]$: the shared character $c = A[i] = B[j]$\n  can end an optimal LCS, so we append it to the best LCS of the strictly shorter\n  prefixes, giving $\\operatorname{OPT}(i,j) \\ge \\operatorname{OPT}(i-1, j-1) + 1$.\n\nWhy exactly these three? Because every common subsequence of $A[1..i]$ and\n$B[1..j]$ falls into one of three shapes: it ignores $A[i]$ (case 1), ignores\n$B[j]$ (case 2), or uses both as a final match (case 3, possible only if\n$A[i]=B[j]$). The $\\max$ over the applicable cases is the longest of them. Note\nthat when $A[i] \\ne B[j]$, only cases 1 and 2 apply, and the recurrence collapses\nto $\\max\\bigl(\\operatorname{OPT}(i-1,j),\\,\\operatorname{OPT}(i,j-1)\\bigr)$.\n\nEach entry depends only on its left, upper, and upper-left neighbors, so filling\nthe table **row by row, left to right** (or column by column) respects every\ndependency. The same three-neighbour stencil drives _every_ sequence DP below:\nonly the labels on the arrows change.\n\n$$\n% caption: The shared stencil of every sequence DP: cell $(i,j)$ reads its left, upper,\n%          and upper-left neighbours; the diagonal fires on a match ($A[i]=B[j]$), the\n%          other two on a drop or an edit.\n\\begin{tikzpicture}[\n  >=Stealth,\n  cell\u002F.style={draw, minimum size=11mm, inner sep=1pt, font=\\small},\n  cur\u002F.style={cell, fill=acc!18},\n  lbl\u002F.style={draw=none, font=\\footnotesize}]\n  \\definecolor{acc}{HTML}{2348F2}\n  \\node[cell] (d) at (0,0) {$(i{-}1,j{-}1)$};\n  \\node[cell] (u) at (1.8,0) {$(i{-}1,j)$};\n  \\node[cell] (l) at (0,-1.8) {$(i,j{-}1)$};\n  \\node[cur]  (c) at (1.8,-1.8) {$(i,j)$};\n  \\draw[->, thick, acc] (d.south east) -- (c.north west);\n  \\draw[->, thick] (u.south) -- (c.north);\n  \\draw[->, thick] (l.east) -- (c.west);\n  \\node[lbl, acc, fill=white, inner sep=1.5pt] at (0.55,-0.75) {match $+1$ \u002F free};\n  \\node[lbl] at (2.85,-0.9) {drop \u002F edit};\n  \\node[lbl] at (0.9,-2.55) {drop \u002F edit};\n\\end{tikzpicture}\n$$\n\n## Step 3: Correctness by induction on $i + j$\n\nWe claim $\\operatorname{OPT}(i,j) = \\operatorname{LCS-length}(A[1..i], B[1..j])$\nfor all $i, j$, and prove it by **induction on $i + j$**. The recurrence is itself\na $\\max$, so the cleanest proof shows two inequalities: that the recurrence is\nneither too small ($\\ge$) nor too large ($\\le$).\n\n**Base case** ($i + j = 0$, i.e. $i = 0$ or $j = 0$). One prefix is empty, so the\nonly common subsequence is empty and the length is $0$, exactly case 0. Trivial.\n\n**Inductive step.** Fix $i, j > 0$ and assume the claim for all $i', j'$ with\n$i' + j' \u003C i + j$.\n\n_The $\\ge$ direction_ (the recurrence is achievable). We exhibit a common\nsubsequence of length at least the right-hand side.\n- If $A[i] = B[j] = c$: by the induction hypothesis there is a common subsequence\n  of $A[1..i-1]$ and $B[1..j-1]$ of length $\\operatorname{OPT}(i-1, j-1)$.\n  Appending $c$ yields a common subsequence of $A[1..i]$ and $B[1..j]$, so\n  $\\operatorname{LCS-length}(A[1..i], B[1..j]) \\ge \\operatorname{OPT}(i-1, j-1) + 1$.\n- Cases 1 and 2 are even simpler: any common subsequence of a shorter prefix pair\n  is still common for the longer pair, giving $\\ge \\operatorname{OPT}(i-1, j)$ and\n  $\\ge \\operatorname{OPT}(i, j-1)$. So the true length is $\\ge$ the $\\max$.\n\n_The $\\le$ direction_ (the recurrence is not exceeded). Take **any** common\nsubsequence $\\sigma$ of $A[1..i]$ and $B[1..j]$; we show $|\\sigma|$ is bounded by\none of the three branches.\n- If $\\sigma$ does not use $A[i]$: then $\\sigma$ is a common subsequence of\n  $A[1..i-1]$ and $B[1..j]$, so $|\\sigma| \\le \\operatorname{OPT}(i-1, j)$ by the IH.\n- If $\\sigma$ does not use $B[j]$: symmetrically $|\\sigma| \\le \\operatorname{OPT}(i, j-1)$.\n- If $\\sigma$ uses **both** $A[i]$ and $B[j]$: then they must match as $\\sigma$'s\n  last character, so $A[i] = B[j]$, and dropping it leaves a common subsequence of\n  $A[1..i-1]$ and $B[1..j-1]$; hence $|\\sigma| - 1 \\le \\operatorname{OPT}(i-1, j-1)$,\n  i.e. $|\\sigma| \\le \\operatorname{OPT}(i-1, j-1) + 1$.\n\nOne of these three cases always applies, so $|\\sigma| \\le \\max\\{\\dots\\}$ over the\napplicable branches. Taking $\\sigma$ to be a _longest_ common subsequence,\n$\\operatorname{LCS-length}(A[1..i], B[1..j]) \\le \\max\\{\\dots\\}$. Both directions\ntogether give equality, completing the induction.\n\n## Step 4: Iterative pseudocode\n\nThe equations are non-circular, since every entry reads strictly smaller prefixes, so\nthey convert directly into a bottom-up table fill. Allocate\n$\\operatorname{OPT}[0..m][0..n]$, zero the border, then sweep:\n\n```algorithm\ncaption: $\\textsc{LCS-Length}(A[1..m], B[1..n])$ — fill the DP table\nnumber: 1\nfor $i \\gets 0$ to $m$ do\n  $\\operatorname{OPT}[i][0] \\gets 0$ \u002F\u002F empty $B$ prefix\nfor $j \\gets 0$ to $n$ do\n  $\\operatorname{OPT}[0][j] \\gets 0$ \u002F\u002F empty $A$ prefix\nfor $i \\gets 1$ to $m$ do\n  for $j \\gets 1$ to $n$ do\n    $\\operatorname{OPT}[i][j] \\gets \\max\\bigl(\\operatorname{OPT}[i-1][j],\\ \\operatorname{OPT}[i][j-1]\\bigr)$ \u002F\u002F cases 1, 2\n    if $A[i] = B[j]$ then\n      $\\operatorname{OPT}[i][j] \\gets \\max\\bigl(\\operatorname{OPT}[i][j],\\ \\operatorname{OPT}[i-1][j-1] + 1\\bigr)$ \u002F\u002F case 3\nreturn $\\operatorname{OPT}[m][n]$\n```\n\nEvery cell costs $\\Theta(1)$, so the fill is $\\Theta(mn)$.\n\n## The DP table, filled\n\nTake $A = \\texttt{BDCAB}$ and $B = \\texttt{ABCB}$. We build the\n$(m+1) \\times (n+1)$ table of $\\operatorname{OPT}(i, j)$ values. Row $0$ and column\n$0$ are all zero (empty prefix); every other cell is filled by the recurrence. The\nshaded diagonal steps mark the matches that build the answer, and the red arrows\ntrace the reconstruction walk (Step 5) backwards from the corner.\n\n$$\n% caption: Filled LCS table for $BDCAB$ and $ABCB$ with the traceback path arrowed.\n\\begin{tikzpicture}[\n  cell\u002F.style={draw, minimum size=9mm, inner sep=1pt, font=\\small},\n  hdr\u002F.style={draw=none, font=\\small},\n  match\u002F.style={cell, fill=black!12},\n  back\u002F.style={-{Stealth[length=2mm]}, red!75!black, thick}]\n  % column headers\n  \\node[hdr] at (1,0) {$\\emptyset$};\n  \\node[hdr] at (2,0) {A};\n  \\node[hdr] at (3,0) {B};\n  \\node[hdr] at (4,0) {C};\n  \\node[hdr] at (5,0) {B};\n  % row labels\n  \\node[hdr] at (0,-1) {$\\emptyset$};\n  \\node[hdr] at (0,-2) {B};\n  \\node[hdr] at (0,-3) {D};\n  \\node[hdr] at (0,-4) {C};\n  \\node[hdr] at (0,-5) {A};\n  \\node[hdr] at (0,-6) {B};\n  % row varnothing\n  \\node[cell] at (1,-1) {0}; \\node[cell] at (2,-1) {0}; \\node[cell] at (3,-1) {0}; \\node[cell] at (4,-1) {0}; \\node[cell] at (5,-1) {0};\n  % row B\n  \\node[cell] at (1,-2) {0}; \\node[cell] at (2,-2) {0}; \\node[match] at (3,-2) {1}; \\node[cell] at (4,-2) {1}; \\node[match] at (5,-2) {1};\n  % row D\n  \\node[cell] at (1,-3) {0}; \\node[cell] at (2,-3) {0}; \\node[cell] at (3,-3) {1}; \\node[cell] at (4,-3) {1}; \\node[cell] at (5,-3) {1};\n  % row C\n  \\node[cell] at (1,-4) {0}; \\node[cell] at (2,-4) {0}; \\node[cell] at (3,-4) {1}; \\node[match] at (4,-4) {2}; \\node[cell] at (5,-4) {2};\n  % row A\n  \\node[cell] at (1,-5) {0}; \\node[match] at (2,-5) {1}; \\node[cell] at (3,-5) {1}; \\node[cell] at (4,-5) {2}; \\node[cell] at (5,-5) {2};\n  % row B\n  \\node[cell] at (1,-6) {0}; \\node[cell] at (2,-6) {1}; \\node[match] at (3,-6) {2}; \\node[cell] at (4,-6) {2}; \\node[match] at (5,-6) {3};\n  % traceback path (5,-6)->(4,-5)->(4,-4)->(3,-3)->(3,-2)->(2,-1); arrows are\n  % shortened to sit in the gaps between cells so they never cross the digits.\n  \\draw[back, shorten \u003C=3.2mm, shorten >=3.2mm] (5,-6) -- (4,-5);\n  \\draw[back, shorten \u003C=3.2mm, shorten >=3.2mm] (4,-5) -- (4,-4);\n  \\draw[back, shorten \u003C=3.2mm, shorten >=3.2mm] (4,-4) -- (3,-3);\n  \\draw[back, shorten \u003C=3.2mm, shorten >=3.2mm] (3,-3) -- (3,-2);\n  \\draw[back, shorten \u003C=3.2mm, shorten >=3.2mm] (3,-2) -- (2,-1);\n\\end{tikzpicture}\n$$\n\nThe bottom-right entry reads $\\operatorname{OPT}(5, 4) = 3$: the longest common\nsubsequence of `BDCAB` and `ABCB` has length $3$, namely `BCB` (the only one here,\nthough in general there may be ties). The arrows enter each shaded **match** cell\ndiagonally (emitting `B`, then `C`, then `B`, read from the corner upward) and step\nstraight up or left through non-match cells, exactly as the reconstruction below\nprescribes.\n\n## Step 5: Reconstructing the subsequence\n\nThe table gives the _length_; this is where the Step 0 simplification is paid back.\nIn a **second pass** we walk **backwards** from $\\operatorname{OPT}(m, n)$, undoing\nthe recurrence. At cell $(i, j)$: if $A[i] = B[j]$, that character belongs to the\nLCS — emit it and step diagonally to $(i-1, j-1)$ (case 3); otherwise move to\nwhichever neighbor, up or left, holds the larger value (the one the $\\max$ of cases\n1 and 2 chose).\n\n```algorithm\ncaption: $\\textsc{LCS-Reconstruct}(A, B, \\operatorname{OPT}, i, j)$ — recover the subsequence\nnumber: 2\nif $i = 0$ or $j = 0$ then\n  return the empty string \u002F\u002F empty prefix\nif $A[i] = B[j]$ then\n  return $\\textsc{LCS-Reconstruct}(A, B, \\operatorname{OPT}, i-1, j-1)$ followed by $A[i]$ \u002F\u002F case 3 match\nelse if $\\operatorname{OPT}[i-1][j] \\ge \\operatorname{OPT}[i][j-1]$ then\n  return $\\textsc{LCS-Reconstruct}(A, B, \\operatorname{OPT}, i-1, j)$ \u002F\u002F from above (case 1)\nelse\n  return $\\textsc{LCS-Reconstruct}(A, B, \\operatorname{OPT}, i, j-1)$ \u002F\u002F from left (case 2)\n```\n\nThe walk takes one step toward the origin each call, so it runs in $O(m + n)$\ntime, cheap compared with building the table.\n\n## Running time and space\n\nThe table has $(m+1)(n+1)$ entries, and each is computed in $\\Theta(1)$: a\ncomparison and a $\\max$. Therefore LCS runs in\n$$\n\\Theta(mn)\n$$\ntime, with $\\Theta(mn)$ space for the full table. If only the _length_ is wanted,\nnote that each row depends only on the row above it, so two rows, giving $\\Theta(\\min(m,\nn))$ space, suffice. The catch, common to all such DPs: this space trick\ndiscards the information needed to reconstruct the subsequence. (Hirschberg's\ndivide-and-conquer refinement recovers the actual LCS in $\\Theta(mn)$ time and\nonly linear space, but that is a topic for later.)\n\n## The same machine: edit distance\n\n**Edit distance** (the **Levenshtein distance**) asks the closely related\nquestion: what is the minimum number of single-character **insertions**,\n**deletions**, and **substitutions** that transform $A$ into $B$?[^erickson-editdist] It is the cost\nmodel behind spell-checkers and `diff`, and it is _structurally identical_ to LCS.\n\n> **Definition (Edit distance).** Let $D(i, j)$ be the edit distance between the prefixes $A[1..i]$ and $B[1..j]$.\n\nAgain we look at the last characters. If $A[i] = B[j]$, they need no edit and we\nalign them for free. Otherwise we make one of three moves (delete $A[i]$, insert\n$B[j]$, or substitute $A[i] \\to B[j]$), each at cost $1$, and recurse on the\ncorrespondingly shorter prefixes:\n$$\nD(i,j) =\n\\begin{cases}\ni & \\text{if } j = 0, \\\\[3pt]\nj & \\text{if } i = 0, \\\\[3pt]\nD(i-1, j-1) & \\text{if } A[i] = B[j], \\\\[3pt]\n1 + \\min\\!\\begin{cases}\n  D(i-1, j) & \\text{(delete } A[i]) \\\\\n  D(i, j-1) & \\text{(insert } B[j]) \\\\\n  D(i-1, j-1) & \\text{(substitute)}\n\\end{cases} & \\text{if } A[i] \\neq B[j].\n\\end{cases}\n$$\nThe base cases say it: turning a length-$i$ prefix into the empty string costs $i$\ndeletions, and building a length-$j$ prefix from nothing costs $j$ insertions.\n\nFilled on a small pair, the table looks just like the LCS one but now\n_minimizes_. Take $A = \\texttt{CAT}$ and $B = \\texttt{CARS}$: the shaded diagonal\nmarks the free matches, and the corner reports the answer.\n\n$$\n% caption: Edit-distance table $D(i,j)$ for $A=\\texttt{CAT}\\to B=\\texttt{CARS}$; the\n%          corner $D(3,4)=2$ counts one substitution ($\\texttt{T}\\to\\texttt{R}$) and one\n%          insertion ($\\texttt{S}$). The red arrows trace the alignment back: a diagonal\n%          step is a match or substitution, a horizontal step an insertion.\n\\begin{tikzpicture}[\n  cell\u002F.style={draw, minimum size=9mm, inner sep=1pt, font=\\small},\n  hdr\u002F.style={draw=none, font=\\small},\n  match\u002F.style={cell, fill=black!12},\n  ans\u002F.style={cell, fill=acc!18},\n  back\u002F.style={-{Stealth[length=2mm]}, red!75!black, thick}]\n  \\definecolor{acc}{HTML}{2348F2}\n  \\node[hdr] at (1,0) {$\\emptyset$};\n  \\node[hdr] at (2,0) {C};\n  \\node[hdr] at (3,0) {A};\n  \\node[hdr] at (4,0) {R};\n  \\node[hdr] at (5,0) {S};\n  \\node[hdr] at (0,-1) {$\\emptyset$};\n  \\node[hdr] at (0,-2) {C};\n  \\node[hdr] at (0,-3) {A};\n  \\node[hdr] at (0,-4) {T};\n  \\node[cell] at (1,-1) {0}; \\node[cell] at (2,-1) {1}; \\node[cell] at (3,-1) {2}; \\node[cell] at (4,-1) {3}; \\node[cell] at (5,-1) {4};\n  \\node[cell] at (1,-2) {1}; \\node[match] at (2,-2) {0}; \\node[cell] at (3,-2) {1}; \\node[cell] at (4,-2) {2}; \\node[cell] at (5,-2) {3};\n  \\node[cell] at (1,-3) {2}; \\node[cell] at (2,-3) {1}; \\node[match] at (3,-3) {0}; \\node[cell] at (4,-3) {1}; \\node[cell] at (5,-3) {2};\n  \\node[cell] at (1,-4) {3}; \\node[cell] at (2,-4) {2}; \\node[cell] at (3,-4) {1}; \\node[cell] at (4,-4) {1}; \\node[ans] at (5,-4) {2};\n  % traceback (5,-4)->(4,-4) insert -> (3,-3) subst -> (2,-2) match -> (1,-1) match;\n  % shortened so each arrow sits in the gap between cells, clear of the digits\n  \\draw[back, shorten \u003C=3.2mm, shorten >=3.2mm] (5,-4) -- (4,-4);\n  \\draw[back, shorten \u003C=3.2mm, shorten >=3.2mm] (4,-4) -- (3,-3);\n  \\draw[back, shorten \u003C=3.2mm, shorten >=3.2mm] (3,-3) -- (2,-2);\n  \\draw[back, shorten \u003C=3.2mm, shorten >=3.2mm] (2,-2) -- (1,-1);\n\\end{tikzpicture}\n$$\n\nReading the corner, $D(3,4) = 2$: align the shared prefix `CA` for free,\nsubstitute `T` $\\to$ `R`, then insert `S`. The match cells on the diagonal\n($\\texttt{C}$ and $\\texttt{A}$) copy the upper-left value unchanged, exactly the\nLCS diagonal step but counting saved edits instead of matched characters.\n\nCompare this against LCS line by line. Both index subproblems by prefix pairs;\nboth branch on whether the last characters match; both fill an\n$(m+1)\\times(n+1)$ table where each entry reads its left, upper, and upper-left\nneighbors; both run in $\\Theta(mn)$. The _only_ differences are the costs and\nthe optimization direction: LCS **maximizes** matched characters, edit distance\n**minimizes** edits. **Sequence DPs are a single template**, parameterized by\nwhat a \"match\" earns and a \"mismatch\" costs. Recognize the template and a whole\nfamily of problems (LCS, edit distance, sequence alignment, longest common\nsubstring, and [string matching](\u002Falgorithms\u002Fsequences\u002Fstring-matching)) falls\nto the same code.\n\n## Takeaways\n\n- Index sequence subproblems by **prefixes**:\n  $\\operatorname{OPT}(i, j) = \\operatorname{LCS-length}(A[1..i], B[1..j])$ is the\n  key that unlocks LCS, after the Step 0 move of solving for _length_ first.\n- The recurrence is a $\\max$ over three cases (drop $A[i]$ in case 1, drop $B[j]$\n  in case 2, or extend the diagonal by $1$ when $A[i] = B[j]$ in case 3) over a base\n  case of $0$ for an empty prefix.\n- **Prove it by induction on $i+j$ in two directions**: $\\ge$ (build a witness\n  subsequence) and $\\le$ (every common subsequence fits one of the three cases).\n- Fill the $(m+1)\\times(n+1)$ table in $\\Theta(mn)$; **reconstruct** in a second\n  pass, walking backwards from $\\operatorname{OPT}(m,n)$ and emitting a character on\n  every diagonal match.\n- Only the length is needed? Two rows give $\\Theta(\\min(m,n))$ space, at the\n  cost of losing the reconstruction.\n- **Edit distance is the same dynamic program**: same prefix subproblems, same\n  table shape, same $\\Theta(mn)$, minimizing edits instead of maximizing\n  matches. Sequence DP is one reusable template.\n\n[^skiena-lcs]: **Skiena**, §10 — Dynamic Programming: the longest common subsequence as a similarity measure underlying `diff` and sequence alignment.\n[^clrs-lcs]: **CLRS**, Ch. 15 — Dynamic Programming: the LCS recurrence obtained by examining the last characters of each prefix.\n[^erickson-editdist]: **Erickson**, Ch. 3 — Dynamic Programming: edit (Levenshtein) distance as the minimum-cost insert\u002Fdelete\u002Fsubstitute alignment filling an $m\\times n$ table.\n",{"text":10955,"minutes":10956,"time":10957,"words":10958},"9 min read",8.72,523200,1744,{"title":240,"description":10931},[10961,10963,10965],{"book":10859,"ref":10962},"Ch. 15 — Dynamic Programming",{"book":10842,"ref":10964},"§10 — Dynamic Programming",{"book":10871,"ref":10966},"Ch. 3 — Dynamic Programming","available","01.algorithms\u002F08.dynamic-programming\u002F02.sequence-dp",[231,243],"kQk3fl7cjXK0ULl5P2I5simbFQGNAA3LJ7gwvnXw5YY",{"\u002Falgorithms\u002Ffoundations\u002Fwhat-is-an-algorithm":10972,"\u002Falgorithms\u002Ffoundations\u002Fasymptotic-analysis":10973,"\u002Falgorithms\u002Ffoundations\u002Frecurrences":10974,"\u002Falgorithms\u002Fdivide-and-conquer\u002Fmergesort":10975,"\u002Falgorithms\u002Fdivide-and-conquer\u002Fquicksort":10976,"\u002Falgorithms\u002Fdivide-and-conquer\u002Fselection":10977,"\u002Falgorithms\u002Fsorting\u002Fheaps-and-heapsort":10978,"\u002Falgorithms\u002Fsorting\u002Fsorting-lower-bounds":10979,"\u002Falgorithms\u002Fsorting\u002Flinear-time-sorting":10980,"\u002Falgorithms\u002Fdata-structures\u002Felementary-structures":10981,"\u002Falgorithms\u002Fdata-structures\u002Fhash-tables":10982,"\u002Falgorithms\u002Fdata-structures\u002Fbinary-search-trees":10983,"\u002Falgorithms\u002Fdata-structures\u002Favl-trees":10984,"\u002Falgorithms\u002Fdata-structures\u002Fbalanced-trees":10985,"\u002Falgorithms\u002Fdata-structures\u002Funion-find":10986,"\u002Falgorithms\u002Fdata-structures\u002Ffenwick-and-segment-trees":10987,"\u002Falgorithms\u002Fsequences\u002Ftwo-pointers-and-windows":10988,"\u002Falgorithms\u002Fsequences\u002Fmonotonic-stacks":10989,"\u002Falgorithms\u002Fsequences\u002Fbinary-search-on-the-answer":10990,"\u002Falgorithms\u002Fsequences\u002Fstring-matching":10991,"\u002Falgorithms\u002Fsequences\u002Ftries":10992,"\u002Falgorithms\u002Fgraphs\u002Frepresentations-and-traversal":10993,"\u002Falgorithms\u002Fgraphs\u002Ftopological-sort-and-scc":10994,"\u002Falgorithms\u002Fgraphs\u002Fminimum-spanning-trees":10995,"\u002Falgorithms\u002Fgraphs\u002Fshortest-paths":10996,"\u002Falgorithms\u002Fgraphs\u002Fnetwork-flow":10997,"\u002Falgorithms\u002Fgraphs\u002Fbridges-and-articulation-points":10998,"\u002Falgorithms\u002Fgraphs\u002Flowest-common-ancestor":10999,"\u002Falgorithms\u002Fgraphs\u002Ftwo-sat":11000,"\u002Falgorithms\u002Fgraphs\u002Feulerian-tours":11001,"\u002Falgorithms\u002Fgreedy\u002Fthe-greedy-method":11002,"\u002Falgorithms\u002Fgreedy\u002Fscheduling-and-intervals":11003,"\u002Falgorithms\u002Fgreedy\u002Fhuffman-codes":11004,"\u002Falgorithms\u002Fgreedy\u002Fmatroids":11005,"\u002Falgorithms\u002Fdynamic-programming\u002Fprinciples":11006,"\u002Falgorithms\u002Fdynamic-programming\u002Fsequence-dp":10958,"\u002Falgorithms\u002Fdynamic-programming\u002Flongest-increasing-subsequence":11007,"\u002Falgorithms\u002Fdynamic-programming\u002Fknapsack":11008,"\u002Falgorithms\u002Fdynamic-programming\u002Fcoin-change-and-unbounded":11009,"\u002Falgorithms\u002Fdynamic-programming\u002Finterval-dp":11010,"\u002Falgorithms\u002Fdynamic-programming\u002Ftree-dp":11011,"\u002Falgorithms\u002Fdynamic-programming\u002Fbitmask-dp":11012,"\u002Falgorithms\u002Fdynamic-programming\u002Fdp-optimizations":11013,"\u002Falgorithms\u002Fdynamic-programming\u002Fdp-on-graphs":11014,"\u002Falgorithms\u002Fbacktracking\u002Fbacktracking-fundamentals":11015,"\u002Falgorithms\u002Fbacktracking\u002Fconstraint-search":11016,"\u002Falgorithms\u002Fbacktracking\u002Fbranch-and-bound":11017,"\u002Falgorithms\u002Fmathematical-algorithms\u002Fnumber-theory-basics":10988,"\u002Falgorithms\u002Fmathematical-algorithms\u002Fmodular-exponentiation-and-primality":11018,"\u002Falgorithms\u002Fmathematical-algorithms\u002Fsieve-and-factorization":11019,"\u002Falgorithms\u002Fmathematical-algorithms\u002Fcombinatorics":11020,"\u002Falgorithms\u002Fcomputational-geometry\u002Fgeometric-primitives":11021,"\u002Falgorithms\u002Fcomputational-geometry\u002Fconvex-hull":11004,"\u002Falgorithms\u002Fcomputational-geometry\u002Fsweep-line":11022,"\u002Falgorithms\u002Fintractability\u002Fp-np-reductions":11023,"\u002Falgorithms\u002Fintractability\u002Fnp-completeness":10984,"\u002Falgorithms\u002Fintractability\u002Fcoping-with-hardness":11024,"\u002Falgorithms":11025,"\u002Ftheory-of-computation":11026,"\u002Fcomputer-architecture":11026,"\u002Fphysical-computing":11026,"\u002Fdatabases":11026,"\u002Fdeep-learning":11026},1763,2107,1738,2628,1723,2048,1697,1044,1542,1565,1679,1586,1388,1465,1971,1455,1533,1483,1578,1791,1481,2704,1658,2070,1978,2080,1568,1451,1291,1543,1883,1443,1599,2038,2241,1678,2288,1929,1657,1412,1554,1418,1713,1798,1694,1762,1534,1595,1262,1495,1630,2306,2142,107,0,{"\u002Falgorithms\u002Ffoundations\u002Fwhat-is-an-algorithm":11028,"\u002Falgorithms\u002Ffoundations\u002Fasymptotic-analysis":11029,"\u002Falgorithms\u002Ffoundations\u002Frecurrences":11030,"\u002Falgorithms\u002Fdivide-and-conquer\u002Fmergesort":11031,"\u002Falgorithms\u002Fdivide-and-conquer\u002Fquicksort":11032,"\u002Falgorithms\u002Fdivide-and-conquer\u002Fselection":11033,"\u002Falgorithms\u002Fsorting\u002Fheaps-and-heapsort":11034,"\u002Falgorithms\u002Fsorting\u002Fsorting-lower-bounds":11035,"\u002Falgorithms\u002Fsorting\u002Flinear-time-sorting":11036,"\u002Falgorithms\u002Fdata-structures\u002Felementary-structures":11037,"\u002Falgorithms\u002Fdata-structures\u002Fhash-tables":11038,"\u002Falgorithms\u002Fdata-structures\u002Fbinary-search-trees":11039,"\u002Falgorithms\u002Fdata-structures\u002Favl-trees":11040,"\u002Falgorithms\u002Fdata-structures\u002Fbalanced-trees":11041,"\u002Falgorithms\u002Fdata-structures\u002Funion-find":11042,"\u002Falgorithms\u002Fdata-structures\u002Ffenwick-and-segment-trees":11043,"\u002Falgorithms\u002Fsequences\u002Ftwo-pointers-and-windows":11044,"\u002Falgorithms\u002Fsequences\u002Fmonotonic-stacks":11045,"\u002Falgorithms\u002Fsequences\u002Fbinary-search-on-the-answer":11046,"\u002Falgorithms\u002Fsequences\u002Fstring-matching":11047,"\u002Falgorithms\u002Fsequences\u002Ftries":11048,"\u002Falgorithms\u002Fgraphs\u002Frepresentations-and-traversal":11049,"\u002Falgorithms\u002Fgraphs\u002Ftopological-sort-and-scc":11050,"\u002Falgorithms\u002Fgraphs\u002Fminimum-spanning-trees":11051,"\u002Falgorithms\u002Fgraphs\u002Fshortest-paths":11052,"\u002Falgorithms\u002Fgraphs\u002Fnetwork-flow":11053,"\u002Falgorithms\u002Fgraphs\u002Fbridges-and-articulation-points":11054,"\u002Falgorithms\u002Fgraphs\u002Flowest-common-ancestor":11055,"\u002Falgorithms\u002Fgraphs\u002Ftwo-sat":11056,"\u002Falgorithms\u002Fgraphs\u002Feulerian-tours":11057,"\u002Falgorithms\u002Fgreedy\u002Fthe-greedy-method":11058,"\u002Falgorithms\u002Fgreedy\u002Fscheduling-and-intervals":11059,"\u002Falgorithms\u002Fgreedy\u002Fhuffman-codes":11060,"\u002Falgorithms\u002Fgreedy\u002Fmatroids":11061,"\u002Falgorithms\u002Fdynamic-programming\u002Fprinciples":11062,"\u002Falgorithms\u002Fdynamic-programming\u002Fsequence-dp":11063,"\u002Falgorithms\u002Fdynamic-programming\u002Flongest-increasing-subsequence":11064,"\u002Falgorithms\u002Fdynamic-programming\u002Fknapsack":11065,"\u002Falgorithms\u002Fdynamic-programming\u002Fcoin-change-and-unbounded":11066,"\u002Falgorithms\u002Fdynamic-programming\u002Finterval-dp":11067,"\u002Falgorithms\u002Fdynamic-programming\u002Ftree-dp":11068,"\u002Falgorithms\u002Fdynamic-programming\u002Fbitmask-dp":11069,"\u002Falgorithms\u002Fdynamic-programming\u002Fdp-optimizations":11070,"\u002Falgorithms\u002Fdynamic-programming\u002Fdp-on-graphs":11071,"\u002Falgorithms\u002Fbacktracking\u002Fbacktracking-fundamentals":11072,"\u002Falgorithms\u002Fbacktracking\u002Fconstraint-search":11073,"\u002Falgorithms\u002Fbacktracking\u002Fbranch-and-bound":11074,"\u002Falgorithms\u002Fmathematical-algorithms\u002Fnumber-theory-basics":11075,"\u002Falgorithms\u002Fmathematical-algorithms\u002Fmodular-exponentiation-and-primality":11076,"\u002Falgorithms\u002Fmathematical-algorithms\u002Fsieve-and-factorization":11077,"\u002Falgorithms\u002Fmathematical-algorithms\u002Fcombinatorics":11078,"\u002Falgorithms\u002Fcomputational-geometry\u002Fgeometric-primitives":11079,"\u002Falgorithms\u002Fcomputational-geometry\u002Fconvex-hull":11080,"\u002Falgorithms\u002Fcomputational-geometry\u002Fsweep-line":11081,"\u002Falgorithms\u002Fintractability\u002Fp-np-reductions":11082,"\u002Falgorithms\u002Fintractability\u002Fnp-completeness":11083,"\u002Falgorithms\u002Fintractability\u002Fcoping-with-hardness":11084,"\u002Falgorithms":11085,"\u002Ftheory-of-computation":11088,"\u002Fcomputer-architecture":11091,"\u002Fphysical-computing":11094,"\u002Fdatabases":11097,"\u002Fdeep-learning":11100},{"path":11,"title":10,"module":5,"summary":14},{"path":17,"title":16,"module":5,"summary":20},{"path":23,"title":22,"module":5,"summary":27},{"path":34,"title":33,"module":29,"summary":37},{"path":40,"title":39,"module":29,"summary":43},{"path":46,"title":45,"module":29,"summary":49},{"path":56,"title":55,"module":51,"summary":59},{"path":62,"title":61,"module":51,"summary":64},{"path":67,"title":66,"module":51,"summary":70},{"path":78,"title":77,"module":72,"summary":81},{"path":84,"title":83,"module":72,"summary":87},{"path":90,"title":89,"module":72,"summary":92},{"path":95,"title":94,"module":72,"summary":98},{"path":101,"title":100,"module":72,"summary":104},{"path":107,"title":106,"module":72,"summary":112},{"path":115,"title":114,"module":72,"summary":119},{"path":126,"title":125,"module":121,"summary":129},{"path":132,"title":131,"module":121,"summary":134},{"path":137,"title":136,"module":121,"summary":140},{"path":143,"title":142,"module":121,"summary":146},{"path":149,"title":148,"module":121,"summary":151},{"path":158,"title":157,"module":153,"summary":162},{"path":165,"title":164,"module":153,"summary":167},{"path":170,"title":169,"module":153,"summary":172},{"path":175,"title":174,"module":153,"summary":177},{"path":180,"title":179,"module":153,"summary":182},{"path":185,"title":184,"module":153,"summary":187},{"path":190,"title":189,"module":153,"summary":192},{"path":195,"title":194,"module":153,"summary":198},{"path":201,"title":200,"module":153,"summary":204},{"path":211,"title":210,"module":206,"summary":213},{"path":216,"title":215,"module":206,"summary":219},{"path":222,"title":221,"module":206,"summary":224},{"path":227,"title":226,"module":206,"summary":229},{"path":236,"title":235,"module":231,"summary":238},{"path":241,"title":240,"module":231,"summary":244},{"path":247,"title":246,"module":231,"summary":249},{"path":252,"title":251,"module":231,"summary":254},{"path":257,"title":256,"module":231,"summary":259},{"path":262,"title":261,"module":231,"summary":264},{"path":267,"title":266,"module":231,"summary":269},{"path":272,"title":271,"module":231,"summary":274},{"path":277,"title":276,"module":231,"summary":279},{"path":282,"title":281,"module":231,"summary":285},{"path":292,"title":291,"module":287,"summary":295},{"path":298,"title":297,"module":287,"summary":300},{"path":303,"title":302,"module":287,"summary":305},{"path":312,"title":311,"module":307,"summary":315},{"path":318,"title":317,"module":307,"summary":320},{"path":323,"title":322,"module":307,"summary":325},{"path":328,"title":327,"module":307,"summary":330},{"path":338,"title":337,"module":332,"summary":341},{"path":344,"title":343,"module":332,"summary":346},{"path":349,"title":348,"module":332,"summary":351},{"path":359,"title":358,"module":353,"summary":362},{"path":364,"title":361,"module":353,"summary":366},{"path":369,"title":368,"module":353,"summary":373},{"path":11086,"title":11087,"module":376,"summary":376},"\u002Falgorithms","Algorithms",{"path":11089,"title":11090,"module":376,"summary":376},"\u002Ftheory-of-computation","Theory of Computation",{"path":11092,"title":11093,"module":376,"summary":376},"\u002Fcomputer-architecture","Computer Architecture",{"path":11095,"title":11096,"module":376,"summary":376},"\u002Fphysical-computing","Physical Computing",{"path":11098,"title":11099,"module":376,"summary":376},"\u002Fdatabases","Databases",{"path":11101,"title":11102,"module":376,"summary":376},"\u002Fdeep-learning","Deep Learning",1781560525599]