leetcode2sumc 1160. find words that can be formed by characters ...
leetcode 2和c 1160.-find-words-that-can-be-formed-by-characters-c-map-leetcode给你一个字符串数组words和一个字符串chars。如果字符串可以由字符中的字符组成(每个字符只能使用一次),则该字符串是好的。返回单词中所有好的字符串的长度总和。示例1:输入:words = ["cat","bt","hat","tree"], chars = "atach"输出:6解释:可以组成的字符串是“cat”和“hat”,所以答案是3 + 3 = 6。示例2:输入:words = ["hello","world","leetcode"], chars = "welldoneyr"输出:10解释:可以组成的字符串是"hello"和"world"所以答案是5 + 5 = 10.
下载地址
用户评论