Tagged articles
dynamic programming
71 articles · Page 1 of 1
Former Tencent AI Lab director Shi Shuming introduces CNF-MCE, a tokenizer replacing BPE's greedy merging with counting-based vocabulary construction and min-cost encoding, achieving 26-60% compression improvements over BPE while maintaining model performance on most benchmarks.
BPECNF-MCEcompression efficiency
0 likes · 9 min read

This article analyzes 11 classic dynamic programming problems including coin change, edit distance, LCS, LIS, maximum subarray, matrix chain multiplication, 0-1 knapsack, constrained shortest path, tiling with state compression, work allocation, and three-pass apple picking, providing recurrence relations, C implementations, and optimization techniques.
0-1 knapsackcoin changedynamic programming
0 likes · 34 min read

The article systematically explains the most common algorithms—search, sorting, two‑pointer, hash, recursion, graph traversal, greedy and dynamic programming—detailing their principles, typical use cases, real‑world code examples, and practical advice for when to apply or avoid them in everyday software development.
AlgorithmsBFSDFS
0 likes · 15 min read

This tutorial walks through implementing core algorithms and data structures in Go, covering language basics, arrays, slices, linked lists, stacks, queues, trees, graphs, sorting and searching techniques, as well as dynamic programming and greedy strategies, with concrete code examples and performance considerations.
AlgorithmsGoGraph Algorithms
0 likes · 32 min read

This article provides a concise overview of a ten‑chapter reinforcement‑learning textbook, outlining the progression from basic concepts such as states and rewards to advanced algorithms like policy gradients and actor‑critic methods, and explains how each chapter builds on the previous ones.
Bellman equationMonte CarloReinforcement Learning
0 likes · 11 min read

Using the Tang poem 'When the flower blooms, seize it' as a metaphor, this article formulates the optimal stopping problem with Gaussian value curves, survival probabilities, discounting, risk attitudes, Bayesian learning, and exploration‑exploitation trade‑offs, revealing when to act before the perfect moment fades.
Decision Theorybayesian learningdynamic programming
0 likes · 12 min read


Didi TechAug 28, 2025 · Artificial Intelligence
Explore how the Bellman equation underpins reinforcement learning, comparing Dynamic Programming, Monte Carlo, and Temporal‑Difference methods, and discover why TD’s low‑variance, online updates make it a powerful bridge between model‑based planning and sample‑based learning.
Bellman equationMonte CarloQ-Learning
0 likes · 21 min read

Given an integer array, the task is to find the maximum sum of a non‑empty subarray after optionally deleting at most one element, which can be solved via dynamic programming using two states to track sums with and without a deletion, as demonstrated with Java and C++ implementations.
AlgorithmC++Java
0 likes · 6 min read

The article compares git rebase and git merge—explaining that merge preserves history with extra commits while rebase creates a linear log but rewrites public history—then presents a dynamic‑programming solution for translating a numeric string to letters, using dp[i]=dp[i‑1]+dp[i‑2] when the two‑digit slice is between 10 and 25, achieving O(n) time.
AlgorithmGitdynamic programming
0 likes · 6 min read

This article explains LeetCode problem 1186, which asks for the maximum sum of a contiguous subarray after optionally deleting one element, and presents a dynamic‑programming solution with recurrence formulas, base cases, and full Java and C++ implementations.
AlgorithmC++Java
0 likes · 6 min read

After a humorous anecdote about job background checks, this article dives into LeetCode's classic Longest Palindromic Substring problem, explains brute‑force, center‑expansion, and dynamic‑programming approaches, and provides complete Java and C++ implementations with detailed DP recurrence and traversal strategies.
Algorithmdynamic programmingpalindrome
0 likes · 8 min read

This article walks through the fundamentals of dynamic programming by illustrating how to solve a staircase climbing problem and a 0/1 knapsack problem, explaining optimal substructure, state transition equations, boundary conditions, and providing both recursive and iterative C++ implementations.
Algorithmdynamic programmingknapsack problem
0 likes · 12 min read

