1D DP (Including Kadane) — Reasoning Check

Apply the module invariants, traces, and boundary conditions.


Get every question correct to pass this checkpoint. You can review feedback, revise your answers, and submit again.

1. Houses form a circle with values [6,1,2,7]. What is the maximum obtainable value without selecting adjacent houses, including across the circular boundary? Enter one integer.
2. A MaximumSubarray implementation initializes its global answer to zero and returns 0 for [-8,-3,-5]. What contract did it violate?

Select one answer.

3. Maximum-product DP has processed [-2,-3], with maximum ending product 6 and minimum ending product -3. After reading -4, what are the new maximum and minimum ending products?

Select one answer.

4. Consider WordBreak("bedbath", ["bed","be","dbath"]) and CoinChange([1,4,6], amount=8). What are the correct results, despite choosing the longest initial word or largest available coin greedily?

Select one answer.

5. For the strictly increasing subsequence problem on [4,2,2,3,1,5], how should a tails-based algorithm handle the second 2, and what final length should it report?

Select one answer.

6. With digit codes 1 through 26 and no standalone zero, how many decodings does "11106" have? Enter one integer.
Join Discord