Square Interview Question

A coding challenge problem which requires to apply sliding window algorithm. If you successful in solving the problem they increase the difficulty, by applying more constraints.