Dynamic Programming Interview Questions and Answers
Ques 16. Longest Palindromic Substring
Given a string, find the longest substring which is a palindrome.
Example:
Input: "babad", Output: "bab" or "aba"
Is it helpful?
Add Comment
View Comments
Ques 17. 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])
Is it helpful?
Add Comment
View Comments
Ques 18. 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])
Is it helpful?
Add Comment
View Comments
Ques 19. Longest Increasing Path in a Matrix
Given an integer matrix, find the length of the longest increasing path.
Example:
Matrix: [[9,9,4],[6,6,8],[2,1,1]], Output: 4 (9 -> 6 -> 8 -> 1)
Is it helpful?
Add Comment
View Comments
Ques 20. RegularExpression Matching
Implement regular expression matching with support for '.' and '*'.
Example:
Input: s = "aa", p = "a*", Output: true
Is it helpful?
Add Comment
View Comments
Most helpful rated by users: