热门面试题与答案和在线测试
面向面试准备、在线测试、教程与实战练习的学习平台

通过聚焦学习路径、模拟测试和面试实战内容持续提升技能。

WithoutBook 将分主题面试题、在线练习测试、教程和对比指南整合到一个响应式学习空间中。

面试准备

模拟考试

设为首页

收藏此页面

订阅邮箱地址
首页 / 面试主题 / Dynamic Programming
WithoutBook LIVE 模拟面试 Dynamic Programming 相关面试主题: 74

面试题与答案

了解热门 Dynamic Programming 面试题与答案,帮助应届生和有经验的候选人为求职面试做好准备。

共 30 道题 面试题与答案

面试前建议观看的最佳 LIVE 模拟面试

了解热门 Dynamic Programming 面试题与答案,帮助应届生和有经验的候选人为求职面试做好准备。

面试题与答案

搜索问题以查看答案。

中级 / 1 到 5 年经验级别面试题与答案

问题 1

Longest Increasing Subsequence (LIS)

Find the length of the longest subsequence of a given sequence such that all elements of the subsequence are sorted in increasing order.

Example:

Input: [10, 22, 9, 33, 21, 50, 41, 60, 80], Output: 6
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 2

Coin Change Problem

Given a set of coin denominations, find the number of ways to make a certain amount of change.

Example:

Input: coins=[1, 2, 5], amount=5, Output: 4
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 3

0/1 Knapsack Problem

Given weights and values of items, find the maximum value that can be obtained by selecting a subset of items with total weight not exceeding a given limit.

Example:

Weights: [2, 3, 4, 5], Values: [3, 4, 5, 6], Knapsack Capacity: 5, Output: 11
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 4

Longest Common Subsequence (LCS)

Given two sequences, find the length of the longest subsequence present in both of them.

Example:

Input: ABCBDAB, BDCAB, Output: 4 (BCAB)
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 5

Rod Cutting Problem

Given a rod of length n and prices at which different lengths of the rod can be sold, find the maximum value obtainable by cutting up the rod.

Example:

Lengths: [1, 2, 3, 4, 5], Prices: [1, 5, 8, 9, 10], Rod Length: 4, Output: 10
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 6

Maximum Product Subarray

Find the contiguous subarray within an array (containing at least one number) that has the largest product.

Example:

Input: [2, 3, -2, 4], Output: 6 (subarray [2, 3])
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 7

Decode Ways

A message containing letters from A-Z can be encoded into numbers. Given a non-empty string containing only digits, determine the total number of ways to decode it.

Example:

Input: "226", Output: 3 ("22" can be decoded as "BB", "2" + "2" + "6" can be decoded as "VVF")
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 8

Word Break Problem

Given a non-empty string and a dictionary of words, determine if the string can be segmented into a space-separated sequence of one or more dictionary words.

Example:

Input: s = "leetcode", wordDict = ["leet", "code"], Output: true
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 9

Minimum Path Sum

Given a grid filled with non-negative numbers, find a path from the top-left to the bottom-right corner that minimizes the sum of numbers along the path.

Example:

Grid: [[1,3,1],[1,5,1],[4,2,1]], Output: 7 (1 -> 3 -> 1 -> 1 -> 1)
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 11

Partition Equal Subset Sum

Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal.

Example:

Input: [1, 5, 11, 5], Output: true (subset sums: [1, 5, 5] and [11])
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 12

Maximum Length of Repeated Subarray

Given two integer arrays, find the maximum length of a common subarray of both arrays.

Example:

Input: A = [1,2,3,2,1], B = [3,2,1,4,7], Output: 3 ([3, 2, 1])
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 14

Minimum Cost Path

Given a 2D grid, find the minimum cost path from the top-left corner to the bottom-right corner.

Example:

Grid: [[1,3,1],[1,5,1],[4,2,1]], Output: 7 (1 -> 3 -> 1 -> 1 -> 1)
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 15

Arithmetic Slices

A sequence of numbers is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same. Return the total number of arithmetic slices in the array.

Example:

Input: [1, 2, 3, 4], Output: 3 (three arithmetic slices: [1, 2, 3], [2, 3, 4], [1, 2, 3, 4])
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 16

Maximal Square

Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.

Example:

Matrix: [[1, 0, 1, 0, 0], [1, 0, 1, 1, 1], [1, 1, 1, 1, 1], [1, 0, 0, 1, 0]], Output: 4
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 17

Paint House

There are a row of n houses, each house can be painted with one of the three colors: red, blue, or green. The cost of painting each house with a certain color is different. You have to paint all the houses such that no two adjacent houses have the same color.

Example:

Costs: [[17, 2, 17], [16, 16, 5], [14, 3, 19]], Output: 10 (paint the first house blue, the second house green, and the third house blue)
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 18

Number of Dice Rolls With Target Sum

You have d dice, and each die has f faces numbered 1 to f. Return the number of possible ways (out of f^d total ways) to roll the dice so the sum of the face-up numbers equals target.

Example:

d = 2, f = 6, target = 7, Output: 6 (possible rolls: [1,6], [2,5], [3,4], [4,3], [5,2], [6,1])
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论

用户评价最有帮助的内容:

版权所有 © 2026,WithoutBook。