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
// Given a string array words, return an array of all characters that show up in all strings within the words (including duplicates). You may return the answer in any order.
3
+
4
+
// Example 1:
5
+
// Input: words = ["bella","label","roller"]
6
+
// Output: ["e","l","l"]
7
+
// Example 2:
8
+
// Input: words = ["cool","lock","cook"]
9
+
// Output: ["c","o"]
10
+
11
+
// Constraints:
12
+
// 1 <= words.length <= 100
13
+
// 1 <= words[i].length <= 100
14
+
// words[i] consists of lowercase English letters.
// In English, we have a concept called root, which can be followed by some other word to form another longer word - let's call this word derivative. For example, when the root "help" is followed by the word "ful", we can form a derivative "helpful".
3
+
// Given a dictionary consisting of many roots and a sentence consisting of words separated by spaces, replace all the derivatives in the sentence with the root forming it. If a derivative can be replaced by more than one root, replace it with the root that has the shortest length.
4
+
// Return the sentence after the replacement.
5
+
6
+
// Example 1:
7
+
// Input: dictionary = ["cat","bat","rat"], sentence = "the cattle was rattled by the battery"
// Alice has some number of cards and she wants to rearrange the cards into groups so that each group is of size groupSize, and consists of groupSize consecutive cards.
3
+
4
+
// Given an integer array hand where hand[i] is the value written on the ith card and an integer groupSize, return true if she can rearrange the cards, or false otherwise.
5
+
6
+
// Example 1:
7
+
// Input: hand = [1,2,3,6,2,3,4,7,8], groupSize = 3
8
+
// Output: true
9
+
// Explanation: Alice's hand can be rearranged as [1,2,3],[2,3,4],[6,7,8]
10
+
// Example 2:
11
+
// Input: hand = [1,2,3,4,5], groupSize = 4
12
+
// Output: false
13
+
// Explanation: Alice's hand can not be rearranged into groups of 4.
0 commit comments