It was a useful answer.
Any answer that contains only links with little or no other content that addresses the question are in serious danger of being deleted. Stack Overflow is not just a link dump site, we expect quality answers to be posted as answers here, not elsewhere. Plus, over time, links can break which renders the answer totally worthless.
If you had included a relevant portion of code in the answer along with the link and / or a brief discussion of how the code addressed the question—why it's a 'nice solution'. Your answer would probably not have been deleted.
As it stands right now, your new answer is also in danger of being deleted. I recommend you
improve your answer soon, before it too is deleted (too late), or do as Vigbyor suggests and improve your original answer and flag it to ask for a moderator to undelete it.
Your answer was deleted because it's a "link only answer" which was flagged as NAA (Not An Answer). Questions like these tend to get deleted.
You reposted the same answer, and that may again get deleted, for the same reason. Instead of doing that, you should have edited your old deleted answer with more information. After that you can flag it for moderator attention, asking that it be reopened.