Both in the context of a data structure and algorithm problem and in the context of a software problem or any problem really it is important to weigh the pros and cons and have arguments to back your decision making.
Having the knowledge to come up with several solutions is challenging - how do you get good at this? Is experience the only answer? Do you have any techniques you put in place to help with this?
The main way is to just to talk to other people. Bounce your ideas off of them and seek their feedback using the techniques from this video: This Is How You Get Feedback - Making The Process Smooth
Clearly explain your current approach and let your peers know that you genuinely welcome any and all input on alternatives and improvements. In the workplace, there's so many ways to achieve this:
The recent discussion around strengthening your technical communication skills should help here as well: "How do you get good at understanding and communicating technically?"
Both in the context of a data structure and algorithm problem...
DSA is much more straightforward as we talk about in this video: Effectively Learning Data Structures And Algorithms (DSA) For Software Engineer Interviews
There's only really 2 angles:
When you come up with a DSA solution, see if you can trade run-time for space (this is generally the one you should try as DSA solving is overwhelmingly based around optimizing run-time) or vice-versa. Any known DSA problem will have many, many alternative solutions online - You can read through them and extract patterns to learn how you can come up with these in the future.
Thank you - really helpful!