Company: Amazon_july
Difficulty: medium
Minimum Even-Length Subsegments Problem Description Amazon Prime Video is developing a new feature called "Segmentify". This feature applies to a video with N (even) visual frames, where each frame is represented by a binary character in the array frames . In this format, a "0" represents a black pixel, and a "1" represents a white pixel. Due to factors like lighting and camera angles, some frames may need horizontal or vertical flips (changing "0"s to "1"s and vice versa) to create consistent visuals. The objective is to divide the video into subsegments so that all frames in a subsegment are visually identical (i.e., the frames in a subsegment are either all "0"s or all "1"s). Additionally, each subsegment should have an even length. The goal is to accomplish this segmentation with two criteria in mind: 1. Minimize the number of flips required to form valid segments, let this be denoted by B. 2. Among all configurations requiring B flips, minimize the total number of subsegments. Giv