Viewpoint from a hiring manager:
I would be very surprised at this kind of action from a candidate - and, depending on exactly what they sent back, it might work in their favour.
How to make it work
If you just respond with "hey, I googled the problem and found this solution was better than mine", it wouldn't really add anything to the consideration.
On the other hand, if you say something like:
I found that problem very interesting, and while I think I provided a good and working solution, I've been putting in some extra thought and think I've a more optimal one.
I did a bit of research - (link to wherever) - and found this similar idea, and if I adapted it, then the algorithm would be (some) faster.
Is it worth it, though
While it's nice to know that you're keen to improve and research, and interested enough in the job to try and score a few more points, it probably won't change the outcome.
For one thing - a good hiring manager will realise that getting a highly optimised solution in a short, supervised test is not very likely - they are looking at other things, like your approach and surface knowledge (ie, not reinventing wheels when the language has a built-in methods for that).
For another - if you didn't come across as keen and excited person at the interview, any follow up won't fix that. Conversely, if you did come across as keen and excited, any follow up won't add to that impression.
In the end, there'd have to be a very fine balance between you and any other candidate for the spot for this to influence whether you get the call.
Still - it's good for your own skill development to see how to approach the test question better - but I wouldn't bother following up with the interviewer.