Company: Amazon_1_Feb
Difficulty: medium
Maximum Protected Population Problem Description In Amazon's Smart Cities Management System, each city has a given population and some cities are equipped with security units. You are given: An integer array population of size n , where population[i] is the number of inhabitants in the i th city. A binary string unit of length n , where unit[i] = '1' means city i has a security unit, and '0' means it does not. Relocation Rule A security unit at city i (where i > 1 ) can be moved one step to the left to city i - 1 . Each unit can be moved at most once. If moved, city i loses its unit and city i - 1 gains one. City 1 security unit cannot be moved further left. Objective A city is protected if it has a security unit after all relocations. Determine the maximum population that can be protected by optimally relocating the security units. Note on Indexing The problem uses 1-based indexing, meaning city indices, the population array, and the unit binary string all start from 1 and go up to