This article shares personal reflections on a recent interview and provides detailed Python solutions for three classic coding challenges—a list index extraction using hash maps, a tree traversal reconstruction based on parent IDs, and a dynamic‑programming approach to the minimum path sum problem, along with code snippets.
Interviewdynamic programming
0 likes · 6 min read

The article first shares a personal anecdote about job background checks and then presents a detailed explanation of LeetCode problem 5 – Longest Palindromic Substring – including problem description, dynamic‑programming analysis, recurrence formula, and complete Java and C++ code examples.
AlgorithmC++DP
0 likes · 8 min read

Python introspection allows programs to examine their own structure at runtime, enabling dynamic manipulation of objects, classes, and methods through built-in functions and modules.
IntrospectionPythonattribute-access
0 likes · 5 min read

The article shares a candid interview anecdote about reasons for leaving a job, then presents LeetCode problem 542 “01 Matrix”, explains its DP and BFS approaches, and provides full Java, C++, and Python implementations.
C++JavaLeetCode
0 likes · 10 min read

This guide compiles essential Python built‑in functions, data‑structure utilities, and ready‑to‑use algorithmic templates—including dynamic programming, backtracking with caching, binary search, bit manipulation, union‑find, topological sort, monotonic stack, sliding window, prefix sums, two‑pointer and graph traversals—to accelerate LeetCode problem solving.
AlgorithmLeetCodedata structures
0 likes · 25 min read

This article compiles a comprehensive set of Python algorithm templates—including syntax shortcuts, knapsack solutions, backtracking, union‑find, topological sorting, monotonic stacks, binary search, dynamic programming, prefix sums, two‑pointer techniques, tree traversals, and graph algorithms—providing clear code snippets and explanations to help developers ace LeetCode interview problems.
AlgorithmsGraphLeetCode
0 likes · 30 min read

This article walks through using large language model agents to create a theme‑park queue planning assistant for Baidu's Qianfan competition, covering the problem definition, dynamic‑programming‑style solution, prompt engineering, Python code generation, and step‑by‑step deployment in AppBuilder.
AI agentAppBuilderLLM
0 likes · 17 min read

This article explains how to model a gold mining selection problem as a 0/1 knapsack, uses dynamic programming to compute the optimal set of mines given worker constraints, provides a full Python implementation, and demonstrates that the maximum extractable gold is 900 kg by choosing the first two mines.
dynamic programmingknapsackoptimization
0 likes · 12 min read

This article explains the classic coin change problem, models it as a minimum‑coin DP task, derives the recurrence relation, shows how to initialize the DP array with a large sentinel value, and provides a complete Go implementation that returns the optimal count or -1 when impossible.
AlgorithmDP recurrenceGo
0 likes · 5 min read

The article explains a dynamic‑programming approach to the classic “Maximum Subarray Sum” problem, defining dp[i] as the best sum ending at index i, deriving the recurrence dp[i]=max(dp[i‑1]+nums[i], nums[i]), initializing base cases, and providing complete Go code.
AlgorithmGoLeetCode
0 likes · 4 min read

This article presents a DP‑based algorithm to plan charging stops at highway rest stations for an electric vehicle with 1000 km range, minimizing total travel time including driving, queueing, and charging, and provides a Python implementation with O(N) time and space complexity.
AlgorithmElectric Vehiclecharging stations
0 likes · 10 min read

Given a binary string, you may color some '1's red and some '0's blue but adjacent opposite bits cannot both be colored; this article presents O(N) dynamic‑programming and greedy algorithms that compute the maximum number of characters that can be colored, with full code examples in Python, Java, and C++.
Algorithmbinary stringcoding interview
0 likes · 9 min read

