Skip to content

Practice Count Integers With Even Digit Sum

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#2180
LeetCode Problem

Count Integers With Even Digit Sum

Problem Statement

Given a positive integer num, return the number of positive integers less than or equal to num whose digit sums are even. The digit sum of a positive integer is the sum of all its digits.

Source: Count Integers With Even Digit Sum on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
num = 4
Output
2

# Example 2

Input
num = 30
Output
14

Constraints

1 <= num <= 1000

Related LeetCode Problems

Practice more problems similar to Count Integers With Even Digit Sum.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.