Sherlock and Smallest Window
Watson has infinite supply of K different type of objects denoted by numbers 1 to K. He makes an array A of N objects, A1, A2, ..., AN using these objects. Now, he'll update this array Q times. In ith update, he'll replace an existing object in array with a new object of different type from 1 to K i.e. Axi = yi. After each update, he wants Sherlock to report the smallest size of a contiguous sub
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start