This article reviews essential data structures such as arrays, linked lists, stacks, queues, hash tables, and trees, explains their characteristics and trade‑offs, and introduces fundamental algorithm categories including sorting, searching, greedy, divide‑and‑conquer, and dynamic programming, with useful visualization links.
Algorithmsarraysdynamic programming
0 likes · 8 min read

This article explains how to locate the longest continuous common substring between two strings representing code lines using a dynamic‑programming approach, provides a clear Python implementation, and details the algorithm's initialization, transition, and time‑space complexity.
dynamic programminglongest common substringstring algorithm
0 likes · 8 min read

Given a binary string of A's and B's, the task is to compute the minimum number of character flips required to transform it into a strictly increasing (lexicographically non‑decreasing) string, using a state‑DP approach that runs in O(N) time and O(N) space.
dynamic programmingminimum flipsstate DP
0 likes · 9 min read

This article explains a coding problem where a merchant trades multiple goods over several days, describes the input and output formats, demonstrates how each product can be handled independently using a greedy approach identical to LeetCode 122, provides a full Python implementation, and analyzes its time and space complexity.
Algorithmcoding interviewdynamic programming
0 likes · 8 min read

This article explains the dynamic‑programming solution to count the number of distinct ways a monkey can climb a staircase of n steps when each jump can be either 1 or 3 steps, including problem definition, recurrence relation, Python implementation, and time‑space analysis.
AlgorithmDPcoding interview
0 likes · 5 min read

Given a list of children’s IDs and flags indicating whether each child shares a class with the previous one, this article explains how to determine the two class groups using a dynamic‑programming approach, presents full Python code, and analyzes its O(N + x log x + y log y) time and O(N) space complexity.
Algorithmdynamic programming
0 likes · 8 min read

This article introduces the core concepts of dynamic programming, explains its principles of breaking problems into subproblems with optimal substructure, and provides step‑by‑step Python implementations for the classic knapsack optimization and a shortest‑path graph algorithm, complete with illustrative code and visualizations.
AlgorithmShortest Pathdynamic programming
0 likes · 10 min read

This article walks through the challenges of creating a tidy waterfall‑style image gallery, explains why the classic greedy algorithm fails with long images, and details a custom NP‑hard‑aware solution that uses average‑based grouping, sorting, and order‑preserving tweaks to achieve a more balanced visual layout.
NP-harddynamic programmingfrontend algorithm
0 likes · 13 min read

This article demonstrates how importing the Taichi library into Python can dramatically accelerate compute‑intensive tasks, showcasing prime counting, longest common subsequence, and reaction‑diffusion simulations with speedups up to 120× and GPU support, while providing installation and usage guidance.
GPUHigh-Performance ComputingPython
0 likes · 6 min read

CDW PG’s optimizer determines the most efficient join order for multi‑table OLAP queries by combining bottom‑up dynamic programming for smaller joins with a genetic algorithm for larger ones, while jointly selecting scan paths, join algorithms, and data‑distribution strategies to minimize execution cost.
CDW PGDistributed DatabaseMPP architecture
0 likes · 9 min read

Discover how importing the Taichi library can accelerate Python code by up to 100 times, with detailed examples ranging from prime counting and longest common subsequence dynamic programming to reaction‑diffusion simulations, including performance metrics, GPU support, and concise code snippets.
GPU accelerationNumerical ComputingPython performance
0 likes · 8 min read

This article provides a comprehensive overview of fourteen algorithmic strategies—including greedy, recurrence, recursion, enumeration, backtracking, divide‑and‑conquer, and dynamic programming—explaining their characteristics, typical use cases, inter‑relationships, and the types of problems each approach best addresses.
AlgorithmsDivide and Conquerdynamic programming
0 likes · 9 min read

The article explains that dynamic programming boils down to two core ideas—treating problems as a set of independent sub‑problems via divide‑and‑conquer and using memoization to avoid redundant calculations—illustrated with analogies to business management and contrasted with plain recursion.
Divide and Conqueralgorithm fundamentalsdynamic programming
0 likes · 6 min read

