This is a verified interview question from De-shaw. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Minimum Number of Substrings -De Shaw" covers key patterns like Strings.
"You are given: - A binary string `s` consisting only of '0' and '1'. - An integer `frameSize`. Your task is to split `s` into the minimum number of contiguous, non-overlapping substrings such that every substring satisfies the following conditions: 1. The length of the substring is at most `frameSize`. 2. The substring is not perfectly alternating. A binary string is perfectly alternating if every pair of adjacent characters is different. In other words, no two consecutive characters are the same. ### Examples Perfectly alternating substrings: - 01 - 10 - 0101 - 1010 - 010101 Not perfectly alternating substrings: - 1011 - 011010 - 110101 - 00 - 111 ### Objective 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."
Join thousands of developers practicing for De-shaw.