Enable to optimise the solution

sir I am unable to optimize the solution
can you help me

hi @sraj39273 use sliding window technique