The article introduces a token‑level pipeline parallelism strategy that splits the sequence‑length dimension of Transformer‑based language models, explains why this approach is feasible, presents a dynamic‑programming formulation for optimal slicing, discusses engineering challenges, and evaluates its performance on large GPT models.
Pipeline ParallelismToken-levelTransformer
0 likes · 13 min read

Discover a practical, step‑by‑step approach for beginners to master algorithm problems on LeetCode, illustrated by a 50‑year‑old learner’s journey, covering mindset, structured problem‑solving, iterative refinement, and dynamic‑programming techniques with concrete code examples.
LeetCodealgorithm practicebeginner guide
0 likes · 8 min read

This article explains the classic maximum subarray problem, presents a brute‑force O(n³) method, an improved O(n²) version, a divide‑and‑conquer O(N log N) algorithm, and a linear‑time O(N) dynamic‑programming solution, each with full C++ code and complexity analysis.
C++ComplexityDivide and Conquer
0 likes · 8 min read

This article explains the classic House Robber interview question, detailing the problem constraints, illustrating why a naive alternating‑house approach fails, and presenting a clear dynamic‑programming solution with recurrence, base cases, and a concise code example.
AlgorithmDPdynamic programming
0 likes · 5 min read

This article demonstrates how Groovy's MetaClass can be used at runtime to add object methods, static methods, and properties to classes, and includes a complete Spock unit‑test example that verifies dynamic behavior with detailed code snippets and console output.
GroovyMetaclassSpock
0 likes · 7 min read

This article explains how to parse Chinese ID numbers to extract gender and age, demonstrates the checksum calculation, and then walks through classic algorithm challenges—including climbing stairs, longest palindrome, trapping rain water, and greedy cookie allocation—providing clear JavaScript implementations for each.
AlgorithmsLeetCodedynamic programming
0 likes · 18 min read

This article presents a classic stock‑like profit maximization problem using mooncake prices, explains the input and expected output, and walks through three solution strategies—brute‑force enumeration, a greedy linear scan, and a dynamic‑programming approach—complete with Go code examples and visual illustrations.
Algorithmbrute-forcedynamic programming
0 likes · 6 min read

This article presents five programming problems from Hulu's 2022 campus recruitment—including particle simulation, Sophie‑N number counting, optimal activity point on a tree, devil‑maze navigation, and non‑intersecting triangles—complete with problem statements, input/output specifications, sample cases, and detailed solution approaches.
AlgorithmGraphSimulation
0 likes · 18 min read

This article details a graduate student's AI‑driven solution to the Tencent Geek Competition's "E‑Tetris" challenge, describing the EI‑Tetris heuristic, feature‑based evaluation, state‑pruned dynamic programming, C++ implementation, performance results, and potential improvements.
Algorithm CompetitionC++Evaluation Function
0 likes · 12 min read

This article walks through the classic “pick‑from‑both‑ends” apple game, analyzing why greedy choices fail, and presents recursive, memoized, and dynamic‑programming solutions in Go, complete with code examples and step‑by‑step explanations to help you determine the winning strategy.
Algorithmdynamic programminggame theory
0 likes · 8 min read

This article explains the classic Nim game where two players alternately remove 1‑3 stones from a pile, presents the LeetCode‑style problem of determining if the first player can force a win, analyzes the pattern of losing positions, provides a concise Go solution, and offers a formal proof based on game theory.
GoNIMdynamic programming
0 likes · 5 min read

This article explains the concept of diff algorithms, demonstrates how to perform partial updates in iOS UICollectionView using insert, delete, reload and move APIs, introduces edit paths and the Wagner–Fischer dynamic‑programming algorithm, and provides Swift code examples for calculating optimal edit steps.
Batch UpdatesSWIFTUICollectionView
0 likes · 12 min read

