Sequential Target Detection and Tracking via Dynamic Programming