Class Solution

java.lang.Object
g2401_2500.s2413_smallest_even_multiple.Solution

public class Solution extends Object
2413 - Smallest Even Multiple.<p>Easy</p> <p>Given a <strong>positive</strong> integer <code>n</code>, return <em>the smallest positive integer that is a multiple of <strong>both</strong></em> <code>2</code> <em>and</em> <code>n</code>.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> n = 5</p> <p><strong>Output:</strong> 10</p> <p><strong>Explanation:</strong> The smallest multiple of both 5 and 2 is 10.</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> n = 6</p> <p><strong>Output:</strong> 6</p> <p><strong>Explanation:</strong> The smallest multiple of both 6 and 2 is 6. Note that a number is a multiple of itself.</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= n <= 150</code></li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • smallestEvenMultiple

      public int smallestEvenMultiple(int n)