Managing Event
CodeChefOpen on judge ↗
You have a string s1 s2………sn and a character r and you want to make all characters of the string equal to r using the minimum number of operations. In one operation you can choose a number z (1≤z≤n) and for every position i, where i is not divisible by z, replace si with r. Find the minimum number of operations required to make all the characters equal to r and the z-s that you should use in you
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