3279. Maximum Total Area Occupied by Pistons
ArrayHash TableStringSimulationCountingPrefix Sum
Hints
Hint 1
Simulate the process.
Hint 2
We only need to keep track of the times when a piston reaches one end and let’s call these critical points.
Hint 3
For each piston, find the first time it reaches one end and sort these times (these times are critical points).
Hint 4
Find a way to calculate the area difference between two consecutive critical points in constant time.
Preparing judge…