SASMO Logic Practice: Minimise Deletions by Reading Runs of Equal Letters

An arrangement problem can hide a useful structure in repeated blocks. To minimise deletions, it helps to know both a construction that works and a bound showing that no better construction is possible. This original recreational exercise concerns a line of letters, not an official SASMO task.

Need help choosing a next step? Scan the contact QR code below or contact Hanlin on WeChat. Send SASMO-LETTER-RUNS-1117 and tell us your school year and question.

Fix the permitted operation

Start with the eight-letter string AAABBAAC. You may delete letters, but may not reorder the remaining ones. The final string must have different letters at every pair of neighbouring positions. Repeated letters are allowed when separated, so ABA is acceptable. The arrangement is a line, and the first and last letters are not considered neighbours.

Split the original string into runs

The maximal consecutive runs are AAA, BB, AA and C, with lengths 3, 2, 2 and 1. A run groups equal letters that are already next to one another. The two A runs are distinct because B letters separate them. Counting only distinct letter types would discard that positional information and would suggest an unnecessarily short final string.

Give a valid construction

Keep one letter from each run and delete the others. The result is ABAC, which has no equal neighbouring letters. The deletion count is (3-1) + (2-1) + (2-1) + (1-1) = 4. This establishes that four deletions are sufficient. By itself, however, a working construction does not prove that three deletions could never succeed.

Prove the lower bound

Within any original run, keeping two letters would leave those equal letters adjacent in the retained subsequence: there were no different letters between them to begin with. At most one letter from each run can therefore remain. There are four runs, so at most four of the eight original letters can be kept. At least four deletions are necessary, matching the construction.

Check how changing the rules changes the problem

Deleting a whole middle run can bring equal runs together, which does not improve the bound here. Allowing reordering would create a different optimisation problem, while treating the string as circular would add an endpoint condition. In preparation notes, state the operation and adjacency rule first, then separate a feasible result from the argument establishing optimality. The matching upper and lower bounds are what make the minimum convincing.

Continue reading: SASMO Counting Practice: Three Overlapping Clubs Need the Triple Intersection Added Back.

Contact Hanlin

Planning a first attempt or reviewing a topic you find difficult? Scan the QR code and send SASMO-LETTER-RUNS-1117. Include your school year, country or competition region, experience and the question you want to discuss.

Scan to contact Hanlin on WeChat. Send SASMO-LETTER-RUNS-1117.

Contact Hanlin on WeChat

On your phone, use the button or save the QR image and scan it within WeChat.

Official information and further reading: Source 1

Online Customer Service
Contact Customer Service