4100 - 4199
Solutions categorised by Problem IDs
4102 - Count Valid Substrings ICount substrings that avoid a contiguous “abc” by tracking the earliest valid start for each ending index.4103 - Remove Elements by Type and ColorUse a stack of type-and-color runs to determine whether removing consecutive groups can empty the sequence.4104 - Count Valid Substrings IICount substrings that avoid “abc” as a subsequence by tracking the latest start of each matched prefix.4105 - Repeated String Match IICheck whether one repeated string occurs inside another using modular indexing and a bounded number of character comparisons.4106 - Find Mismatched Segments Between Two StringsScan both strings together to extract the substring pair for each maximal run of mismatches.4107 - Count Valid Suffix Sorts ICount valid suffix starts using value frequencies, the first mismatch, and the last increase in the target.4108 - Minimum Cost to Make Red Nodes ConnectedUse tree DP to find the connected set of red nodes that saves the most compared with flipping every red node to blue.