Goldman Sachs interview question

In the loop round, they asked a challenging data structures problem that required optimizing from a brute-force approach to an efficient solution. The focus was not just on getting the correct answer but on explaining the thought process, handling edge cases, and improving time complexity step by step. They also asked follow-up questions to test deeper understanding of the logic and trade-offs.