Tap here to switch tabs
Problem
Submissions

Problem: Closest Fair Integer

med
30 min
Try to solve the Closest Fair Integer problem.

Statement

Given a positive integer n, return the smallest fair integer that is greater than or equal to n.

An integer is considered fair if the total count of its even digits is equal to the total count of its odd digits.

Constraints:

  • 1≤1 \leq n ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Closest Fair Integer

med
30 min
Try to solve the Closest Fair Integer problem.

Statement

Given a positive integer n, return the smallest fair integer that is greater than or equal to n.

An integer is considered fair if the total count of its even digits is equal to the total count of its odd digits.

Constraints:

  • 1≤1 \leq n ≤109\leq 10^9