Trains the technique from
LeetCode 2484Count Palindromic SubsequencesThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A cloakroom prints a strip of digits on every ticket. The strip is given as the string strip, made up of digit characters.
A pick marks five positions of the strip and reads the digits sitting there from the lowest marked position to the highest. A pick is a mirror pick when the five digits it reads are unchanged by reading them the other way round, that is, when the first digit equals the fifth and the second equals the fourth. The digit in the middle is under no such condition.
Two picks count as different when the sets of positions they mark are different, even if both read the same five digits. Return the number of mirror picks as a remainder modulo 10^9 + 7.
Example 1
The strip has exactly five positions, so there is one pick, and the digits 4, 8, 2, 8, 4 it reads are unchanged the other way round.
Example 2
Any five of the six positions read 22222, and there are six ways to leave one position unmarked, so six different position sets qualify.
Example 3
Positions 0, 1, 5 and 6 carry 1, 0, 0 and 1, and marking any one of positions 2, 3 or 4 alongside them reads 10201, 10701 and 10301.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def count_mirror_picks(strip: str) -> int:public int countMirrorPicks(String strip)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.