Tap here to switch tabs
Problem
Submissions

Problem: Largest Number After Mutating Substring

med
30 min
Try to solve the Largest Number After Mutating Substring problem.

Statement

You are given a string num representing a large integer and an integer array change of length 1010.

You may mutate at most one contiguous substring of num. To mutate a substring, replace each individual digit d in the chosen substring with the corresponding digit change[d].

Return a string representing the largest number that can be formed after applying this operation.

Note: A substring is a contiguous sequence of characters within a string.

Constraints:

  • 1≤1 \leq num.length ≤105\leq 10^5

  • num consists of only digits from 00 to 99

  • change.length =10= 10

  • 0≤0 \leq change[d] ≤9\leq 9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Largest Number After Mutating Substring

med
30 min
Try to solve the Largest Number After Mutating Substring problem.

Statement

You are given a string num representing a large integer and an integer array change of length 1010.

You may mutate at most one contiguous substring of num. To mutate a substring, replace each individual digit d in the chosen substring with the corresponding digit change[d].

Return a string representing the largest number that can be formed after applying this operation.

Note: A substring is a contiguous sequence of characters within a string.

Constraints:

  • 1≤1 \leq num.length ≤105\leq 10^5

  • num consists of only digits from 00 to 99

  • change.length =10= 10

  • 0≤0 \leq change[d] ≤9\leq 9