This Program can be solved in just 3 easy steps: -
1). First we need to add every element with its index (i.e., a[i] += i)
2). Then we need to Sort the array.
3). Finally, we need to subtract every index form its elements (i.e., a[i] -= i)
Now check the array is sorted or not,
If sorted then Print → YES & in next line print all elements of array separated by single space
Else Print → NO