Class Solution
java.lang.Object
g2101_2200.s2180_count_integers_with_even_digit_sum.Solution
2180 - Count Integers With Even Digit Sum.<p>Easy</p>
<p>Given a positive integer <code>num</code>, return <em>the number of positive integers <strong>less than or equal to</strong></em> <code>num</code> <em>whose digit sums are <strong>even</strong></em>.</p>
<p>The <strong>digit sum</strong> of a positive integer is the sum of all its digits.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> num = 4</p>
<p><strong>Output:</strong> 2</p>
<p><strong>Explanation:</strong></p>
<p>The only integers less than or equal to 4 whose digit sums are even are 2 and 4.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> num = 30</p>
<p><strong>Output:</strong> 14</p>
<p><strong>Explanation:</strong></p>
<p>The 14 integers less than or equal to 30 whose digit sums are even are</p>
<p>2, 4, 6, 8, 11, 13, 15, 17, 19, 20, 22, 24, 26, and 28.</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= num <= 1000</code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
countEven
public int countEven(int n)
-