All Posts
Leetcode 1733: Minimum Number of People to Teach
In a social network consisting of multiple users and their friendships, users can communicate with each other only if they share a common language. You are given a list of languages each user knows and a list of friendships between users. Your task is to teach a single language to some users such that all the users in each friendship can communicate. The goal is to minimize the number of users you need to teach the new language.
Leetcode 1737: Change Minimum Characters to Satisfy One of Three Conditions
You are given two strings, a
and b
, consisting of lowercase letters. In one operation, you can change any character in either string to any lowercase letter. Your goal is to perform the minimum number of operations to satisfy one of the following three conditions:
- Every character in string
a
is strictly less than every character in stringb
alphabetically. - Every character in string
b
is strictly less than every character in stringa
alphabetically. - Both
a
andb
consist of only one distinct character.
Return the minimum number of operations needed to achieve one of these conditions.