DEV Community 👩‍💻👨‍💻


Posted on

Smallest Even Multiple

Given a positive integer n, return the smallest positive integer that is a multiple of both 2 and n.

class Solution(object):
    def smallestEvenMultiple(self, n):
        :type n: int
        :rtype: int
        res = 2 
        while True:
            if res % n == 0:
                return res
            res += 2

Enter fullscreen mode Exit fullscreen mode

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Just kidding, it's a personal preference. But you can change your theme, font, etc. in your settings.

The more you know. 🌈