# A Simple Algorithm to Filter / Smooth / Denoise a Noisy Staircase Graph

Is there a way to remove the noise and smooth the graph into a staircase graph.

Assuming you meant to produce something similar to the green line:

$$\text{output}[n] = \max\{\text{input}[n-k], \text{input}[n-k+1], \ldots ,\text{input}[n]\}$$
i.e. you just find the maximum along a sliding window over the last $$k$$ input values?