Daily challenge for 2026-09-12
620. Matching Bookend Markers
You are given a list of integer tokens representing a sequence of book tags. A contiguous section of tokens is considered properly bounded if its first token and its last token have identical absolute values (i.e. abs(first) == abs(last)). Return the maximum length of such a non-empty section whose outer markers share the same magnitude.
Example:Input: tokens = [3, 1, 4, -3, 2]Output: 4
Explanation: The slice from index 0 to index 3 is [3, 1, 4, -3], where abs(3) == abs(-3). Its length is 4.
If the input list is empty, return 0.
Run this challenge interactively in Python or JavaScript when the app loads.