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. Clearly explain your approach and let them know that you welcome their input on alternatives and improvements. In the workplace, there's so many ways to achieve this:
The recent discussion around building better technical understanding/communication should help here as well.
Both in the context of a data structure and algorithm problem...
DSA is much more straightforward. 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!