Goldman Sachs interview question

leetcode questions about binary array