You are given:
s consisting only of '0' and '1'.frameSize.Your task is to split s into the minimum number of contiguous, non-overlapping substrings such that every substring satisfies the following conditions:
frameSize.A binary string is perfectly alternating if every pair of adjacent characters is different. In other words, no two consecutive characters are the same.
Perfectly alternating substrings:
Not perfectly alternating substrings:
Return the minimum number of contiguous substrings needed to partition the entire string while satisfying the above conditions.
If no valid partition exists, return -1.