Given an array where each element indicates the maximum jump length from that position, this article explores multiple strategies—depth‑first search, dynamic programming, greedy, and reverse‑tracking—to determine whether the frog can reach the last board, comparing their efficiency and implementation details.
AlgorithmDFSdynamic programming
0 likes · 7 min read

This article compiles a comprehensive list of over 400 algorithm and data‑structure problem solutions—including dynamic programming, backtracking, DFS/BFS, binary‑tree, linked‑list, stack, sorting, searching and classic puzzles—organized by topic and linked to detailed explanations for easy reference.
Algorithmsbacktrackingbinary tree
0 likes · 9 min read

This article introduces recursion, explains its core principles, presents a general problem‑solving approach, and walks through multiple practical examples—from factorial and climbing stairs to binary tree inversion and the Tower of Hanoi—while analyzing time and space complexities and offering optimization techniques.
AlgorithmDivide and ConquerJava
0 likes · 23 min read

This article introduces ten essential algorithms—including Quick Sort, Heap Sort, Merge Sort, Binary Search, BFPRT, Depth‑First Search, Breadth‑First Search, Dijkstra's shortest‑path, Dynamic Programming, and Naive Bayes—explaining their principles, typical use cases, and step‑by‑step procedures.
AlgorithmsGraph Algorithmsdynamic programming
0 likes · 12 min read

This article walks you through Hulu's 2021 campus recruitment update, explains the online programming test schedule and format, shares interview tips, and provides detailed statements, sample I/O, and solution analyses for four algorithmic problems covering probability, array maxima, maze navigation, and segment‑tree optimization.
Algorithmcoding interviewdata structures
0 likes · 15 min read

The article recounts three technical interview problems—a list‑index extraction using a hash map, a tree‑path reconstruction from parent identifiers, and a minimum‑path‑sum dynamic‑programming challenge—providing Python code solutions and brief explanations for each.
AlgorithmPythondynamic programming
0 likes · 5 min read

The article explains musical beat detection fundamentals, detailing traditional onset‑strength and dynamic‑programming algorithms (as in librosa), compares time‑domain and spectral methods, showcases deep‑learning advances, and describes practical applications such as audio visualisation, rhythm games, and QQ Music’s Super‑DJ automatic remix pipeline.
Audio Analysisbeat detectiondynamic programming
0 likes · 8 min read

This article introduces dynamic programming as an optimization technique from operations research, explains its fundamental concepts, optimality principle, no‑after‑effect property, and overlapping subproblems, outlines the typical problem‑model steps, and demonstrates a practical C++ implementation for solving the fractional knapsack problem.
C++DPdynamic programming
0 likes · 10 min read

This article explains the concept of recursion, presents a universal four‑step solving method, and walks through multiple practical examples—from factorials and frog‑jump problems to binary‑tree inversion, Tower of Hanoi, and cellular division—while detailing time and space complexity analyses and optimization strategies.
binary treedynamic programmingrecursion
0 likes · 22 min read

This article presents the ten most frequently asked hand‑coding interview problems—quick sort, binary search, climbing stairs, two‑sum, max drawdown, merging sorted arrays, maximum subarray, longest non‑repeating substring, permutations, and three‑sum—each with clear Python implementations, difficulty ratings, occurrence probabilities, and sample outputs to boost your interview success.
AlgorithmPythoncoding interview
0 likes · 13 min read

This comprehensive guide explains dynamic programming fundamentals, contrasts it with greedy recursion, and walks through Java implementations for Fibonacci, rod‑cutting, simplified and traditional knapsack, Levenshtein edit distance, and longest common subsequence, highlighting performance gains and reconstruction techniques.
AlgorithmLCSdynamic programming
0 likes · 26 min read


