Skip to content

Practice Minimum Operations to Make a Special Number

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

Medium#2844
LeetCode Problem

Minimum Operations to Make a Special Number

Problem Statement

You are given a 0-indexed string num representing a non-negative integer. In one operation, you can pick any digit of num and delete it. Note that if you delete all the digits of num, num becomes 0. Return the minimum number of operations required to make num special. An integer x is considered special if it is divisible by 25.

Source: Minimum Operations to Make a Special Number on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
num = "2245047"
Output
2

# Example 2

Input
num = "2908305"
Output
3

# Example 3

Input
num = "10"
Output
1

Constraints

1 <= num.length <= 100
num only consists of digits '0' through '9'.
num does not contain any leading zeros.

Related LeetCode Problems

Practice more problems similar to Minimum Operations to Make a Special Number.

Review your practice with PhantomCodeAI

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