Tap here to switch tabs
Problem
Submissions

Problem: Next Greater Numerically Balanced Number

med
30 min
Try to solve the Next Greater Numerically Balanced Number problem.

Statement

An integer is considered numerically balanced if, for every digit dd present in the integer, the frequency of dd in the integer is exactly equal to dd.

Given an integer n, return the smallest numerically balanced integer strictly greater than n.

Constraints:

  • 0≤0 \leq n ≤106\leq 10^6

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Next Greater Numerically Balanced Number

med
30 min
Try to solve the Next Greater Numerically Balanced Number problem.

Statement

An integer is considered numerically balanced if, for every digit dd present in the integer, the frequency of dd in the integer is exactly equal to dd.

Given an integer n, return the smallest numerically balanced integer strictly greater than n.

Constraints:

  • 0≤0 \leq n ≤106\leq 10^6