simplified if statement in dynamic algorithm