Today is a first day of https://adventofcode.com/2023/day/1, great opportunity to learn some new language. I will be solving it in Rust https://github.com/samoylenkodmitry/AdventOfCode_2023
GitHub
GitHub - samoylenkodmitry/AdventOfCode_2023: my advent of code 2023 solutions
my advent of code 2023 solutions. Contribute to samoylenkodmitry/AdventOfCode_2023 development by creating an account on GitHub.
#### Problem
We are given an array of strings
#### Example 1
- Input:
-
-
- Output:
- Explanation: The "good" strings that can be formed are "cat" and "hat", so the answer is
#### Example 2
- Input:
-
-
- Output:
- Explanation: The "good" strings that can be formed are "hello" and "world", so the answer is
#### Constraints
-
-
-
#### Problem URL
[Problem URL](https://leetcode.com/problems/find-words-that-can-be-formed-by-characters/?envType=daily-question&envId=2023-12-02)
We are given an array of strings
words
and a string chars
. A string is considered "good" if it can be formed using characters from chars
, with each character used only once. We need to find the sum of the lengths of all "good" strings in words
.#### Example 1
- Input:
-
words = ["cat","bt","hat","tree"]
-
chars = "atach"
- Output:
6
- Explanation: The "good" strings that can be formed are "cat" and "hat", so the answer is
3 + 3 = 6
.#### Example 2
- Input:
-
words = ["hello","world","leetcode"]
-
chars = "welldonehoneyr"
- Output:
10
- Explanation: The "good" strings that can be formed are "hello" and "world", so the answer is
5 + 5 = 10
.#### Constraints
-
1 <= words.length <= 1000
-
1 <= words[i].length, chars.length <= 100
-
words[i]
and chars
consist of lowercase English letters.#### Problem URL
[Problem URL](https://leetcode.com/problems/find-words-that-can-be-formed-by-characters/?envType=daily-question&envId=2023-12-02)