Array & String — 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. Merge nums1=[1,6,0,0] (m=2) with nums2=[2,5]. After writing 6 to index 3, nums1 is [1,6,0,6]. Which claim explains why this intermediate state is safe?

Select one answer.

2. Keep at most two copies of each value in sorted [1,1,1,2,2,3,3,3]. What logical length should be returned? Enter one integer.
3. A Jump Game scan updates farthest using nums[i] before testing whether i is reachable. On [2,0,1,0,4], which correction prevents a false success?

Select one answer.

4. With any number of stock trades, at most one share held, and no fees, what maximum profit is possible for prices [4,1,5,3,6]? Enter one integer.
5. Boyer-Moore ends with a candidate on [2,1,2,3]. Now remove the promise that a strict majority exists. What additional step establishes whether the candidate is a majority?

Select one answer.

6. For citations [0,1,4,4,5], what is the H-index? Enter one integer.
Join Discord