← All problemsSign in

Tom the gardener

Tom owns a garden. He has already planted a lot of flowers in that garden in a straight line in a particular sequence given by array A. Total number of flowers in the garden is given by n and the flowers are of 10 types, numbered 0 through 9. Now he asks Jerry to find out the smallest length x such that there exists at least one flower which is present in every subarray of garden having length x.

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start