arXiv · 2101.09699
Longest segment of balanced parentheses -- an exercise in program inversion in a segment problem (Functional Pearl)
Abstract
Given a string of parentheses, the task is to find the longest consecutive segment that is balanced, in linear time. We find this problem interesting because it involves a combination of techniques: the usual approach for solving segment problems, and a theorem for constructing the inverse of a function -- through which we derive an instance of shift-reduce parsing.
Explore related subjects
Keep this discovery
Shin-Cheng Mu, Tsung-Ju Chiang. 2021-01-24. Longest segment of balanced parentheses -- an exercise in program inversion in a segment problem (Functional Pearl). https://doi.org/10.1017/s0956796821000253
Cite the original work for its findings. Save a collection to share your selection of sources.