You don't need a clever algorithm for #3. You'll likely only have 4-5 potential targets. You can brute force that in reasonable time.
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
replies: