🔥 [LeetCode The Hard Way] 🔥 Explained Line By Line
Please check out LeetCode The Hard Way for more solution explanations and tutorials. \nIf you like it, please give a star, watch my Github Repository and upvote
Please check out [LeetCode The Hard Way](https://wingkwong.github.io/leetcode-the-hard-way/) for more solution explanations and tutorials. \nIf you like it, please give a star, watch my [Github Repository](https://github.com/wingkwong/leetcode-the-hard-way) and upvote this post. You may also join my [Discord](https://discord.gg/Nqm4jJcyBf) for more updates.\n\n---\n\n**Python**\n\n```py\nclass Solution:\n    def smallestEvenMultiple(self, n: int) -> int:\n\t\t# it\'s just asking for LCM of 2 and n\n        return lcm(2, n)\n```\n\n```py\nclass Solution:\n    def smallestEvenMultiple(self, n: int) -> int:\n\t\t# alternatively, we can use GCD to calculate LCM\n        return (2 * n) // gcd(2, n)\n```\n\n```py\nclass Solution:\n    def smallestEvenMultiple(self, n: int) -> int:\n\t\t# or simply check if it is divisable by 2, if so return n\n\t\t# else return its double\n        return 2 * n if n & 1 else n\n```
['Python', 'Python3']