I'm only going to cover this in the broadest terms because I don't know the details of how the linked images appear in your site, but assuming each post contains one hotlinked image:
You need to write a script that loops through all your posts and parses the post content for a non-local URL. It needs to make a request for that URL, examine the status code returned by the request then if the status indicates that the link is broken your script will need to firstly delete the post, then implement a 301 redirect to a different URL of your choice (your homepage, the post's category or a related post) for the deleted post's permalink to avoid your own site being littered with dead links.
Interpreting the status code returned for the URL is another thing that you're going to have to fine-tune based on the policies of the image hosting sites - some will return a 404, others might do something else. The most comprehensive method would be to assume that anything that doesn't return 200 is a broken link, although that might lead to false positives.