← All problemsSign in

Delete And Append

Jack and you are friends . One fine day Jack challenged you to solve a problem . Jack gives a string s, and you can do two types of operations on it: ● Delete the last character of the string. ● Duplicate the string: s:=s+s, where + denotes concatenation. You can use each operation any number of times (possibly none). Your task is to find the lexicographically smallest string of length exactly

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