Optimize strength.js to handle dynamic number of teams