无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Leetcode 1897. Redistribute Characters to Make All Strings Equal

2023-02-15 12:35 作者:您是打尖兒還是住店呢  | 我要投稿

You are given an array of strings?words?(0-indexed).

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].

Return?true?if you can make?every?string in?words?equal?using?any?number of operations,?and?false?otherwise.

?

Example 1:

Input: words = ["abc","aabc","bc"]Output: trueExplanation: Move the first 'a' in words[1] to the front of words[2], to make words[1] = "abc" and words[2] = "abc". All the strings are now equal to "abc", so return true.

Example 2:

Input: words = ["ab","a"]Output: falseExplanation: It is impossible to make all the strings equal using the operation.

?

Constraints:

  • 1 <= words.length <= 100

  • 1 <= words[i].length <= 100

  • words[i]?consists of lowercase English letters.

用map可以,用數(shù)組也是可以的。Easy題目;



Runtime:?14 ms, faster than?19.35%?of?Java?online submissions for?Redistribute Characters to Make All Strings Equal.

Memory Usage:?41.9 MB, less than?69.89%?of?Java?online submissions for?Redistribute Characters to Make All Strings Equal.


Leetcode 1897. Redistribute Characters to Make All Strings Equal的評論 (共 條)

分享到微博請遵守國家法律
新源县| 扎鲁特旗| 柳河县| 洛浦县| 彭山县| 黎城县| 郸城县| 沂源县| 徐水县| 偃师市| 拉萨市| 大宁县| 华安县| 商洛市| 滨海县| 天门市| 万安县| 剑河县| 阿瓦提县| 海门市| 自治县| 宜昌市| 文登市| 永年县| 长治县| 清河县| 高邮市| 汝阳县| 临桂县| 枞阳县| 依安县| 博白县| 长岛县| 徐州市| 邵阳市| 尚志市| 老河口市| 顺昌县| 滁州市| 乌拉特后旗| 定兴县|