1897. Redistribute Characters to Make All Strings Equal Easy
1/**
2 * [1897] Redistribute Characters to Make All Strings Equal
3 *
4 * You are given an array of strings words (0-indexed).
5 * In one operation, pick two distinct indices i and j, where words[i] is a non-empty string, and move any character from words[i] to any position in words[j].
6 * Return true if you can make every string in words equal using any number of operations, and false otherwise.
7 *
8 * Example 1:
9 *
10 * Input: words = ["abc","aabc","bc"]
11 * Output: true
12 * Explanation: Move the first 'a' in words[1] to the front of words[2],
13 * to make words[1] = "abc" and words[2] = "abc".
14 * All the strings are now equal to "abc", so return true.
15 *
16 * Example 2:
17 *
18 * Input: words = ["ab","a"]
19 * Output: false
20 * Explanation: It is impossible to make all the strings equal using the operation.
21 *
22 *
23 * Constraints:
24 *
25 * 1 <= words.length <= 100
26 * 1 <= words[i].length <= 100
27 * words[i] consists of lowercase English letters.
28 *
29 */
30pub struct Solution {}
31
32// problem: https://leetcode.com/problems/redistribute-characters-to-make-all-strings-equal/
33// discuss: https://leetcode.com/problems/redistribute-characters-to-make-all-strings-equal/discuss/?currentPage=1&orderBy=most_votes&query=
34
35// submission codes start here
36
37impl Solution {
38 pub fn make_equal(words: Vec<String>) -> bool {
39 false
40 }
41}
42
43// submission codes end
44
45#[cfg(test)]
46mod tests {
47 use super::*;
48
49 #[test]
50 fn test_1897() {
51 }
52}
53
Back
© 2025 bowen.ge All Rights Reserved.