1β£- Many good answers that, even being a working solution, weren't the fastest ones.
That's ok, but of course an interviewer might follow up asking you: Can you make it faster?
Tip: would a better data structure help you?
2β£- A working solution is better than no solution!
Sometimes we want to optimize the code but usually you only have 1 hour to finish! Be smart, have a solution and explain how you'd make it perfect
With practice, your good solutions will become the perfect solution by default!