Skip to content

Commit cacc4e7

Browse files
add skeleton for 1170
1 parent f406395 commit cacc4e7

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.fishercoder.solutions;
2+
3+
/**
4+
* 1170. Compare Strings by Frequency of the Smallest Character
5+
*
6+
* Let's define a function f(s) over a non-empty string s,
7+
* which calculates the frequency of the smallest character in s.
8+
* For example, if s = "dcce" then f(s) = 2 because the smallest character is "c" and its frequency is 2.
9+
* Now, given string arrays queries and words,
10+
* return an integer array answer,
11+
* where each answer[i] is the number of words such that f(queries[i]) < f(W), where W is a word in words.
12+
*
13+
* Example 1:
14+
* Input: queries = ["cbd"], words = ["zaaaz"]
15+
* Output: [1]
16+
* Explanation: On the first query we have f("cbd") = 1, f("zaaaz") = 3 so f("cbd") < f("zaaaz").
17+
*
18+
* Example 2:
19+
* Input: queries = ["bbb","cc"], words = ["a","aa","aaa","aaaa"]
20+
* Output: [1,2]
21+
* Explanation: On the first query only f("bbb") < f("aaaa"). On the second query both f("aaa") and f("aaaa") are both > f("cc").
22+
*
23+
* Constraints:
24+
* 1 <= queries.length <= 2000
25+
* 1 <= words.length <= 2000
26+
* 1 <= queries[i].length, words[i].length <= 10
27+
* queries[i][j], words[i][j] are English lowercase letters.
28+
* */
29+
public class _1170 {
30+
public static class Solution1 {
31+
public int[] numSmallerByFrequency(String[] queries, String[] words) {
32+
return null;
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)