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

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

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

面试准备

模拟考试

设为首页

收藏此页面

订阅邮箱地址

Dynamic Programming 面试题与答案

问题 6. 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

这有帮助吗? 添加评论 查看评论
 

问题 7. 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)

这有帮助吗? 添加评论 查看评论
 

问题 8. 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

这有帮助吗? 添加评论 查看评论
 

问题 9. Palindrome Partitioning

Given a string, partition it into as many palindromic substrings as possible.

Example:

Input: aab, Output: [['a', 'a', 'b'], ['aa', 'b']]

这有帮助吗? 添加评论 查看评论
 

问题 10. Unique Paths

A robot is located at the top-left corner of a m x n grid. It can only move either down or right. Find the number of unique paths to reach the bottom-right corner.

Example:

Input: m = 3, n = 7, Output: 28

这有帮助吗? 添加评论 查看评论
 

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

版权所有 © 2026,WithoutBook。