HubSpot Interview Question

In the online coding assessment, you need fetch a JSON data from their API by writing a script and then modify that data to create a meaningful JSON result and post it to the API. In the systems design interview, a senior developer asks you to design an application and asks you some questions about it. In the coding part, the interviewer asked me an easy leetcode-like question, you need to implement the solution and go through your thought process and explain some potential improvement to your solution.