Hi,
I came across this question of a Amazon SDE-1 round, how can this problem be solved?
Let us consider a parcel service X which stores its parcel in a warehouse.
The company has found that it takes a lot of time to load the parcels onto the truck if there are gaps between
the parcels and hence wants to group them together. Help company X to find the minimum number of moves to group the parcels together.
Here ‘P’ denotes a parcel and ‘_’ denotes an empty slot.
Eg: