Regarding 2 pointer approach

i have able to find the length of maximum possible subset but unable to print the modified array with this approach.
please tell me how to do this.

Hi @D19APPPP0016

For each iteration if the gap between two pointers is maximum, store them in separate variables. Then after the loop make all the elements of array as 1 starting from index of first pointer to second pointer. Then just print the array a.

Hope it Helps.