The GATE Grind

GATE Algorithms: Dynamic Programming – Previous Year Questions

5 GATE previous year questions on Dynamic Programming (Algorithms, Computer Science) with answers and explanations, from every paper.

  1. GATE 2018 CS Q41 (2 marks, Multiple choice) – Assume that multiplying a matrix G 1 of dimension p q with another matrix G 2 of dimension q r requires pqr scalar multiplications. Computing the…
  2. GATE 2026 CS (CS2) Q39 (2 marks, Multiple choice) – Consider a table T where the entries T[i][j], 0 i,j n, represent costs of subproblems in a dynamic programming algorithm. The recursive formulation is…
  3. GATE 2024 CS (CS2) Q35 (1 mark, Numerical answer) – Let A be an array containing integer values. The distance of A is defined as the minimum number of elements in A that must be replaced with another…
  4. GATE 2024 CS (CS2) Q42 (2 marks, Multiple choice) – Consider an array X of n positive integers. The C code below computes the length of the longest subarray of X containing at most two distinct…
  5. GATE 2021 CS Q50 (2 marks, Multiple select) – Define R n to be the maximum amount earned by cutting a rod of length n meters into one or more pieces of integer length and selling them. For i>0,…