Tap here to switch tabs
Problem
Submissions

Problem: Minimum Number of Operations to Make X and Y Equal

Try to solve the Minimum Number of Operations to Make X and Y Equal problem.

Statement

You are given two positive integers x and y.

In one operation, you can apply any of the following transformations to x:

  1. Divide x by 1111 if x is divisible by 1111.

  2. Divide x by 55 if x is divisible by 55.

  3. Decrement x by 11.

  4. Increment x by 11.

Return the minimum number of operations required to make x equal to y.

Constraints:

  • 1≤1 \leq x, y ≤104\leq 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Number of Operations to Make X and Y Equal

Try to solve the Minimum Number of Operations to Make X and Y Equal problem.

Statement

You are given two positive integers x and y.

In one operation, you can apply any of the following transformations to x:

  1. Divide x by 1111 if x is divisible by 1111.

  2. Divide x by 55 if x is divisible by 55.

  3. Decrement x by 11.

  4. Increment x by 11.

Return the minimum number of operations required to make x equal to y.

Constraints:

  • 1≤1 \leq x, y ≤104\leq 10^4