We were asked, "Has a software engineering interviewee ever come up with a better solution than the expected best answer?"
The question told me that the one who posed it hadn't done many interviews. As an interviewee, I did this often, though it was often met with defensiveness from the interviewer.
As an interviewer, it happens to me all the time, and I've tried awfully hard not to be defensive as I'd seen so many interviewers become.
Once on the job, too, software engineers frequently come up with better answers than their managers, teammates, or team leaders knew and expected. Or, I must admit, better than their consultants.
When this happens in any of these situations, it's important for the interviewer, manager, team leader, teammate, or consultant to accept the answer graciously, thanking the person for teaching them something new.
Even if the new idea isn't "better," if it's new, it's an opportunity to learn, so you don't want to spend your efforts trashing the idea. Just take in into your mind and offer thanks.
When I was a little boy, my father challenged me to learn something new every day before allowing myself to go to bed. Learning new things all the time is perhaps the most important behavior in my life. It's certainly the most important behavior in our profession
Generally, the most powerful learning occurs when someone produces a better solution than you had imagined. If your ego cannot deal with “better” or even “different” solutions to problems you pose, you have no business being in a leadership position in software engineering.
Or maybe anywhere.