Tap here to switch tabs
Problem
Submissions

Problem: Minimum Operations to Make a Special Number

Minimum Operations to Make a Special Number asks you to delete digits from a nonnegative number string until its remaining value is divisible by 25, using as few deletions as possible.

Statement

You are given a string num representing a non negative integer.

In one operation, you can pick any digit in num and delete it. If you delete all digits from num, the resulting value is considered to be 00.

An integer is considered special if it is divisible by 2525.

Return the minimum number of operations required to make num special.

Constraints:

  • 1≤1 \leq num.length ≤100\leq 100

  • num consists only of digits ′0′'0' through ′9′'9'.

  • num does not contain any leading zeros.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Operations to Make a Special Number

Minimum Operations to Make a Special Number asks you to delete digits from a nonnegative number string until its remaining value is divisible by 25, using as few deletions as possible.

Statement

You are given a string num representing a non negative integer.

In one operation, you can pick any digit in num and delete it. If you delete all digits from num, the resulting value is considered to be 00.

An integer is considered special if it is divisible by 2525.

Return the minimum number of operations required to make num special.

Constraints:

  • 1≤1 \leq num.length ≤100\leq 100

  • num consists only of digits ′0′'0' through ′9′'9'.

  • num does not contain any leading zeros.