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

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

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

面试准备

模拟考试

设为首页

收藏此页面

订阅邮箱地址

Dynamic Programming 面试题与答案

问题 21. Maximum Profit with K Transactions

Given an array representing stock prices, find the maximum profit that can be obtained with at most k transactions.

Example:

Input: [3, 2, 6, 5, 0, 3], k = 2, Output: 7

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

问题 22. Count Distinct Subsequences

Given a string, find the number of distinct non-empty subsequences of the string.

Example:

Input: "abc", Output: 7 ("a", "b", "c", "ab", "ac", "bc", "abc")

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

问题 23. Palindromic Substrings

Given a string, find the total number of palindromic substrings.

Example:

Input: "abc", Output: 3 ("a", "b", "c")

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

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

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

问题 25. Word Break II

Given a non-empty string and a dictionary of words, return all possible sentences formed by concatenating words from the dictionary.

Example:

Input: s = "catsanddog", wordDict = ["cat", "cats", "and", "sand", "dog"], Output: ["cats and dog", "cat sand dog"]

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

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

版权所有 © 2026,WithoutBook。