4100 - 4199
Solutions categorised by Problem IDs
LeetCode 4102 – Count Valid Substrings ICount substrings that avoid a contiguous “abc” by tracking the earliest valid start for each ending index.LeetCode 4103 – Remove Elements by Type and ColorUse a stack of type-and-color runs to determine whether removing consecutive groups can empty the sequence.LeetCode 4104 – Count Valid Substrings IICount substrings that avoid “abc” as a subsequence by tracking the latest start of each matched prefix.LeetCode 4105 – Repeated String Match IICheck whether one repeated string occurs inside another using modular indexing and a bounded number of character comparisons.LeetCode 4106 – Find Mismatched Segments Between Two StringsScan both strings together to extract the substring pair for each maximal run of mismatches.LeetCode 4107 – Count Valid Suffix Sorts ICount valid suffix starts using value frequencies, the first mismatch, and the last increase in the target.LeetCode 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.