Goldman Sachs interview question

Basic Logic and Geeks For Geeks coding questions