Skip to content

Practice Check if Number Has Equal Digit Count and Digit Value

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

Easy#2283
LeetCode Problem

Check if Number Has Equal Digit Count and Digit Value

Problem Statement

You are given a 0-indexed string num of length n consisting of digits. Return true if for every index i in the range 0 <= i < n, the digit i occurs num[i] times in num, otherwise return false.

Source: Check if Number Has Equal Digit Count and Digit Value on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
num = "1210"
Output
true

# Example 2

Input
num = "030"
Output
false

Constraints

n == num.length
1 <= n <= 10
num consists of digits.

Related LeetCode Problems

Practice more problems similar to Check if Number Has Equal Digit Count and Digit Value.

Review your practice with PhantomCodeAI

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