Goldman Sachs interview question

Hackerrank had both math and coding questions