Tap here to switch tabs
Problem
Submissions

Problem: Valid Digit Number

med
30 min
Try to solve the Valid Digit Number problem.

Statement

Given two integers n and x, determine whether n is a valid digit number with respect to x.

An integer n is considered valid if:

  • The decimal representation of n contains the digit x.

  • The leading digit of n is not equal to x.

Return true if n satisfies both conditions, and false otherwise.

Constraints:

  • 0≤0 \leq n ≤105\leq 10^5

  • 0≤0 \leq x ≤9\leq 9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Valid Digit Number

med
30 min
Try to solve the Valid Digit Number problem.

Statement

Given two integers n and x, determine whether n is a valid digit number with respect to x.

An integer n is considered valid if:

  • The decimal representation of n contains the digit x.

  • The leading digit of n is not equal to x.

Return true if n satisfies both conditions, and false otherwise.

Constraints:

  • 0≤0 \leq n ≤105\leq 10^5

  • 0≤0 \leq x ≤9\leq 9