21CTOAug 27, 2018 · Fundamentals
Memoization, a dynamic programming technique introduced in 1968, stores results of recursive calls to eliminate redundant calculations, dramatically improving performance—as demonstrated by transforming a naïve O(2ⁿ) Fibonacci function into an O(n) version with simple code modifications and practical examples.
Fibonaccialgorithm optimizationdynamic programming
0 likes · 5 min read

This article uses a dialogue‑driven story to explain how PostgreSQL gathers statistics, computes selection rates, evaluates various physical scan and join paths, and combines CPU, I/O, and communication costs—including startup versus total cost—to choose the most efficient execution plan.
Physical PathsPostgreSQLcost estimation
0 likes · 25 min read

This article explains the theory and JavaScript implementations of various knapsack problem variants—including 0/1, complete, unbounded, and multi‑knapsack—detailing state transition equations, space‑optimisation techniques such as rolling arrays and binary decomposition, and provides full code examples for each solution.
AlgorithmJavaScriptdynamic programming
0 likes · 16 min read

This article provides a step‑by‑step walkthrough of the 0‑1 knapsack problem, explains the dynamic‑programming formulation, demonstrates how to build the DP table, and presents a complete JavaScript solution with optimizations and boundary‑handling techniques.
Algorithmdynamic programmingknapsack
0 likes · 9 min read

This article revisits fundamental algorithmic strategies—divide‑and‑conquer, dynamic programming, greedy methods, backtracking, and branch‑and‑bound—detailing their core ideas, applicable problem characteristics, key considerations, procedural steps, and illustrative examples such as merge sort, coin change, Huffman coding, and shortest‑path problems.
AlgorithmsDivide and Conquerbacktracking
0 likes · 7 min read

The article revisits fundamental algorithmic strategies—including divide‑and‑conquer, dynamic programming, greedy methods, backtracking, and branch‑and‑bound—detailing their core ideas, applicable problem characteristics, key considerations, procedural steps, and illustrative examples such as merge sort, coin change, Huffman coding, minimum spanning trees, and shortest‑path problems.
AlgorithmsDivide and Conquerbacktracking
0 likes · 7 min read

This article presents concise explanations and step‑by‑step procedures for ten classic algorithms—including quick sort, heap sort, merge sort, binary search, BFPRT selection, depth‑first and breadth‑first graph traversals, Dijkstra’s shortest‑path method, dynamic programming principles, and the Naive Bayes classifier—highlighting their complexities and core ideas.
Graph AlgorithmsSearchingalgorithm fundamentals
0 likes · 11 min read


21CTOFeb 29, 2016 · Fundamentals
This article presents concise explanations, step‑by‑step procedures, and visual illustrations for ten core algorithms—including QuickSort, HeapSort, MergeSort, Binary Search, BFPRT, DFS, BFS, Dijkstra, Dynamic Programming, and Naive Bayes—highlighting their principles, complexities, and typical use cases.
Graph AlgorithmsSearch AlgorithmsSorting Algorithms
0 likes · 15 min read


ITPUBFeb 23, 2016 · Fundamentals
This guide introduces ten core algorithms—including QuickSort, HeapSort, MergeSort, Binary Search, BFPRT, DFS, BFS, Dijkstra, Dynamic Programming, and Naive Bayes—explaining their principles, step‑by‑step procedures, and typical use cases for efficient problem solving.
AlgorithmsGraphNaive Bayes
0 likes · 14 min read

This article explains the fundamentals of dynamic programming, covering its basic concepts, underlying ideas, applicable problem properties, step‑by‑step solution methodology, implementation considerations, and provides a concise pseudo‑code framework to illustrate the algorithmic process.
DP fundamentalsalgorithm designdynamic programming
0 likes · 7 min read

This article explains the classic 0/1 knapsack problem, presents a detailed dynamic programming approach with step‑by‑step table construction, demonstrates the method using a concrete example, and discusses its computational complexity.
AlgorithmComplexitydynamic programming
0 likes · 7 min read
