← All problemsSign in

Chef and beautiful patterns in the garden

There are n trees on a road in Chef's garden. Each tree has one of the three colours out of red, green or blue. You are given information about the colours of the trees by a string s. if s[i] is 'R', it means that ith tree is red. Similarly 'G' denotes green and 'B' denotes blue colored tree. Chef likes to create a beautiful pattern out of the tree colours. A pattern is called beautiful if all th

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