medium
Refactor for Efficiency
Optimize a Python function for better performance and readability.
📝 プロンプトの内容
Refactor the following Python code snippet to improve its time complexity and adhere to PEP 8 style guidelines. Add comments explaining the changes made. [Paste code here]