Improving Math Problem Solving in Large Language Models Through Categorization and Strategy Tailoring