Pergunta de entrevista da empresa Mend.io

Check that some property holds for a given array efficiently and wrap it as HTTP server, naive algorithm is n^3, I solved with n^2, there exists a linear solution