there can be many solutions to a problem. some are more preferable than others. there…