Minimum number of steps required to place all 1s at a single index
Given a binary array A[] of size N, where all 1s can be moved to its adjacent position, the task is to print an array res[] of size N, where res[i] contains the minimum number of steps required to move all the 1s at the ith index. Examples: Input: A[] = {1, 0, 1, 0}Output: {2, 2, 2, 4}Explanation: F