You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are given two strings `word1` and `word2`. Merge the strings by adding letters in alternating order, starting with `word1`. If a string is longer than the other, append the additional letters onto the end of the merged string.
4
+
5
+
Return *the merged string.*
6
+
7
+
**Example 1:**
8
+
9
+
```
10
+
Input: word1 = "abc", word2 = "pqr"
11
+
Output: "apbqcr"
12
+
Explanation: The merged string will be merged as so:
13
+
word1: a b c
14
+
word2: p q r
15
+
merged: a p b q c r
16
+
17
+
```
18
+
19
+
**Example 2:**
20
+
21
+
```
22
+
Input: word1 = "ab", word2 = "pqrs"
23
+
Output: "apbqrs"
24
+
Explanation: Notice that as word2 is longer, "rs" is appended to the end.
25
+
word1: a b
26
+
word2: p q r s
27
+
merged: a p b q r s
28
+
29
+
```
30
+
31
+
**Example 3:**
32
+
33
+
```
34
+
Input: word1 = "abcd", word2 = "pq"
35
+
Output: "apbqcd"
36
+
Explanation: Notice that as word1 is longer, "cd" is appended to the end.
37
+
word1: a b c d
38
+
word2: p q
39
+
merged: a p b q c d
40
+
41
+
```
42
+
43
+
**Constraints:**
44
+
45
+
*`1 <= word1.length, word2.length <= 100`
46
+
*`word1` and `word2` consist of lowercase English letters.
Given an array of unique integers, `arr`, where each integer `arr[i]` is strictly greater than `1`.
4
+
5
+
We make a binary tree using these integers, and each number may be used for any number of times. Each non-leaf node's value should be equal to the product of the values of its children.
6
+
7
+
Return *the number of binary trees we can make*. The answer may be too large so return the answer **modulo**`10<sup>9</sup> + 7`.
8
+
9
+
**Example 1:**
10
+
11
+
```
12
+
Input: arr = [2,4]
13
+
Output: 3
14
+
Explanation: We can make these trees: [2], [4], [4, 2, 2]
15
+
```
16
+
17
+
**Example 2:**
18
+
19
+
```
20
+
Input: arr = [2,4,5,10]
21
+
Output: 7
22
+
Explanation: We can make these trees: [2], [4], [5], [10], [4, 2, 2], [10, 2, 5], [10, 5, 2].
0 commit comments