29. Distance to Previous Zero

Hard

df has an integer column 'X'. For each value, count the distance back to the previous zero (or the start, whichever is closer). Return this as a Series.

X = [7,2,0,3,4,2,5,0,3,4]  ->  [1,2,0,1,2,3,4,0,1,2]

Sample data: df:

   X
0  7
1  2
2  0
3  3
4  4
5  2
... (10 rows total)
Implement solve(...)