Skip to content

Commit b314193

Browse files
committed
Added README.md file for Redistribute Characters to Make All Strings Equal
1 parent a00a017 commit b314193

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

  • 2025-redistribute-characters-to-make-all-strings-equal
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<h2><a href="https://leetcode.com/problems/redistribute-characters-to-make-all-strings-equal">Redistribute Characters to Make All Strings Equal</a></h2> <img src='https://img.shields.io/badge/Difficulty-Easy-brightgreen' alt='Difficulty: Easy' /><hr><p>You are given an array of strings <code>words</code> (<strong>0-indexed</strong>).</p>
2+
3+
<p>In one operation, pick two <strong>distinct</strong> indices <code>i</code> and <code>j</code>, where <code>words[i]</code> is a non-empty string, and move <strong>any</strong> character from <code>words[i]</code> to <strong>any</strong> position in <code>words[j]</code>.</p>
4+
5+
<p>Return <code>true</code> <em>if you can make<strong> every</strong> string in </em><code>words</code><em> <strong>equal </strong>using <strong>any</strong> number of operations</em>,<em> and </em><code>false</code> <em>otherwise</em>.</p>
6+
7+
<p>&nbsp;</p>
8+
<p><strong class="example">Example 1:</strong></p>
9+
10+
<pre>
11+
<strong>Input:</strong> words = [&quot;abc&quot;,&quot;aabc&quot;,&quot;bc&quot;]
12+
<strong>Output:</strong> true
13+
<strong>Explanation:</strong> Move the first &#39;a&#39; in <code>words[1] to the front of words[2],
14+
to make </code><code>words[1]</code> = &quot;abc&quot; and words[2] = &quot;abc&quot;.
15+
All the strings are now equal to &quot;abc&quot;, so return <code>true</code>.
16+
</pre>
17+
18+
<p><strong class="example">Example 2:</strong></p>
19+
20+
<pre>
21+
<strong>Input:</strong> words = [&quot;ab&quot;,&quot;a&quot;]
22+
<strong>Output:</strong> false
23+
<strong>Explanation:</strong> It is impossible to make all the strings equal using the operation.
24+
</pre>
25+
26+
<p>&nbsp;</p>
27+
<p><strong>Constraints:</strong></p>
28+
29+
<ul>
30+
<li><code>1 &lt;= words.length &lt;= 100</code></li>
31+
<li><code>1 &lt;= words[i].length &lt;= 100</code></li>
32+
<li><code>words[i]</code> consists of lowercase English letters.</li>
33+
</ul>

0 commit comments

Comments
 (0)