Beads on a string

Authors

  • Pavel Töpfer Faculty of Mathematics and Physics, Charles University, Prague

Abstract

The article from the series dedicated to problems of Mathematical Olympiad – category P (programming) discusses different solutions of one practice competition problem from the central round of the 2017/18 school year. The task is to assemble the longest necklace from a sequence of multicoloured beads, in which the beads are arranged according to their colour shades. Each bead can be threaded to the left or to the right, or we can omit it. The algorithm builds on the known task of selecting the longest increasing subsequence from a given sequence of numbers. Competing students were acquainted with a solution of this task in the school round of the competition. Besides the detailed analysis of the problem, we find in the article three basic variants of the solution with different time complexity. Two of these solutions are written in the form of a sample program.

Published

2019-08-28

How to Cite

Töpfer, P. (2019). Beads on a string. MATHEMATICS–PHYSICS–INFORMATICS, 28(3), 229–235. Retrieved from https://mfi.upol.cz/index.php/mfi/article/view/462

Issue

Section

Informatics