Dynamic Programming 2

Last Updated :
Discuss
Comments

Question 1

If LCS("abcde", "ace") = 3, which subsequence represents the LCS?

  • A

    "abc"

  • B

    "ace"

  • C

    "acd"

  • D

    "ae"

Question 2

Minimum insertions required to make a string palindrome = ?

  • A

    length - LCS(s, reverse(s))

  • B

    length + LCS(s, reverse(s))

  • C

    LCS(s, reverse(s))

  • D

    2 * length

Question 3

What is the key idea behind the Burst Balloons problem?

  • A

    Greedy selection of largest balloon

  • B

    Divide and conquer DP by choosing the last balloon to burst

  • C

    Binary search on balloons

  • D

    Sorting balloons by value

Question 4

The LIS problem can be solved in O(N log N) using which technique?

  • A

    Dynamic programming only

  • B

    Segment tree

  • C

    Binary search on tails

  • D

    Greedy sorting

Question 5

Which pattern does Partition DP generally follow?

  • A

    Iterate over all possible partition points k and combine subproblems

  • B

    Use greedy approach to minimize cost

  • C

    Solve only using recursion without memoization

  • D

    Always use bitmasking

Question 6

Why do we compare arr[j] < arr[i] when updating dp[i] in LIS?

  • A

    To ensure the subsequence remains increasing

  • B

    To skip equal elements

  • C

    To find decreasing subsequences

  • D

    To avoid duplicate elements

Question 7

Why do Partition DP problems like MCM or Palindrome Partitioning use i and j as state variables?

  • A

    Because they operate on subranges, and optimal solutions depend on the range’s boundaries

  • B

    Because they require comparing two sequences

  • C

    Because each position is independent

  • D

    Because they don’t have overlapping subproblems

Question 8

In Matrix Chain Multiplication, why doesn’t the smallest local multiplication cost always lead to the global minimum?

  • A

    Because local minimal choices may prevent globally optimal parenthesization

  • B

    Because matrix multiplication is commutative

  • C

    Because we only minimize scalar operations, not structure

  • D

    Because each multiplication cost is constant

Question 9

Why can LCS or Edit Distance be optimized from O(N²) to O(N) space?

  • A

    Because each row depends only on the previous row

  • B

    Because all rows are independent

  • C

    Because we can skip half the table

  • D

    Because character comparison can be vectorized

Question 10

If a DP has n states and each state transition takes O(k) time, what’s the total time complexity?

  • A

    O(n × k)

  • B

    O(n + k)

  • C

    O(kⁿ)

  • D

    O(log n)

There are 10 questions to complete.

Take a part in the ongoing discussion