Mirror Alert Substring Count
Preview mode. Log in to edit, run, submit, and save progress.
Mirror Alert Substring Count
A fraud console examines every contiguous substring of an alert string. A substring is considered mirrored if it reads the same forward and backward. Every mirrored substring occurrence must be counted. If the same text appears at multiple positions, each occurrence is counted separately because it represents a different part of the alert timeline. Input Format: You are given a string s. Output Format: Return the total number of palindromic substring occurrences.
Examples
s = "aaa"
6
Explanation: The palindromic substrings are ["a", "aa", "aaa", "a", "aa", "a"]. Count = 6, so the output is 6.
Approach hint
Expand around every possible center.
Common mistake
Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.