Assuming you're healthy, the best algorithm in my opinion is to park far away from the door. Less risk of damage to your car, easier time getting in and out, more exercise from walking further.
I don't even think you save time parking closer to the door since you frequently have to wait for others to get out of your way.
Only if you optimize for distance to door. Thing is walking 2 minutes is actually good for us and just because other people are competing to get the closest spot doesn't mean you should fall for that as well.
I spent most of my adult life just parking arbitrarily in large lots. Didn't even realize this until a girlfriend pointed it out to me. In retrospect, I suppose I was optimizing for spending as little time in my car as possible. It never even occurred to me that my goal should be "park as close to the building as possible".
My partner gets mad at me for my "park in the easiest spot to park in" strategy too. We're both able-bodied humans, though, so there's no reason we can't walk 40 extra feet to the store entrance.