Re-added subarray closest sum algorithm