Skip to content

Practice Largest 3-Same-Digit Number in String

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

Easy#2264
LeetCode Problem

Largest 3-Same-Digit Number in String

Problem Statement

Find every length-three substring of num consisting of one repeated digit. Return the greatest such three-character string, preserving leading zeros, or an empty string if none exists.

Source: Largest 3-Same-Digit Number in String on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
num = "6777133339"
Output
"777"

# Example 2

Input
num = "2300019"
Output
"000"

# Example 3

Input
num = "42352338"
Output
""

Constraints

3 <= num.length <= 1000
num only consists of digits.

Related LeetCode Problems

Practice more problems similar to Largest 3-Same-Digit Number in String.

Review your practice with PhantomCodeAI

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