Skip to content
Embercode
✕
DP optimisationsQuick quiz

Queue and hull optimisations

8 questions. Covers Convex hull trick and Li Chao tree: minimum over lines.

Questions 1 to 5 of 8

  1. 1. The transition is dp[i] = min over j < i of dp[j] + (A[i] - A[j]) * B[i]. Which rewrite turns it into line queries?
  2. 2. An AI tool wrote a hull whose pointer only moves right. It is used on queries B[i] that can be negative, and it passes the lesson's sample. A reviewer says it is unsafe. Which statement shows the problem?
  3. 3. In the sliding window deque for the window [i - B, i - A], why does the front pop test use lo, as in dq.front() < lo, and not hi?
  4. 4. Which statements about the monotone deque for a sliding window minimum are true?

    Pick every answer that is true.

  5. 5. For the sample input below, where the segment cost is (A[i] - A[j]) * B[i], what is the minimum total cost? ``text 4 2 1 3 -2 1 4 5 -1 ``

    Type a number.

5 question(s) left on this page.

Typed answers ignore extra spaces and, for most questions, capital letters.