Longest Common Rollercoasters

Kosuke Fujita, Yuto Nakashima, Shunsuke Inenaga, Hideo Bannai, Masayuki Takeda

Research output: Chapter in Book/Report/Conference proceedingConference contribution

2 Citations (Scopus)


For an integer k≥ 3, a k-rollercoaster is a numeric string such that any maximal strictly non-increasing or non-decreasing substring has length at least k. We consider the problem of computing the longest common k-rollercoaster between two integer strings S and T, i.e., the longest k-rollercoaster that is a subsequence common to both S and T. We give two algorithms that solve this problem; The first runs in O(nmk) time and space, where n, m are respectively the lengths of S and T. The second runs in O(rklog 3mlog log m) time and O(rk) space, where r= O(mn) is the number of pairs (i, j) of matching points such that S[ i] = T[ j], assuming that m≤ n and that S, T only consist of characters which occur in both strings. The second algorithm is faster than the first one when r is sub-linear in nm/log3mloglogm.

Original languageEnglish
Title of host publicationString Processing and Information Retrieval - 28th International Symposium, SPIRE 2021, Proceedings
EditorsThierry Lecroq, Hélène Touzet
PublisherSpringer Science and Business Media Deutschland GmbH
Number of pages12
ISBN (Print)9783030866914
Publication statusPublished - 2021
Event28th International Symposium on String Processing and Information Retrieval, SPIRE 2021 - Virtual, Online
Duration: Oct 4 2021Oct 6 2021

Publication series

NameLecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)
Volume12944 LNCS
ISSN (Print)0302-9743
ISSN (Electronic)1611-3349


Conference28th International Symposium on String Processing and Information Retrieval, SPIRE 2021
CityVirtual, Online

All Science Journal Classification (ASJC) codes

  • Theoretical Computer Science
  • Computer Science(all)


Dive into the research topics of 'Longest Common Rollercoasters'. Together they form a unique fingerprint.

Cite this