1737. Change Minimum Characters to Satisfy One of Three Conditions
https://leetcode.com/problems/change-minimum-characters-to-satisfy-one-of-three-conditions
Description
You are given two strings a
and b
that consist of lowercase letters. In one operation, you can change any character in a
or b
to any lowercase letter.
Your goal is to satisfy one of the following three conditions:
Every letter in
a
is strictly less than every letter inb
in the alphabet.Every letter in
b
is strictly less than every letter ina
in the alphabet.Both
a
andb
consist of only one distinct letter.
Return the minimum number of operations needed to achieve your goal.
Example 1:
Example 2:
Constraints:
1 <= a.length, b.length <= 105
a
andb
consist only of lowercase letters.
ac
Last updated